Флаги для включения проверки памяти и потоков
This commit is contained in:
parent
8122c0f0a8
commit
717c01c7dd
@ -34,6 +34,7 @@ include(CMLibCodeAnalysisPvsStudio)
|
|||||||
include(CMLibCodeAnalysisClangAnalyze)
|
include(CMLibCodeAnalysisClangAnalyze)
|
||||||
include(CMLibCodeAnalysisClangTidy)
|
include(CMLibCodeAnalysisClangTidy)
|
||||||
include(CMLibCodeAnalysisClazy)
|
include(CMLibCodeAnalysisClazy)
|
||||||
|
include(CMLibSanitizers)
|
||||||
include(cotire)
|
include(cotire)
|
||||||
|
|
||||||
include(CMLibBreathe)
|
include(CMLibBreathe)
|
||||||
|
25
CMLibSanitizers.cmake
Normal file
25
CMLibSanitizers.cmake
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
if(CMAKE_CXX_COMPILER_IS_CLANG OR CMAKE_CXX_COMPILER_IS_GCC)
|
||||||
|
|
||||||
|
if(SANITIZE_THREAD AND SANITIZE_ADDRESS)
|
||||||
|
message(FATAL_ERROR "AddressSanitizer is not compatible with ThreadSanitizer.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(SANITIZE_ADDRESS)
|
||||||
|
message(STATUS "AddressSanitizer enabled")
|
||||||
|
set(SANITIZER_FLAGS "-fsanitize=address,undefined")
|
||||||
|
check_enable_cxx_flag(-fno-sanitize=signed-integer-overflow)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(SANITIZE_THREAD)
|
||||||
|
message(STATUS "ThreadSanitizer enabled")
|
||||||
|
set(SANITIZER_FLAGS "-fsanitize=thread")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(SANITIZE_THREAD OR SANITIZE_ADDRESS)
|
||||||
|
check_enable_cxx_flag(${SANITIZER_FLAGS})
|
||||||
|
check_enable_cxx_flag("-fno-sanitize-recover=all")
|
||||||
|
check_enable_cxx_flag("-fno-omit-frame-pointer")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SANITIZER_FLAGS} -fuse-ld=gold")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user