4 if(NOT __VISUALC__ AND NOT __BORLANDC__)
5 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-g3")
6 else(NOT __VISUALC__ AND NOT __BORLANDC__)
7 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}/Zi")
8 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}/Zi")
9 endif(NOT __VISUALC__ AND NOT __BORLANDC__)
11 if(enable_compile_warnings)
12 set(warnCFLAGS "-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror ")
13 endif(enable_compile_warnings)
15 if(enable_compile_warnings AND COMPILER_C_VERSION_MAJOR_MINOR MATCHES "4.6")
16 set(warnCFLAGS "${warnCFLAGS} -Wno-error=unused-but-set-variable ")
17 endif(enable_compile_warnings AND COMPILER_C_VERSION_MAJOR_MINOR MATCHES "4.6")
19 if(enable_compile_optimizations)
20 set(optCFLAGS "-O3 -finline-functions -funroll-loops -fno-strict-aliasing ")
21 else(enable_compile_optimizations)
23 endif(enable_compile_optimizations)
26 set(CMAKE_C_FLAGS "-DNDEBUG ${CMAKE_C_FLAGS}")
27 endif(NOT enable_debug)
29 set(CMAKE_C_FLAGS "${optCFLAGS}${warnCFLAGS}${CMAKE_C_FLAGS}")
31 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${custom_flags}")
33 # Try to make Mac a bit more complient to open source standards
34 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
35 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE")
36 endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
39 find_program(GCOV_PATH gcov)
41 SET(COVERAGE_COMMAND "${GCOV_PATH}" CACHE TYPE FILEPATH FORCE)
42 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
43 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
44 add_definitions(-fprofile-arcs -ftest-coverage)
46 endif(enable_coverage)