diff --git a/CMakeLists.txt b/CMakeLists.txt index 82ab4b3f7..75cb5428d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,7 +73,10 @@ endif() set(NO_DEPRECATED "") set(OPTIMIZE "") - set(OS_CXX_FLAGS "${OS_CXX_FLAGS} -D_GLIBCXX_USE_NANOSLEEP -pthread -O -Wall -Wextra -Wformat -Wformat-security -Wconversion -fexceptions -fstrict-aliasing -fstack-protector-strong -fasynchronous-unwind-tables -fno-omit-frame-pointer -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Wpedantic -Werror -fPIE") + if(NOT DEFINED _FORTIFY_SOURCE) + set(_FORTIFY_SOURCE 2) + endif() + set(OS_CXX_FLAGS "${OS_CXX_FLAGS} -D_GLIBCXX_USE_NANOSLEEP -pthread -O -Wall -Wextra -Wformat -Wformat-security -Wconversion -fexceptions -fstrict-aliasing -fstack-protector-strong -fasynchronous-unwind-tables -fno-omit-frame-pointer -D_FORTIFY_SOURCE=${_FORTIFY_SOURCE} -Wformat -Wformat-security -Wpedantic -Werror -fPIE") # force all use of std::mutex and std::recursive_mutex to use runtime init # instead of static initialization so mutexes can be hooked to enable PI as needed