From 61e374f3012c69b93520c33780a5f213ff22a76c Mon Sep 17 00:00:00 2001 From: Xiaoxi Wang Date: Wed, 30 Mar 2022 21:42:02 -0700 Subject: [PATCH] fix cmake bug when use gcc --- fdbmonitor/CMakeLists.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/fdbmonitor/CMakeLists.txt b/fdbmonitor/CMakeLists.txt index 2c36c7bad3..3787fb22f8 100644 --- a/fdbmonitor/CMakeLists.txt +++ b/fdbmonitor/CMakeLists.txt @@ -6,7 +6,7 @@ assert_no_version_h(fdbmonitor) if(UNIX AND NOT APPLE) target_link_libraries(fdbmonitor PRIVATE rt) endif() -# FIXME: This include directory is an ugly hack. We probably want to fix this +# FIXME: This include directory is an ugly hack. We probably want to fix this. # as soon as we get rid of the old build system target_link_libraries(fdbmonitor PUBLIC Threads::Threads) @@ -14,11 +14,17 @@ target_link_libraries(fdbmonitor PUBLIC Threads::Threads) # appears to change its behavior (it no longer seems to restart killed # processes). fdbmonitor is single-threaded anyway. get_target_property(fdbmonitor_options fdbmonitor COMPILE_OPTIONS) -list(REMOVE_ITEM fdbmonitor_options "-fsanitize=thread") -set_property(TARGET fdbmonitor PROPERTY COMPILE_OPTIONS ${fdbmonitor_options}) +if (NOT "${fdbmonitor_options}" STREQUAL "fdbmonitor_options-NOTFOUND") + list(REMOVE_ITEM fdbmonitor_options "-fsanitize=thread") + set_property(TARGET fdbmonitor PROPERTY COMPILE_OPTIONS ${fdbmonitor_options}) +endif () + get_target_property(fdbmonitor_options fdbmonitor LINK_OPTIONS) -list(REMOVE_ITEM fdbmonitor_options "-fsanitize=thread") -set_property(TARGET fdbmonitor PROPERTY LINK_OPTIONS ${fdbmonitor_options}) + +if (NOT "${fdbmonitor_options}" STREQUAL "fdbmonitor_options-NOTFOUND") + list(REMOVE_ITEM fdbmonitor_options "-fsanitize=thread") + set_property(TARGET fdbmonitor PROPERTY LINK_OPTIONS ${fdbmonitor_options}) +endif () if(GENERATE_DEBUG_PACKAGES) fdb_install(TARGETS fdbmonitor DESTINATION fdbmonitor COMPONENT server)