Add CMake option to toggle stack protection #286 from chrisdalke/master

Add CMake option to toggle stack protection
This commit is contained in:
Sébastien Rombauts 2020-07-12 09:28:17 +02:00 committed by GitHub
commit 9106e8da0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,7 +49,12 @@ else (MSVC)
set(CPPLINT_ARG_OUTPUT "--output=eclipse")
set(CPPCHECK_ARG_TEMPLATE "--template=gcc")
# Useful compile flags and extra warnings
# Stack protection is not supported on MinGW-W64 on Windows, allow this flag to be turned off.
option(SQLITECPP_USE_STACK_PROTECTION "USE Stack Protection hardening." ON)
if (SQLITECPP_USE_STACK_PROTECTION)
message (STATUS "Using Stack Protection hardening")
add_compile_options(-fstack-protector)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wswitch-enum -Wshadow -Wno-long-long") # C++ only, don't bother with sqlite3
if (CMAKE_COMPILER_IS_GNUCXX)
# GCC flags