summaryrefslogtreecommitdiffstats
path: root/cmake/QtFeature.cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-02-26 10:39:47 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-03-04 16:31:13 +0100
commit1a30a828307ac1a27cb20e7b25fe9cb722497631 (patch)
tree0ec15af02be3fea69b76042d45132757aa22f6ac /cmake/QtFeature.cmake
parentfb2f42b6044fe4673e71f3d12082b53c9f3182cd (diff)
CMake: Fix stack-protector-strong test and feature
And in order to do this we must teach qt_config_compile_test a COMPILE_OPTIONS argument. Change-Id: I66fa45142b544e3a2fc599af1c1a4c69b442b318 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtFeature.cmake')
-rw-r--r--cmake/QtFeature.cmake7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake
index bb77ca6ffa..7b852b3c2e 100644
--- a/cmake/QtFeature.cmake
+++ b/cmake/QtFeature.cmake
@@ -625,7 +625,8 @@ function(qt_config_compile_test name)
return()
endif()
- cmake_parse_arguments(arg "" "LABEL;PROJECT_PATH;C_STANDARD;CXX_STANDARD" "LIBRARIES;CODE" ${ARGN})
+ cmake_parse_arguments(arg "" "LABEL;PROJECT_PATH;C_STANDARD;CXX_STANDARD"
+ "COMPILE_OPTIONS;LIBRARIES;CODE" ${ARGN})
if(arg_PROJECT_PATH)
message(STATUS "Performing Test ${arg_LABEL}")
@@ -664,6 +665,8 @@ function(qt_config_compile_test name)
set(CMAKE_CXX_STANDARD "${arg_CXX_STANDARD}")
endif()
+ set(CMAKE_REQUIRED_FLAGS ${arg_COMPILE_OPTIONS})
+
# For MSVC we need to explicitly pass -Zc:__cplusplus to get correct __cplusplus
# define values. According to common/msvc-version.conf the flag is supported starting
# with 1913.
@@ -671,7 +674,7 @@ function(qt_config_compile_test name)
# No support for the flag in upstream CMake as of 3.17.
# https://gitlab.kitware.com/cmake/cmake/issues/18837
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND MSVC_VERSION GREATER_EQUAL 1913)
- set(CMAKE_REQUIRED_FLAGS "-Zc:__cplusplus")
+ list(APPEND CMAKE_REQUIRED_FLAGS "-Zc:__cplusplus")
endif()
set(_save_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")