mirror of https://github.com/libsdl-org/SDL
cmake: don't check c++ compiler flags for asan when CXX is not enabled
This commit is contained in:
parent
85a2a201b1
commit
fd2b9c0602
|
@ -3054,9 +3054,11 @@ macro(check_add_debug_flag FLAG SUFFIX)
|
|||
string(APPEND CMAKE_C_FLAGS_DEBUG " ${FLAG}")
|
||||
endif()
|
||||
|
||||
check_cxx_compiler_flag(${FLAG} HAS_CXX_${SUFFIX})
|
||||
if(HAS_CXX_${SUFFIX})
|
||||
string(APPEND CMAKE_CXX_FLAGS_DEBUG " ${FLAG}")
|
||||
if(CMAKE_CXX_COMPILER)
|
||||
check_cxx_compiler_flag(${FLAG} HAS_CXX_${SUFFIX})
|
||||
if(HAS_CXX_${SUFFIX})
|
||||
string(APPEND CMAKE_CXX_FLAGS_DEBUG " ${FLAG}")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
@ -3075,18 +3077,20 @@ macro(asan_check_add_debug_flag2 ASAN_FLAG)
|
|||
|
||||
cmake_push_check_state()
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${FLAG} asan)
|
||||
check_c_compiler_flag (${FLAG} HAS_C_FLAG_${ASAN_FLAG})
|
||||
check_cxx_compiler_flag (${FLAG} HAS_CXX_FLAG_${ASAN_FLAG})
|
||||
cmake_pop_check_state()
|
||||
|
||||
check_c_compiler_flag (${FLAG} HAS_C_FLAG_${ASAN_FLAG})
|
||||
if (HAS_C_FLAG_${ASAN_FLAG})
|
||||
string(APPEND CMAKE_C_FLAGS_DEBUG " ${FLAG}")
|
||||
endif()
|
||||
|
||||
if (HAS_CXX_${ASAN_FLAG})
|
||||
string(APPEND CMAKE_CXX_FLAGS_DEBUG " ${FLAG}")
|
||||
if(CMAKE_CXX_COMPILER)
|
||||
check_cxx_compiler_flag (${FLAG} HAS_CXX_FLAG_${ASAN_FLAG})
|
||||
if (HAS_CXX_${ASAN_FLAG})
|
||||
string(APPEND CMAKE_CXX_FLAGS_DEBUG " ${FLAG}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
cmake_pop_check_state()
|
||||
if(HAS_C_${ASAN_FLAG} OR HAS_CXX_${ASAN_FLAG})
|
||||
set(HAVE_ASAN ON)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue