mirror of https://github.com/libsdl-org/SDL
cmake: don't check c++ compiler flags for asan when CXX is not enabled
Backport of fd2b9c0602
to SDL2
This commit is contained in:
parent
c43b976e5b
commit
a4a8a29075
|
@ -3210,9 +3210,11 @@ macro(check_add_debug_flag FLAG SUFFIX)
|
|||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FLAG}")
|
||||
endif()
|
||||
|
||||
check_cxx_compiler_flag(${FLAG} HAS_CXX_${SUFFIX})
|
||||
if (HAS_CXX_${SUFFIX})
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAG}")
|
||||
if(CMAKE_CXX_COMPILER)
|
||||
check_cxx_compiler_flag(${FLAG} HAS_CXX_${SUFFIX})
|
||||
if (HAS_CXX_${SUFFIX})
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAG}")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
@ -3231,18 +3233,20 @@ macro(asan_check_add_debug_flag2 ASAN_FLAG)
|
|||
|
||||
set (STORED_REQLIBS ${CMAKE_REQUIRED_LIBRARIES})
|
||||
set (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})
|
||||
set (CMAKE_REQUIRED_LIBRARIES ${STORED_REQLIBS})
|
||||
|
||||
check_c_compiler_flag (${FLAG} HAS_C_FLAG_${ASAN_FLAG})
|
||||
if (HAS_C_FLAG_${ASAN_FLAG})
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FLAG}")
|
||||
endif()
|
||||
|
||||
if (HAS_CXX_${ASAN_FLAG})
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAG}")
|
||||
if(CMAKE_CXX_COMPILER)
|
||||
check_cxx_compiler_flag (${FLAG} HAS_CXX_FLAG_${ASAN_FLAG})
|
||||
if (HAS_CXX_${ASAN_FLAG})
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAG}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (CMAKE_REQUIRED_LIBRARIES ${STORED_REQLIBS})
|
||||
if(HAS_C_${ASAN_FLAG} OR HAS_CXX_${ASAN_FLAG})
|
||||
set(HAVE_ASAN ON)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue