From: Kefu Chai Date: Sun, 17 Mar 2024 13:36:23 +0000 (+0800) Subject: cmake: do not override CMAKE_EXE_LINKER_FLAGS X-Git-Tag: v20.0.0~2279^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0dc61a4be335073e9a3047cf52ec3d12e4244f4d;p=ceph.git cmake: do not override CMAKE_EXE_LINKER_FLAGS instead of overriding CMAKE_EXE_LINKER_FLAGS, let's append to it. so that the existing `CMAKE_EXE_LINKER_FLAGS` is not overriden. this should enable us to build with Clang and with sanitizer(s) enabled. Signed-off-by: Kefu Chai --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 90c9c48e06e1..149bdc45562f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -143,7 +143,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12) # require >= clang-12 message(FATAL_ERROR "C++20 support requires a minimum Clang version of 12.") endif() - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_EXPORTS_C_FLAG}") + string(APPEND CMAKE_EXE_LINKER_FLAGS " ${CMAKE_EXE_EXPORTS_C_FLAG}") string(APPEND CMAKE_LINKER_FLAGS " -rdynamic -export-dynamic ${CMAKE_EXE_EXPORTS_C_FLAG}") string(PREPEND CMAKE_CXX_FLAGS_DEBUG "-g ") add_compile_options($<$:-Wno-inconsistent-missing-override>)