summaryrefslogtreecommitdiffstats
path: root/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2023-08-25 17:32:19 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2023-09-06 17:22:07 +0200
commit2799391703e44a34b6557e234462e425a61785f2 (patch)
tree9fdde5700496d9e5690e73d310cc4bc88d60acec /cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
parent17efffe1ad6b85f45f418d5d08b5e85a456b12e3 (diff)
CMake: Rework INPUT_foo vars handling when reconfiguring
To be able to reconfigure Qt with modified feature values using the configure script, and take into account INPUT_foo values, we need to ignore FEATURE_foo values. But we can't always ignore FEATURE_foo values, because users might want to toggle them by editing CMakeCache.txt or using an IDE. What we can do is tell CMake we are configuring via the configure script, in which case we can mostly be sure that any passed INPUT_foo values should have higher priority than pre-cached FEATURE_foo values. We also need to remove all the cached INPUT_foo variables after they have been used for feature computation, so that subsequent reconfigurations where an INPUT_foo is not passed anymore, doesn't cause a feature to accidentally reuse the previous (stale) value. Pass -DQT_INTERNAL_CALLED_FROM_CONFIGURE=TRUE to CMake when configuring via the configure script, and use that as a marker to make INPUT_foo values have a higher priority. This needs to be done centrally in qt_evaluate_feature and also in a few more locations where we check INPUT_ values, like the developer build and pkgconfig features. Because QT_INTERNAL_CALLED_FROM_CONFIGURE would become a cached variable, we want to remove it at the end of the configuration phase, so that future 'cmake .' reconfigurations are not considered to be done via configure. To do that, we unset it right at the end of qt_build_repo_end in a per-repo build, and in the final qt_print_build_instructions call in a top-level build. The latter needs a cleaner fix in follow up commits in qt5.git and qtbase. Pick-to: 6.6 Task-number: QTBUG-112957 Change-Id: I3fd338092041ef09e3f5a4dfbaf61da5deea0514 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Diffstat (limited to 'cmake/QtBuildInternals/QtBuildInternalsConfig.cmake')
-rw-r--r--cmake/QtBuildInternals/QtBuildInternalsConfig.cmake25
1 files changed, 22 insertions, 3 deletions
diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
index 3bdb648831..1067e01e83 100644
--- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
+++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
@@ -131,9 +131,10 @@ function(qt_build_internals_disable_pkg_config_if_needed)
endif()
# Features won't have been evaluated yet if this is the first run, have to evaluate this here
- if ((NOT DEFINED "FEATURE_pkg_config") AND (DEFINED "INPUT_pkg_config")
- AND (NOT "${INPUT_pkg_config}" STREQUAL "undefined")
- AND (NOT "${INPUT_pkg_config}" STREQUAL ""))
+ if((NOT DEFINED "FEATURE_pkg_config" OR QT_INTERNAL_CALLED_FROM_CONFIGURE)
+ AND DEFINED INPUT_pkg_config
+ AND NOT "${INPUT_pkg_config}" STREQUAL "undefined"
+ AND NOT "${INPUT_pkg_config}" STREQUAL "")
if(INPUT_pkg_config)
set(FEATURE_pkg_config ON)
else()
@@ -603,9 +604,27 @@ macro(qt_build_repo_end)
set(QT_INTERNAL_FRESH_REQUESTED "FALSE" CACHE INTERNAL "")
endif()
+ if(NOT QT_SUPERBUILD)
+ qt_internal_qt_configure_end()
+ endif()
+
list(POP_BACK CMAKE_MESSAGE_CONTEXT)
endmacro()
+# Function called either at the end of per-repo configuration, or at the end of configuration of
+# a super build.
+# At the moment it is called before examples are configured in a per-repo build. We might want
+# to change that at some point if needed.
+function(qt_internal_qt_configure_end)
+ # If Qt is configued via the configure script, remove the marker variable, so that any future
+ # reconfigurations that are done by calling cmake directly don't trigger configure specific
+ # logic.
+ unset(QT_INTERNAL_CALLED_FROM_CONFIGURE CACHE)
+
+ # Clean up stale feature input values.
+ qt_internal_clean_feature_inputs()
+endfunction()
+
macro(qt_build_repo)
qt_build_repo_begin(${ARGN})