| 1 |
if (UNIX AND NOT WIN32) |
| 2 |
# Activate with: -DCMAKE_BUILD_TYPE=Profiling |
| 3 |
set(CMAKE_C_FLAGS_PROFILING "-O0 -g -fprofile-arcs -ftest-coverage" |
| 4 |
CACHE STRING "Flags used by the C compiler during PROFILING builds.") |
| 5 |
set(CMAKE_CXX_FLAGS_PROFILING "-O0 -g -fprofile-arcs -ftest-coverage" |
| 6 |
CACHE STRING "Flags used by the CXX compiler during PROFILING builds.") |
| 7 |
set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage" |
| 8 |
CACHE STRING "Flags used by the linker during the creation of shared libraries during PROFILING builds.") |
| 9 |
set(CMAKE_MODULE_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage" |
| 10 |
CACHE STRING "Flags used by the linker during the creation of shared libraries during PROFILING builds.") |
| 11 |
set(CMAKE_EXEC_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage" |
| 12 |
CACHE STRING "Flags used by the linker during PROFILING builds.") |
| 13 |
|
| 14 |
# Activate with: -DCMAKE_BUILD_TYPE=AddressSanitizer |
| 15 |
set(CMAKE_C_FLAGS_ADDRESSSANITIZER "-g -O1 -fsanitize=address -fno-omit-frame-pointer" |
| 16 |
CACHE STRING "Flags used by the C compiler during ADDRESSSANITIZER builds.") |
| 17 |
set(CMAKE_CXX_FLAGS_ADDRESSSANITIZER "-g -O1 -fsanitize=address -fno-omit-frame-pointer" |
| 18 |
CACHE STRING "Flags used by the CXX compiler during ADDRESSSANITIZER builds.") |
| 19 |
set(CMAKE_SHARED_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address" |
| 20 |
CACHE STRING "Flags used by the linker during the creation of shared libraries during ADDRESSSANITIZER builds.") |
| 21 |
set(CMAKE_MODULE_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address" |
| 22 |
CACHE STRING "Flags used by the linker during the creation of shared libraries during ADDRESSSANITIZER builds.") |
| 23 |
set(CMAKE_EXEC_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address" |
| 24 |
CACHE STRING "Flags used by the linker during ADDRESSSANITIZER builds.") |
| 25 |
|
| 26 |
# Activate with: -DCMAKE_BUILD_TYPE=MemorySanitizer |
| 27 |
set(CMAKE_C_FLAGS_MEMORYSANITIZER "-g -O2 -fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer" |
| 28 |
CACHE STRING "Flags used by the C compiler during MEMORYSANITIZER builds.") |
| 29 |
set(CMAKE_CXX_FLAGS_MEMORYSANITIZER "-g -O2 -fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer" |
| 30 |
CACHE STRING "Flags used by the CXX compiler during MEMORYSANITIZER builds.") |
| 31 |
set(CMAKE_SHARED_LINKER_FLAGS_MEMORYSANITIZER "-fsanitize=memory" |
| 32 |
CACHE STRING "Flags used by the linker during the creation of shared libraries during MEMORYSANITIZER builds.") |
| 33 |
set(CMAKE_MODULE_LINKER_FLAGS_MEMORYSANITIZER "-fsanitize=memory" |
| 34 |
CACHE STRING "Flags used by the linker during the creation of shared libraries during MEMORYSANITIZER builds.") |
| 35 |
set(CMAKE_EXEC_LINKER_FLAGS_MEMORYSANITIZER "-fsanitize=memory" |
| 36 |
CACHE STRING "Flags used by the linker during MEMORYSANITIZER builds.") |
| 37 |
|
| 38 |
# Activate with: -DCMAKE_BUILD_TYPE=UndefinedSanitizer |
| 39 |
set(CMAKE_C_FLAGS_UNDEFINEDSANITIZER "-g -O1 -fsanitize=undefined -fsanitize=null -fsanitize=alignment -fno-sanitize-recover=undefined,integer" |
| 40 |
CACHE STRING "Flags used by the C compiler during UNDEFINEDSANITIZER builds.") |
| 41 |
set(CMAKE_CXX_FLAGS_UNDEFINEDSANITIZER "-g -O1 -fsanitize=undefined -fsanitize=null -fsanitize=alignment -fno-sanitize-recover=undefined,integer" |
| 42 |
CACHE STRING "Flags used by the CXX compiler during UNDEFINEDSANITIZER builds.") |
| 43 |
set(CMAKE_SHARED_LINKER_FLAGS_UNDEFINEDSANITIZER "-fsanitize=undefined" |
| 44 |
CACHE STRING "Flags used by the linker during the creation of shared libraries during UNDEFINEDSANITIZER builds.") |
| 45 |
set(CMAKE_MODULE_LINKER_FLAGS_UNDEFINEDSANITIZER "-fsanitize=undefined" |
| 46 |
CACHE STRING "Flags used by the linker during the creation of shared libraries during UNDEFINEDSANITIZER builds.") |
| 47 |
set(CMAKE_EXEC_LINKER_FLAGS_UNDEFINEDSANITIZER "-fsanitize=undefined" |
| 48 |
CACHE STRING "Flags used by the linker during UNDEFINEDSANITIZER builds.") |
| 49 |
endif() |