From 303178748595f487cffc7249c8dc9bd46432253b Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 24 Sep 2020 17:00:25 +0200 Subject: [PATCH] CMake: Fix sanitizer build when using Clang on Linux Apparently the combination of the --no-undefined linker flag together with ASAN when building on Linux with Clang does not work. Disable --no-undefined flag in such a scenario. Note that linux-clang mkspec doesn't add that flag at all, which is why asan builds work there. Change-Id: I6167c757ce4be5d2263311bc84e5fb445b0f7c2d Fixes: QTBUG-86879 Reviewed-by: Cristian Adam Reviewed-by: Joerg Bornemann --- cmake/QtFlagHandlingHelpers.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/QtFlagHandlingHelpers.cmake b/cmake/QtFlagHandlingHelpers.cmake index a71c083717..a2b498bf20 100644 --- a/cmake/QtFlagHandlingHelpers.cmake +++ b/cmake/QtFlagHandlingHelpers.cmake @@ -51,6 +51,9 @@ function(qt_internal_add_link_flags_no_undefined target) return() endif() if (GCC OR CLANG) + if(CLANG AND QT_FEATURE_sanitizer) + return() + endif() set(previous_CMAKE_REQUIRED_LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS}) set(CMAKE_REQUIRED_LINK_OPTIONS "-Wl,-undefined,error")