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>
This commit is contained in:
parent
0f38259cb3
commit
42eb1e4aa6
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user