Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
e6e97fdb39c573f52e3f304e726abee522ead89d
[simgrid.git] / buildtools / Cmake / Flags.cmake
1 set(warnCFLAGS "")
2 set(optCFLAGS "")
3
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__)
10
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)
14
15 if(enable_compile_optimizations)
16         set(optCFLAGS "-O3 -finline-functions -funroll-loops -fno-strict-aliasing ")
17 endif(enable_compile_optimizations)
18
19 if(NOT enable_debug)
20                 set(CMAKE_C_FLAGS "-DNDEBUG ${CMAKE_C_FLAGS}")
21 endif(NOT enable_debug)
22
23 set(CMAKE_C_FLAGS "${optCFLAGS}${warnCFLAGS}${CMAKE_C_FLAGS}")
24
25 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${custom_flags}")
26
27 if(WIN32)
28         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i486")
29 endif(WIN32)
30
31 if(enable_coverage)
32         find_program(GCOV_PATH gcov)
33         if(GCOV_PATH)
34                 SET(COVERAGE_COMMAND "${GCOV_PATH}" CACHE TYPE FILEPATH FORCE)
35                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
36                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
37                 add_definitions(-fprofile-arcs -ftest-coverage)
38                 endif(GCOV_PATH)
39 endif(enable_coverage)
40