cmake: don't check c++ compiler flags for asan when CXX is not enabled
This commit is contained in:
@@ -3054,10 +3054,12 @@ macro(check_add_debug_flag FLAG SUFFIX)
|
|||||||
string(APPEND CMAKE_C_FLAGS_DEBUG " ${FLAG}")
|
string(APPEND CMAKE_C_FLAGS_DEBUG " ${FLAG}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_CXX_COMPILER)
|
||||||
check_cxx_compiler_flag(${FLAG} HAS_CXX_${SUFFIX})
|
check_cxx_compiler_flag(${FLAG} HAS_CXX_${SUFFIX})
|
||||||
if(HAS_CXX_${SUFFIX})
|
if(HAS_CXX_${SUFFIX})
|
||||||
string(APPEND CMAKE_CXX_FLAGS_DEBUG " ${FLAG}")
|
string(APPEND CMAKE_CXX_FLAGS_DEBUG " ${FLAG}")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(asan_check_add_debug_flag ASAN_FLAG)
|
macro(asan_check_add_debug_flag ASAN_FLAG)
|
||||||
@@ -3075,18 +3077,20 @@ macro(asan_check_add_debug_flag2 ASAN_FLAG)
|
|||||||
|
|
||||||
cmake_push_check_state()
|
cmake_push_check_state()
|
||||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${FLAG} asan)
|
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})
|
if (HAS_C_FLAG_${ASAN_FLAG})
|
||||||
string(APPEND CMAKE_C_FLAGS_DEBUG " ${FLAG}")
|
string(APPEND CMAKE_C_FLAGS_DEBUG " ${FLAG}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_CXX_COMPILER)
|
||||||
|
check_cxx_compiler_flag (${FLAG} HAS_CXX_FLAG_${ASAN_FLAG})
|
||||||
if (HAS_CXX_${ASAN_FLAG})
|
if (HAS_CXX_${ASAN_FLAG})
|
||||||
string(APPEND CMAKE_CXX_FLAGS_DEBUG " ${FLAG}")
|
string(APPEND CMAKE_CXX_FLAGS_DEBUG " ${FLAG}")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
cmake_pop_check_state()
|
||||||
if(HAS_C_${ASAN_FLAG} OR HAS_CXX_${ASAN_FLAG})
|
if(HAS_C_${ASAN_FLAG} OR HAS_CXX_${ASAN_FLAG})
|
||||||
set(HAVE_ASAN ON)
|
set(HAVE_ASAN ON)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user