aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-03-29 20:13:23 +0200
committerAlbert Astals Cid <aacid@kde.org>2016-03-29 20:13:23 +0200
commitc6495e75fc6114314512427bce5e202c1ad648c6 (patch)
tree7d2ca45ff71e3bcd91c98b8e74dcb5a818130b13
parent928e79cf5d51a3c78d388b7eb972b3dae1ebbb68 (diff)
downloadextra-cmake-modules-c6495e75fc6114314512427bce5e202c1ad648c6.tar.gz
extra-cmake-modules-c6495e75fc6114314512427bce5e202c1ad648c6.tar.bz2
ECMEnableSanitizers: avoid linking runtime for Clangv5.21.0-rc2v5.21.0-rc1v5.21.0
Clang automatically adds its runtime library (librt) when given the -fsanitize options. Do not force the GCC runtime libraries (asan, tsan, lsan), this results in "Your application is linked against incompatible ASan runtimes." errors when using the library in an executable built using Clang. Acked by Mathieu Tarral REVIEW: 127513
-rw-r--r--modules/ECMEnableSanitizers.cmake4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/ECMEnableSanitizers.cmake b/modules/ECMEnableSanitizers.cmake
index e64599b6..aa7092df 100644
--- a/modules/ECMEnableSanitizers.cmake
+++ b/modules/ECMEnableSanitizers.cmake
@@ -139,7 +139,9 @@ foreach ( CUR_SANITIZER ${ECM_ENABLE_SANITIZERS} )
# check option and enable appropriate flags
enable_sanitizer_flags ( ${CUR_SANITIZER} )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${XSAN_COMPILE_FLAGS}" )
- link_libraries(${XSAN_LINKER_FLAGS})
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+ link_libraries(${XSAN_LINKER_FLAGS})
+ endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
string(REPLACE "-Wl,--no-undefined" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
string(REPLACE "-Wl,--no-undefined" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")