From 8c906f5228464951aa55379df537f58a13a1b598 Mon Sep 17 00:00:00 2001 From: jcorporation Date: Mon, 22 Apr 2024 16:28:16 +0200 Subject: [PATCH] Fix: do not add _FORTIFY_SOURCE if already defined --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d2c32169..81f84ff86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -300,7 +300,9 @@ if(CMAKE_BUILD_TYPE MATCHES "(Debug|Release|RelWithDebInfo|MinSizeRel)") if(NOT MYMPD_ENABLE_ASAN AND NOT MYMPD_ENABLE_UBSAN) # incompatible with address sanitizers - add_compile_options("-D_FORTIFY_SOURCE=2") + if(NOT CMAKE_C_FLAGS MATCHES "_FORTIFY_SOURCE") + add_compile_options("-D_FORTIFY_SOURCE=2") + endif() endif() else() # if CMAKE_BUILD_TYPE is neither Release nor Debug,