diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fe8b5f96d..aabb3dca71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,7 @@ mark_as_advanced( EXIV2_TEAM_USE_SANITIZERS ) +option( BUILD_WITH_STACK_PROTECTOR "Build with stack protector" ON ) option( BUILD_WITH_CCACHE "Use ccache to speed up compilations" OFF ) option( BUILD_WITH_COVERAGE "Add compiler flags to generate coverage stats" OFF ) include(cmake/gcovr.cmake REQUIRED) diff --git a/cmake/compilerFlags.cmake b/cmake/compilerFlags.cmake index c8a85c5995..20f6ac53d1 100644 --- a/cmake/compilerFlags.cmake +++ b/cmake/compilerFlags.cmake @@ -44,7 +44,7 @@ if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN if(HAS_FCF_PROTECTION) add_compile_options(-fcf-protection) endif() - if(HAS_FSTACK_PROTECTOR_STRONG) + if(BUILD_WITH_STACK_PROTECTOR AND HAS_FSTACK_PROTECTOR_STRONG) add_compile_options(-fstack-protector-strong) endif() endif()