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/QtSetup.cmake | |
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/QtSetup.cmake')
-rw-r--r-- | cmake/QtSetup.cmake | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake index ec8be5e269..13daf40381 100644 --- a/cmake/QtSetup.cmake +++ b/cmake/QtSetup.cmake @@ -222,3 +222,27 @@ if(QT_USE_CCACHE) message(WARNING "Ccache use was requested, but the program was not found.") endif() endif() + +# We need to clean up QT_FEATURE_*, but only once per configuration cycle +get_property(qt_feature_clean GLOBAL PROPERTY _qt_feature_clean) +if(NOT qt_feature_clean) + message(STATUS "Check for feature set changes") + set_property(GLOBAL PROPERTY _qt_feature_clean TRUE) + foreach(feature ${QT_KNOWN_FEATURES}) + if(DEFINED "FEATURE_${feature}" AND + NOT "${QT_FEATURE_${feature}}" STREQUAL "${FEATURE_${feature}}") + message(" '${feature}' is changed from ${QT_FEATURE_${feature}} \ +to ${FEATURE_${feature}}") + set(dirty_build TRUE) + endif() + unset("QT_FEATURE_${feature}" CACHE) + endforeach() + + set(QT_KNOWN_FEATURES "" CACHE INTERNAL "" FORCE) + + if(dirty_build) + set_property(GLOBAL PROPERTY _qt_dirty_build TRUE) + message(WARNING "Re-configuring in existing build folder. \ +Some features will be re-evaluated automatically.") + endif() +endif() |