Adding checks to see if any ASAN flags are set, if so then we set(HAVE_ASAN ON) so the infomartion output will properly list ASAN as on.

This commit is contained in:
Kyle Schaefer 2021-04-11 15:10:28 -07:00 committed by Sam Lantinga
parent 70bd205bb1
commit dbedaeceb3

View File

@ -2316,6 +2316,9 @@ endmacro()
macro(asan_check_add_debug_flag ASAN_FLAG) macro(asan_check_add_debug_flag ASAN_FLAG)
check_add_debug_flag("-fsanitize=${ASAN_FLAG}" "${ASAN_FLAG}") check_add_debug_flag("-fsanitize=${ASAN_FLAG}" "${ASAN_FLAG}")
if(HAS_C_${ASAN_FLAG} OR HAS_CXX_${ASAN_FLAG})
set(HAVE_ASAN ON)
endif()
endmacro() endmacro()
macro(asan_check_add_debug_flag2 ASAN_FLAG) macro(asan_check_add_debug_flag2 ASAN_FLAG)
@ -2337,6 +2340,10 @@ macro(asan_check_add_debug_flag2 ASAN_FLAG)
if (HAS_CXX_${ASAN_FLAG}) if (HAS_CXX_${ASAN_FLAG})
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAG}") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAG}")
endif() endif()
if(HAS_C_${ASAN_FLAG} OR HAS_CXX_${ASAN_FLAG})
set(HAVE_ASAN ON)
endif()
endmacro() endmacro()
# enable AddressSanitizer if supported # enable AddressSanitizer if supported