-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathtest-flags.cmake
35 lines (27 loc) · 1.18 KB
/
test-flags.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_DEBUG} -Werror -Wall -Wextra -Wpedantic -Wno-ambiguous-reversed-operator")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror -Wall -Wextra -Wpedantic -Wno-ambiguous-reversed-operator -g3 -O0")
endif()
if(MSVC_VERSION VERSION_GREATER_EQUAL 1920)
# Make sure __cplusplus is set correctly depending on std
string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus")
endif()
if("${HSM_CLANG_COVERAGE}")
set(CMAKE_CXX_FLAGS "-fprofile-instr-generate -fcoverage-mapping")
endif()
if("${HSM_GCC_COVERAGE}")
set(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
endif()
if("${HSM_ASAN}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
endif()
if("${HSM_UBSAN}")
set(CMAKE_CXX_FLAGS "-fsanitize=undefined -fno-omit-frame-pointer -fno-sanitize-recover -fsanitize=float-divide-by-zero")
endif()
if("${HSM_TIME_TRACE}")
set(CMAKE_CXX_FLAGS "-ftime-trace")
endif()
if("${HSM_TEMPLIGHT_PROFILER}")
set(CMAKE_CXX_FLAGS "-Xtemplight -profiler -Xtemplight -ignore-system")
endif()