summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-05-27 12:32:06 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2021-06-01 02:49:41 +0200
commit42eb1e4aa63b935a25257498c755530d8ecda6dd (patch)
tree705d96ce1e70e0266083e6cd3e3e2cc25f84ada7 /cmake
parent0f38259cb3aee5cce5a2af99af3f69712c9f1123 (diff)
CMake: Allow printing config summary even if module is not built
In the future it might be useful to print the config summary entries of a Qt module configure.cmake file even if the associated module is not built and thus qt_feature_module_begin is not called. The repo src/CMakeLists.txt could then use a combination of qt_feature_evaluate_features and a conditional qt_feature_record_summary_entries to ensure the that summary entries are still shown. Change-Id: I124efc82163ddae48d9e72c70a677ec4c6588fac Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtFeature.cmake18
-rw-r--r--cmake/QtFindPackageHelpers.cmake6
2 files changed, 23 insertions, 1 deletions
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake
index 7f4a9d8b52..5603051342 100644
--- a/cmake/QtFeature.cmake
+++ b/cmake/QtFeature.cmake
@@ -522,6 +522,17 @@ function(qt_feature_evaluate_features list_of_paths)
qt_feature_module_end(ONLY_EVALUATE_FEATURES)
endfunction()
+function(qt_feature_record_summary_entries list_of_paths)
+ # Clean up any stale state just in case.
+ qt_feature_unset_state_vars()
+
+ set(__QtFeature_only_record_summary_entries TRUE)
+ foreach(path ${list_of_paths})
+ include("${path}")
+ endforeach()
+ qt_feature_unset_state_vars()
+endfunction()
+
function(qt_feature_module_end)
set(flags ONLY_EVALUATE_FEATURES)
set(options OUT_VAR_PREFIX)
@@ -660,6 +671,10 @@ function(qt_feature_module_end)
qt_feature_copy_global_config_features_to_core(${target})
endif()
+ qt_feature_unset_state_vars()
+endfunction()
+
+macro(qt_feature_unset_state_vars)
unset(__QtFeature_library PARENT_SCOPE)
unset(__QtFeature_public_features PARENT_SCOPE)
unset(__QtFeature_private_features PARENT_SCOPE)
@@ -675,7 +690,8 @@ function(qt_feature_module_end)
unset(__QtFeature_custom_enabled_features PARENT_SCOPE)
unset(__QtFeature_custom_disabled_features PARENT_SCOPE)
unset(__QtFeature_only_evaluate_features PARENT_SCOPE)
-endfunction()
+ unset(__QtFeature_only_record_summary_entries PARENT_SCOPE)
+endmacro()
function(qt_feature_copy_global_config_features_to_core target)
# CMake doesn't support setting custom properties on exported INTERFACE libraries
diff --git a/cmake/QtFindPackageHelpers.cmake b/cmake/QtFindPackageHelpers.cmake
index 5bfc0ff4f6..040fae0e27 100644
--- a/cmake/QtFindPackageHelpers.cmake
+++ b/cmake/QtFindPackageHelpers.cmake
@@ -45,6 +45,12 @@ macro(qt_find_package)
endif()
endif()
+ # When configure.cmake is included only to record summary entries, there's no point in looking
+ # for the packages.
+ if(__QtFeature_only_record_summary_entries)
+ set(_qt_find_package_skip_find_package TRUE)
+ endif()
+
# Get the version if specified.
set(package_version "")
if(${ARGC} GREATER_EQUAL 2)