From a3b2e3efc8d91f46117719d4d4e5571758bc46ef Mon Sep 17 00:00:00 2001 From: John Jones Date: Fri, 16 Aug 2019 14:59:45 -0500 Subject: [PATCH 1/2] Reset flag after testing compiler --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bd9db30bf5..43f1dd40bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,9 @@ macro(FIND_CURL) endif (NOT WIN32 AND NOT APPLE AND CURL_STATICLIB) endmacro() +# Save the old value of CMAKE_REQUIRED_FLAGS +set( TEMP_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} ) + # Fortify source if (CMAKE_COMPILER_IS_GNUCXX) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") @@ -91,6 +94,8 @@ if (CMAKE_COMPILER_IS_GNUCXX) endif () endif () +set(CMAKE_REQUIRED_FLAGS ${TEMP_REQUIRED_FLAGS} ) + # check for Data relocation and Protection (RELRO) set(CMAKE_REQUIRED_FLAGS "-Wl,-zrelro,-znow") check_c_compiler_flag("" HAVE_RELROFULL) @@ -108,6 +113,8 @@ else() endif() endif() +set(CMAKE_REQUIRED_FLAGS ${TEMP_REQUIRED_FLAGS} ) + # position independent executetable (PIE) # position independent code (PIC) add_definitions (-fPIC) From 0f505d4b51c209d6b4f3b756e3d334a25ba931b8 Mon Sep 17 00:00:00 2001 From: John Jones Date: Tue, 20 Aug 2019 10:58:45 -0500 Subject: [PATCH 2/2] Removed unnecessary reset of flags --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 43f1dd40bc..337bd36ce7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,8 +94,6 @@ if (CMAKE_COMPILER_IS_GNUCXX) endif () endif () -set(CMAKE_REQUIRED_FLAGS ${TEMP_REQUIRED_FLAGS} ) - # check for Data relocation and Protection (RELRO) set(CMAKE_REQUIRED_FLAGS "-Wl,-zrelro,-znow") check_c_compiler_flag("" HAVE_RELROFULL)