mirror of https://github.com/encounter/SDL.git
add '-shared-libasan' to debug flags (bug #5533)
This commit is contained in:
parent
dc45a228b9
commit
066960c207
|
@ -2312,20 +2312,22 @@ if(SDL_STATIC)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
macro(asan_check_add_debug_flag ASAN_FLAG)
|
||||
set(FLAG "-fsanitize=${ASAN_FLAG}")
|
||||
|
||||
check_c_compiler_flag(${FLAG} HAS_C_FLAG_${ASAN_FLAG})
|
||||
if (HAS_C_FLAG_${ASAN_FLAG})
|
||||
macro(check_add_debug_flag FLAG SUFFIX)
|
||||
check_c_compiler_flag(${FLAG} HAS_C_FLAG_${SUFFIX})
|
||||
if (HAS_C_FLAG_${SUFFIX})
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FLAG}")
|
||||
endif()
|
||||
|
||||
check_cxx_compiler_flag("${FLAG}" HAS_CXX_${ASAN_FLAG})
|
||||
if (HAS_CXX_${ASAN_FLAG})
|
||||
check_cxx_compiler_flag(${FLAG} HAS_CXX_${SUFFIX})
|
||||
if (HAS_CXX_${SUFFIX})
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAG}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(asan_check_add_debug_flag ASAN_FLAG)
|
||||
check_add_debug_flag("-fsanitize=${ASAN_FLAG}" "${ASAN_FLAG}")
|
||||
endmacro()
|
||||
|
||||
macro(asan_check_add_debug_flag2 ASAN_FLAG)
|
||||
# for some sanitize flags we have to manipulate the CMAKE_REQUIRED_LIBRARIES:
|
||||
# http://cmake.3232098.n2.nabble.com/CHECK-CXX-COMPILER-FLAG-doesn-t-give-correct-result-for-fsanitize-address-tp7600216p7600217.html
|
||||
|
@ -2348,6 +2350,7 @@ macro(asan_check_add_debug_flag2 ASAN_FLAG)
|
|||
endmacro()
|
||||
|
||||
# enable AddressSanitizer if supported
|
||||
check_add_debug_flag("-shared-libasan" "shared_libasan")
|
||||
asan_check_add_debug_flag2("address")
|
||||
asan_check_add_debug_flag("bool")
|
||||
asan_check_add_debug_flag("bounds")
|
||||
|
|
Loading…
Reference in New Issue