4 if(NOT __VISUALC__ AND NOT __BORLANDC__)
5 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-g3")
6 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}-g3")
7 else(NOT __VISUALC__ AND NOT __BORLANDC__)
8 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}/Zi")
9 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}/Zi")
10 endif(NOT __VISUALC__ AND NOT __BORLANDC__)
12 if(enable_compile_warnings)
13 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 ")
14 endif(enable_compile_warnings)
16 if(enable_compile_warnings AND COMPILER_C_VERSION_MAJOR_MINOR MATCHES "4.6")
17 set(warnCFLAGS "${warnCFLAGS} -Wno-error=unused-but-set-variable ")
18 endif(enable_compile_warnings AND COMPILER_C_VERSION_MAJOR_MINOR MATCHES "4.6")
20 if(enable_compile_optimizations)
21 set(optCFLAGS "-O3 -finline-functions -funroll-loops -fno-strict-aliasing ")
22 else(enable_compile_optimizations)
24 endif(enable_compile_optimizations)
26 if(APPLE AND COMPILER_C_VERSION_MAJOR_MINOR MATCHES "4.6")
27 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
29 endif(APPLE AND COMPILER_C_VERSION_MAJOR_MINOR MATCHES "4.6")
32 set(CMAKE_C_FLAGS "-DNDEBUG ${CMAKE_C_FLAGS}")
33 endif(NOT enable_debug)
35 set(CMAKE_C_FLAGS "${optCFLAGS}${warnCFLAGS}${CMAKE_C_FLAGS}")
37 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${custom_flags}")
38 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${optCFLAGS}")
40 # Try to make Mac a bit more complient to open source standards
41 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
42 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE")
43 endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
46 find_program(GCOV_PATH gcov)
48 SET(COVERAGE_COMMAND "${GCOV_PATH}" CACHE TYPE FILEPATH FORCE)
49 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
50 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
51 add_definitions(-fprofile-arcs -ftest-coverage)
53 endif(enable_coverage)