From 21a80a795f696582624d7dba66faf795f7d11b74 Mon Sep 17 00:00:00 2001 From: user Date: Sun, 26 Dec 2021 07:20:36 +0300 Subject: [PATCH] Adjust stack smashing protection options --- CMakeLists.txt | 12 +++++++++++- src/CMakeLists.txt | 11 ++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6118dd4..7dfd371 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,7 @@ if (NOT MSVC) if (NOT WIN32) set(FPIC "-fPIC") endif() -set (CMAKE_C_FLAGS "-flto -O3 ${FPIC} -Wno-deprecated -fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2") +set (CMAKE_C_FLAGS "-flto -O3 ${FPIC} -Wno-deprecated") set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -fexceptions -frtti") else() set(CMAKE_C_FLAGS "/O2") @@ -258,10 +258,20 @@ execute_process ( list(APPEND ALL_DEFINITIONS HAVE_BUILD_INFO) add_executable(novacoin-qt ${ALL_SOURCES}) + +if (NOT MSVC) +list(APPEND ALL_LIBRARIES ssp) +list(APPEND ALL_DEFINITIONS _FORTIFY_SOURCE=2) +if (WIN32) +list(APPEND ALL_LIBRARIES mingw32) +endif() +endif() + target_include_directories(novacoin-qt PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src/qt ${CMAKE_CURRENT_SOURCE_DIR}/src/json ${BerkeleyDB_INC} ${CMAKE_CURRENT_SOURCE_DIR}/src/additional/leveldb/helpers ${CMAKE_CURRENT_SOURCE_DIR}/src/additional/sse2neon ${CMAKE_CURRENT_SOURCE_DIR}/src/additional/libqrencode ${Boost_INCLUDE_DIRS}) target_link_libraries(novacoin-qt ${ALL_LIBRARIES}) target_compile_features(novacoin-qt PUBLIC cxx_std_17) + set_property(TARGET novacoin-qt PROPERTY CXX_STANDARD 17) set_property(TARGET novacoin-qt PROPERTY CXX_STANDARD_REQUIRED TRUE) set_property(TARGET novacoin-qt PROPERTY COMPILE_DEFINITIONS ${ALL_DEFINITIONS}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b49de36..fa2e019 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -29,7 +29,7 @@ if (NOT MSVC) if (NOT WIN32) set(FPIC "-fPIC") endif() -set (CMAKE_C_FLAGS "-flto -O3 ${FPIC} -Wno-deprecated -fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2") +set (CMAKE_C_FLAGS "-flto -O3 ${FPIC} -Wno-deprecated") set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -fexceptions -frtti") else() set(CMAKE_C_FLAGS "/O2") @@ -167,6 +167,15 @@ execute_process ( list(APPEND ALL_DEFINITIONS HAVE_BUILD_INFO USE_IPV6) add_executable(novacoind ${ALL_SOURCES}) + +if (NOT MSVC) +list(APPEND ALL_LIBRARIES ssp) +list(APPEND ALL_DEFINITIONS _FORTIFY_SOURCE=2) +if (WIN32) +list(APPEND ALL_LIBRARIES mingw32) +endif() +endif() + target_include_directories(novacoind PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/json ${BerkeleyDB_INC} ${CMAKE_CURRENT_SOURCE_DIR}/additional/sse2neon ${CMAKE_CURRENT_SOURCE_DIR}/additional/leveldb/helpers ${Boost_INCLUDE_DIRS}) target_link_libraries(novacoind ${ALL_LIBRARIES}) -- 1.7.1