summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-08-19 16:49:13 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-08-20 17:07:46 +0200
commitdf28355981e14c90dc0f214ceeba40be77401fb4 (patch)
treea2eb561965f1d77a68310b1635a910f71347ffa6 /cmake
parent45d3c75ab6f29e88637363869a3b0be8df731dec (diff)
CMake: Support configure tests of type 'compilerSupportsFlag'
Task-number: QTBUG-86155 Change-Id: Iaa5c48b6508870a0f6afdf9df66cd2e634fe19b3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtFeature.cmake11
-rw-r--r--cmake/QtProcessConfigureArgs.cmake1
2 files changed, 12 insertions, 0 deletions
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake
index f7765cea94..5002a53352 100644
--- a/cmake/QtFeature.cmake
+++ b/cmake/QtFeature.cmake
@@ -1,4 +1,5 @@
include(QtFeatureCommon)
+include(CheckCXXCompilerFlag)
function(qt_feature_module_begin)
qt_parse_all_arguments(arg "qt_feature_module_begin"
@@ -870,6 +871,16 @@ function(qt_config_compile_test_machine_tuple label)
set(TEST_machine_tuple "${output}" CACHE INTERNAL "${label}")
endfunction()
+function(qt_config_compiler_supports_flag_test name)
+ if(DEFINED "TEST_${name}")
+ return()
+ endif()
+
+ cmake_parse_arguments(arg "" "LABEL;FLAG" "" ${ARGN})
+ check_cxx_compiler_flag("${arg_FLAG}" TEST_${name})
+ set(TEST_${name} "${TEST_${name}}" CACHE INTERNAL "${label}")
+endfunction()
+
function(qt_make_features_available target)
if(NOT "${target}" MATCHES "^${QT_CMAKE_EXPORT_NAMESPACE}::[a-zA-Z0-9_-]*$")
message(FATAL_ERROR "${target} does not match ${QT_CMAKE_EXPORT_NAMESPACE}::[a-zA-Z0-9_-]*. INVALID NAME.")
diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake
index 743e8e3eb7..9a6370cca2 100644
--- a/cmake/QtProcessConfigureArgs.cmake
+++ b/cmake/QtProcessConfigureArgs.cmake
@@ -96,6 +96,7 @@ defstub(qt_add_qmake_lib_dependency)
defstub(qt_config_compile_test)
defstub(qt_config_compile_test_machine_tuple)
defstub(qt_config_compile_test_x86simd)
+defstub(qt_config_compiler_supports_flag_test)
defstub(qt_configure_add_report_entry)
defstub(qt_configure_add_summary_build_mode)
defstub(qt_configure_add_summary_build_parts)