cmake: Fix ENABLE_ASAN with clang.
Only -fsanitize=address is needed for asan to work with both gcc and clang. [170/196] Building CXX object CMakeFiles/vbamcore.dir/src/Util.cpp.o clang-9: warning: -lasan: 'linker' input unused [-Wunused-command-line-argument] [171/196] Linking CXX static library libvbamcore.a [172/196] Generating cmdtab.cpp, cmdhandlers.h, cmd-evtable.h [173/196] Generating wxvbam.xrs [174/196] Generating builtin-xrc.h samu: job failed: cd /tmp/visualboyadvance-m/build/src/wx && /tmp/visualboyadvance-m/build/bin2c wxvbam.xrs builtin-xrc.h builtin_xrs ==4845==Your application is linked against incompatible ASan runtimes. samu: subcommand failed
This commit is contained in:
parent
65c908141c
commit
2d783f5df8
|
@ -495,10 +495,10 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
|||
if(SANITIZER STREQUAL "on" OR SANITIZER STREQUAL "true")
|
||||
set(SANITIZER address)
|
||||
endif()
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} "-lasan")
|
||||
check_cxx_compiler_flag("-fsanitize=${SANITIZER} -lasan" ASAN_SUPPORT_FLAG)
|
||||
list(PREPEND CMAKE_REQUIRED_LIBRARIES -fsanitize=${SANITIZER})
|
||||
check_cxx_compiler_flag("-fsanitize=${SANITIZER}" ASAN_SUPPORT_FLAG)
|
||||
if(${ASAN_SUPPORT_FLAG})
|
||||
set(MY_C_DBG_FLAGS ${MY_C_DBG_FLAGS} -fsanitize=${SANITIZER} -lasan)
|
||||
list(PREPEND MY_C_DBG_FLAGS -fsanitize=${SANITIZER})
|
||||
else()
|
||||
message(FATAL_ERROR "asan not available to compiler.")
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue