summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-08-27 14:47:45 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-09-03 20:50:02 +0000
commitb604a748b5b4e813c03bc342cf88f6f9267b019b (patch)
tree7f32190fa467f5666f4c6b935c514f0b477c125b /cmake
parent62031bce512558e8d21becba6752751d2859ae38 (diff)
CMake: Don't cache QT_SYNCQT across builds
There is no need for this variable to be stored in CMake's cache. We don't perform expensive operations to set up QT_SYNCQT, and we even unset the cache variable to ensure it gets recomputed on reconfiguration. We still store QT_SYNCQT in a global property, because the function qt_ensure_sync_qt is called in different directory scopes, and we want to avoid re-calculations for every subdir. It's now possible for the user to set QT_SYNCQT (see QTBUG-88088 for motivation). Also, in a non-prefix build, changes to syncqt.pl in the source dir are reflected upon re-configuration in the build tree (because qt_copy_or_install is called on every configure). Fixes: QTBUG-88088 Task-number: QTBUG-75290 Change-Id: I6137b060d200d3dafd4a64d5a6c1bd2549723d78 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 60f36007a361f4102a9cc0ceb65040ebc19d2653) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuild.cmake4
-rw-r--r--cmake/QtSyncQtHelpers.cmake19
2 files changed, 13 insertions, 10 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 797173e5d9..43b7736b03 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -416,10 +416,6 @@ qt_internal_set_qt_known_plugins("")
set(QT_KNOWN_MODULES_WITH_TOOLS "" CACHE INTERNAL "Known Qt modules with tools" FORCE)
-# Reset syncqt cache variable, to make sure it gets recomputed on reconfiguration, otherwise
-# it might not get installed.
-unset(QT_SYNCQT CACHE)
-
# For adjusting variables when running tests, we need to know what
# the correct variable is for separating entries in PATH-alike
# variables.
diff --git a/cmake/QtSyncQtHelpers.cmake b/cmake/QtSyncQtHelpers.cmake
index 9e968cd0f3..1c63f4467b 100644
--- a/cmake/QtSyncQtHelpers.cmake
+++ b/cmake/QtSyncQtHelpers.cmake
@@ -14,11 +14,17 @@ function(qt_ensure_sync_qt)
return()
endif()
+ get_property(QT_SYNCQT GLOBAL PROPERTY _qt_syncqt)
+ if(NOT "${QT_SYNCQT}" STREQUAL "")
+ set(QT_SYNCQT "${QT_SYNCQT}" PARENT_SCOPE)
+ return()
+ endif()
+
# When building qtbase, use the source syncqt, otherwise use the installed one.
set(SYNCQT_FROM_SOURCE "${QtBase_SOURCE_DIR}/libexec/syncqt.pl")
if(NOT ("${QtBase_SOURCE_DIR}" STREQUAL "") AND EXISTS "${SYNCQT_FROM_SOURCE}")
- set(QT_SYNCQT "${SYNCQT_FROM_SOURCE}" CACHE FILEPATH "syncqt script")
- message(STATUS "Using source syncqt found at: ${QT_SYNCQT}")
+ set(syncqt_absolute_path "${SYNCQT_FROM_SOURCE}")
+ message(STATUS "Using source syncqt found at: ${syncqt_absolute_path}")
qt_path_join(syncqt_install_dir ${QT_INSTALL_DIR} ${INSTALL_LIBEXECDIR})
qt_copy_or_install(PROGRAMS "${SYNCQT_FROM_SOURCE}"
@@ -27,15 +33,16 @@ function(qt_ensure_sync_qt)
get_filename_component(syncqt_absolute_path
"${QT_HOST_PATH}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}/syncqt.pl"
ABSOLUTE)
- set(QT_SYNCQT "${syncqt_absolute_path}" CACHE FILEPATH "syncqt script")
- message(STATUS "Using host syncqt found at: ${QT_SYNCQT}")
+ message(STATUS "Using host syncqt found at: ${syncqt_absolute_path}")
else()
get_filename_component(syncqt_absolute_path
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_LIBEXECDIR}/syncqt.pl"
ABSOLUTE)
- set(QT_SYNCQT "${syncqt_absolute_path}" CACHE FILEPATH "syncqt script")
- message(STATUS "Using installed syncqt found at: ${QT_SYNCQT}")
+ message(STATUS "Using installed syncqt found at: ${syncqt_absolute_path}")
endif()
+
+ set(QT_SYNCQT "${syncqt_absolute_path}" PARENT_SCOPE)
+ set_property(GLOBAL PROPERTY _qt_syncqt "${syncqt_absolute_path}")
endfunction()
function(qt_install_injections target build_dir install_dir)