Skip to content

Commit 9106e8d

Browse files
authored
Add CMake option to toggle stack protection #286 from chrisdalke/master
Add CMake option to toggle stack protection
2 parents f757b64 + 1aa8286 commit 9106e8d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ else (MSVC)
4949
set(CPPLINT_ARG_OUTPUT "--output=eclipse")
5050
set(CPPCHECK_ARG_TEMPLATE "--template=gcc")
5151
# Useful compile flags and extra warnings
52-
add_compile_options(-fstack-protector)
52+
# Stack protection is not supported on MinGW-W64 on Windows, allow this flag to be turned off.
53+
option(SQLITECPP_USE_STACK_PROTECTION "USE Stack Protection hardening." ON)
54+
if (SQLITECPP_USE_STACK_PROTECTION)
55+
message (STATUS "Using Stack Protection hardening")
56+
add_compile_options(-fstack-protector)
57+
endif()
5358
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wswitch-enum -Wshadow -Wno-long-long") # C++ only, don't bother with sqlite3
5459
if (CMAKE_COMPILER_IS_GNUCXX)
5560
# GCC flags

0 commit comments

Comments
 (0)