diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2020-12-11 16:11:35 +0100 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2020-12-17 13:03:37 +0100 |
commit | 61943aefd68b7d88c5eb395c4e44d08a94a70ad0 (patch) | |
tree | 96afbecf1600a9763acd894d86f6c87898067e73 /cmake/QtModuleConfig.cmake.in | |
parent | a46a723dbab83c777e45f40a6bd685a07d60ca4e (diff) |
CMake: Add detection of FEATURE_foo change by user
Unset all QT_FEATURE_foo values for every build.
If any of FEATURE_foo is different of QT_FEATURE_foo, mark whole Qt
build as dirty. Reset FEATURE_foo for dirty builds to the calculated
value if it doesn't meet its condition.
Set Qt module as NOT FOUND if its target was not created during
configuration.
Main issue with this approach are generated files, that became trash
once the related features are disabled. This especially affects features
that enable/disable Qt modules. FooConfig.cmake files are created and
generate lots of warnings if feature was disabled. We may introduce a
module cleanup procedure at some point.
Fixes: QTBUG-85962
Pick-to: 6.0
Change-Id: Id71c1edb4027b24c6793063e40cc9d612c24ebce
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake/QtModuleConfig.cmake.in')
-rw-r--r-- | cmake/QtModuleConfig.cmake.in | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/cmake/QtModuleConfig.cmake.in b/cmake/QtModuleConfig.cmake.in index ecd5e04e63..0573256982 100644 --- a/cmake/QtModuleConfig.cmake.in +++ b/cmake/QtModuleConfig.cmake.in @@ -86,32 +86,36 @@ if (NOT QT_NO_CREATE_TARGETS) list(REMOVE_DUPLICATES @QT_CMAKE_EXPORT_NAMESPACE@@target@_COMPILE_DEFINITIONS) endif() -foreach(extra_cmake_include @extra_cmake_includes@) - include("${CMAKE_CURRENT_LIST_DIR}/${extra_cmake_include}") -endforeach() +if (TARGET @QT_CMAKE_EXPORT_NAMESPACE@::@target@) + foreach(extra_cmake_include @extra_cmake_includes@) + include("${CMAKE_CURRENT_LIST_DIR}/${extra_cmake_include}") + endforeach() -include(${_qt_@PROJECT_VERSION_MAJOR@_config_cmake_dir}/QtFeature.cmake) + include(${_qt_@PROJECT_VERSION_MAJOR@_config_cmake_dir}/QtFeature.cmake) -qt_make_features_available(@QT_CMAKE_EXPORT_NAMESPACE@::@target@) + qt_make_features_available(@QT_CMAKE_EXPORT_NAMESPACE@::@target@) -if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Plugins.cmake") - include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Plugins.cmake") -endif() + if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Plugins.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Plugins.cmake") + endif() -list(APPEND QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE "@target@") + list(APPEND QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE "@target@") -get_target_property(_qt_module_target_type "@INSTALL_CMAKE_NAMESPACE@::@target@" TYPE) -if(NOT _qt_module_target_type STREQUAL "INTERFACE_LIBRARY") - get_target_property(_qt_module_plugin_types - @INSTALL_CMAKE_NAMESPACE@::@target@ MODULE_PLUGIN_TYPES) - if(_qt_module_plugin_types) - list(APPEND QT_ALL_PLUGIN_TYPES_FOUND_VIA_FIND_PACKAGE "${_qt_module_plugin_types}") + get_target_property(_qt_module_target_type "@INSTALL_CMAKE_NAMESPACE@::@target@" TYPE) + if(NOT _qt_module_target_type STREQUAL "INTERFACE_LIBRARY") + get_target_property(_qt_module_plugin_types + @INSTALL_CMAKE_NAMESPACE@::@target@ MODULE_PLUGIN_TYPES) + if(_qt_module_plugin_types) + list(APPEND QT_ALL_PLUGIN_TYPES_FOUND_VIA_FIND_PACKAGE "${_qt_module_plugin_types}") + endif() endif() -endif() -# Load Module's BuildInternals should any exist -if (@INSTALL_CMAKE_NAMESPACE@BuildInternals_DIR AND + # Load Module's BuildInternals should any exist + if (@INSTALL_CMAKE_NAMESPACE@BuildInternals_DIR AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@BuildInternals.cmake") - include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@BuildInternals.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@BuildInternals.cmake") + endif() +else() + set("@INSTALL_CMAKE_NAMESPACE@@target@_FOUND" FALSE) endif() |