diff --git a/CMakeLists.txt b/CMakeLists.txt index 994f58668..3785dd223 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,7 +113,10 @@ endif() # global compiler flags if(NOT WIN32) # MSYS2 needs -lssp and -fstack-protector for _FORTIFY_SOURCE +# macOS with ASAN can't handle _FORTIFY_SOURCE != 1 +if(NOT ${USE_ASAN}) add_compile_definitions(_FORTIFY_SOURCE=2) +endif() add_compile_options(-Wformat -Werror=format-security) endif() if(MSVC)