You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CMakeLists.txt
+5-17
Original file line number
Diff line number
Diff line change
@@ -68,6 +68,11 @@ cpr_option(CPR_BUILD_TESTS_SSL "Set to ON to build cpr ssl tests" ${CPR_BUILD_TE
68
68
cpr_option(CPR_BUILD_TESTS_PROXY "Set to ON to build proxy tests. They fail in case there is no valid proxy server available in proxy_tests.cpp"OFF)
69
69
cpr_option(CPR_SKIP_CA_BUNDLE_SEARCH "Skip searching for Certificate Authority certs. Turn ON systems like iOS where file access is restricted and prevents https from working."OFF)
70
70
cpr_option(CPR_USE_BOOST_FILESYSTEM "Set to ON to use the Boost.Filesystem library on OSX."OFF)
71
+
cpr_option(CPR_DEBUG_SANITIZER_FLAG_THREAD "Enables the ThreadSanitizer for debug builds."OFF)
72
+
cpr_option(CPR_DEBUG_SANITIZER_FLAG_ADDR "Enables the AddressSanitizer for debug builds."OFF)
73
+
cpr_option(CPR_DEBUG_SANITIZER_FLAG_LEAK "Enables the LeakSanitizer for debug builds."OFF)
74
+
cpr_option(CPR_DEBUG_SANITIZER_FLAG_UB "Enables the UndefinedBehaviorSanitizer for debug builds."OFF)
75
+
cpr_option(CPR_DEBUG_SANITIZER_FLAG_ALL "Enables all sanitizers for debug builds except the ThreadSanitizer since it is incompatible with the other sanitizers."OFF)
# Do not add Thread sanitizer to all sanitizer because it is incompatible with other sanitizer
18
-
endif()
19
-
set(CMAKE_C_FLAGS_THREADSAN "${CMAKE_C_FLAGS_DEBUG}${THREAD_SAN_FLAGS}"CACHEINTERNAL"Flags used by the C compiler during thread sanitizer builds." FORCE)
20
-
set(CMAKE_CXX_FLAGS_THREADSAN "${CMAKE_CXX_FLAGS_DEBUG}${THREAD_SAN_FLAGS}"CACHEINTERNAL"Flags used by the C++ compiler during thread sanitizer builds." FORCE)
21
-
set(CMAKE_SHARED_LINKER_FLAGS_THREADSAN "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}"CACHEINTERNAL"Flags used for the linker during thread sanitizer builds" FORCE)
14
+
# Do not add the ThreadSanitizer for builds with all sanitizers enabled because it is incompatible with other sanitizers.
set(CMAKE_C_FLAGS_ADDRSAN "${CMAKE_C_FLAGS_DEBUG}${ADDR_SAN_FLAGS} -fno-omit-frame-pointer -fno-optimize-sibling-calls"CACHEINTERNAL"Flags used by the C compiler during address sanitizer builds." FORCE)
34
-
set(CMAKE_CXX_FLAGS_ADDRSAN "${CMAKE_CXX_FLAGS_DEBUG}${ADDR_SAN_FLAGS} -fno-omit-frame-pointer -fno-optimize-sibling-calls"CACHEINTERNAL"Flags used by the C++ compiler during address sanitizer builds." FORCE)
35
-
set(CMAKE_SHARED_LINKER_FLAGS_ADDRSAN "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}"CACHEINTERNAL"Flags used for the linker during address sanitizer builds" FORCE)
set(CMAKE_C_FLAGS_LEAKSAN "${CMAKE_C_FLAGS_DEBUG}${LEAK_SAN_FLAGS} -fno-omit-frame-pointer"CACHEINTERNAL"Flags used by the C compiler during leak sanitizer builds." FORCE)
45
-
set(CMAKE_CXX_FLAGS_LEAKSAN "${CMAKE_CXX_FLAGS_DEBUG}${LEAK_SAN_FLAGS} -fno-omit-frame-pointer"CACHEINTERNAL"Flags used by the C++ compiler during leak sanitizer builds." FORCE)
46
-
set(CMAKE_SHARED_LINKER_FLAGS_LEAKSAN "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}"CACHEINTERNAL"Flags used for the linker during leak sanitizer builds" FORCE)
set(CMAKE_C_FLAGS_UDEFSAN "${CMAKE_C_FLAGS_DEBUG}${UDEF_SAN_FLAGS}"CACHEINTERNAL"Flags used by the C compiler during undefined behaviour sanitizer builds." FORCE)
56
-
set(CMAKE_CXX_FLAGS_UDEFSAN "${CMAKE_CXX_FLAGS_DEBUG}${UDEF_SAN_FLAGS}"CACHEINTERNAL"Flags used by the C++ compiler during undefined behaviour sanitizer builds." FORCE)
57
-
set(CMAKE_SHARED_LINKER_FLAGS_UDEFSAN "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}"CACHEINTERNAL"Flags used for the linker during undefined behaviour sanitizer builds" FORCE)
set(CMAKE_C_FLAGS_ALLSAN "${CMAKE_C_FLAGS_DEBUG}${ALL_SAN_FLAGS} -fno-omit-frame-pointer -fno-optimize-sibling-calls"CACHEINTERNAL"Flags used by the C compiler during most possible sanitizer builds." FORCE)
71
-
set(CMAKE_CXX_FLAGS_ALLSAN "${CMAKE_CXX_FLAGS_DEBUG}${ALL_SAN_FLAGS} -fno-omit-frame-pointer -fno-optimize-sibling-calls"CACHEINTERNAL"Flags used by the C++ compiler during most possible sanitizer builds." FORCE)
72
-
set(CMAKE_SHARED_LINKER_FLAGS_ALLSAN "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}"CACHEINTERNAL"Flags used for the linker during most possible sanitizer builds" FORCE)
48
+
if(CPR_DEBUG_SANITIZER_FLAG_THREAD AND THREAD_SANITIZER_AVAILABLE)
49
+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}${THREAD_SAN_FLAGS}"CACHEINTERNAL"Flags used by the C compiler during thread sanitizer builds." FORCE)
50
+
set(CMAKE_CXX_FLAGS_DEBUG"${CMAKE_CXX_FLAGS_DEBUG}${THREAD_SAN_FLAGS}"CACHEINTERNAL"Flags used by the C++ compiler during thread sanitizer builds." FORCE)
51
+
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}"CACHEINTERNAL"Flags used for the linker during thread sanitizer builds" FORCE)
52
+
elseif(CPR_DEBUG_SANITIZER_FLAG_ADDR AND ADDRESS_SANITIZER_AVAILABLE)
53
+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}${ADDR_SAN_FLAGS} -fno-omit-frame-pointer -fno-optimize-sibling-calls"CACHEINTERNAL"Flags used by the C compiler during address sanitizer builds." FORCE)
54
+
set(CMAKE_CXX_FLAGS_DEBUG"${CMAKE_CXX_FLAGS_DEBUG}${ADDR_SAN_FLAGS} -fno-omit-frame-pointer -fno-optimize-sibling-calls"CACHEINTERNAL"Flags used by the C++ compiler during address sanitizer builds." FORCE)
55
+
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}"CACHEINTERNAL"Flags used for the linker during address sanitizer builds" FORCE)
56
+
elseif(CPR_DEBUG_SANITIZER_FLAG_LEAK AND LEAK_SANITIZER_AVAILABLE)
57
+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}${LEAK_SAN_FLAGS} -fno-omit-frame-pointer"CACHEINTERNAL"Flags used by the C compiler during leak sanitizer builds." FORCE)
58
+
set(CMAKE_CXX_FLAGS_DEBUG"${CMAKE_CXX_FLAGS_DEBUG}${LEAK_SAN_FLAGS} -fno-omit-frame-pointer"CACHEINTERNAL"Flags used by the C++ compiler during leak sanitizer builds." FORCE)
59
+
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}"CACHEINTERNAL"Flags used for the linker during leak sanitizer builds" FORCE)
60
+
elseif(CPR_DEBUG_SANITIZER_FLAG_UB AND UNDEFINED_BEHAVIOUR_SANITIZER_AVAILABLE)
61
+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}${UDEF_SAN_FLAGS}"CACHEINTERNAL"Flags used by the C compiler during undefined behaviour sanitizer builds." FORCE)
62
+
set(CMAKE_CXX_FLAGS_DEBUG"${CMAKE_CXX_FLAGS_DEBUG}${UDEF_SAN_FLAGS}"CACHEINTERNAL"Flags used by the C++ compiler during undefined behaviour sanitizer builds." FORCE)
63
+
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}"CACHEINTERNAL"Flags used for the linker during undefined behaviour sanitizer builds" FORCE)
64
+
elseif(CPR_DEBUG_SANITIZER_FLAG_ALL AND ALL_SANITIZERS_AVAILABLE)
65
+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}${ALL_SAN_FLAGS} -fno-omit-frame-pointer -fno-optimize-sibling-calls"CACHEINTERNAL"Flags used by the C compiler during most possible sanitizer builds." FORCE)
66
+
set(CMAKE_CXX_FLAGS_DEBUG"${CMAKE_CXX_FLAGS_DEBUG}${ALL_SAN_FLAGS} -fno-omit-frame-pointer -fno-optimize-sibling-calls"CACHEINTERNAL"Flags used by the C++ compiler during most possible sanitizer builds." FORCE)
67
+
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}"CACHEINTERNAL"Flags used for the linker during most possible sanitizer builds" FORCE)
0 commit comments