summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2021-01-25 19:29:52 +0100
committerAlexey Edelev <alexey.edelev@qt.io>2021-01-26 17:16:04 +0100
commit114d5c045da872be8cd304949c86b9e9655af2bf (patch)
treeb69357a5e0f14460618361fc8b5e878930dc9cd9 /cmake
parentb69b04c4790f319104a1098147cea9405b6e7062 (diff)
Fix invalid Qt prefix version when looking for HostInfo module
In QtSetup.cmake the PROJECT_VERSION_MAJOR variable was used to identify prefix of 'Qt<version>HostInfoConfig.cmake'. Qt<version>HostInfo is not found, if project version differs from qtbase version. Move the 'INSTALL_CMAKE_NAMESPACE' and 'QT_CMAKE_EXPORT_NAMESPACE' variables to 'QtBuildInternalsConfig.cmake'. In this case variables will be exposed for a wider list of internal routines. Use the 'INSTALL_CMAKE_NAMESPACE' variable as prefix to find Qt<version>HostInfo module. Fixes: QTBUG-90345 Change-Id: Ic595d1c5beb74f34e69b58e18590a3afc2f346f7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuild.cmake11
-rw-r--r--cmake/QtBuildInternals/QtBuildInternalsConfig.cmake11
-rw-r--r--cmake/QtSetup.cmake2
3 files changed, 12 insertions, 12 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index cc15d9155c..02d37ca03e 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -208,17 +208,6 @@ endfunction()
qt_internal_set_up_global_paths()
qt_get_relocatable_install_prefix(QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX)
-# The variables might have already been set in QtBuildInternalsExtra.cmake if the file is included
-# while building a new module and not QtBase. In that case, stop overriding the value.
-if(NOT INSTALL_CMAKE_NAMESPACE)
- set(INSTALL_CMAKE_NAMESPACE "Qt${PROJECT_VERSION_MAJOR}"
- CACHE STRING "CMake namespace [Qt${PROJECT_VERSION_MAJOR}]")
-endif()
-if(NOT QT_CMAKE_EXPORT_NAMESPACE)
- set(QT_CMAKE_EXPORT_NAMESPACE "Qt${PROJECT_VERSION_MAJOR}"
- CACHE STRING "CMake namespace used when exporting targets [Qt${PROJECT_VERSION_MAJOR}]")
-endif()
-
set(QT_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}")
# Find the path to mkspecs/, depending on whether we are building as part of a standard qtbuild,
diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
index 1663e76295..0afd9e7299 100644
--- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
+++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
@@ -13,6 +13,17 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/QtBuildInternalsExtra.cmake")
include(${CMAKE_CURRENT_LIST_DIR}/QtBuildInternalsExtra.cmake)
endif()
+# The variables might have already been set in QtBuildInternalsExtra.cmake if the file is included
+# while building a new module and not QtBase. In that case, stop overriding the value.
+if(NOT INSTALL_CMAKE_NAMESPACE)
+ set(INSTALL_CMAKE_NAMESPACE "Qt${PROJECT_VERSION_MAJOR}"
+ CACHE STRING "CMake namespace [Qt${PROJECT_VERSION_MAJOR}]")
+endif()
+if(NOT QT_CMAKE_EXPORT_NAMESPACE)
+ set(QT_CMAKE_EXPORT_NAMESPACE "Qt${PROJECT_VERSION_MAJOR}"
+ CACHE STRING "CMake namespace used when exporting targets [Qt${PROJECT_VERSION_MAJOR}]")
+endif()
+
macro(qt_set_up_build_internals_paths)
# Set up the paths for the cmake modules located in the prefix dir. Prepend, so the paths are
# least important compared to the source dir ones, but more important than command line
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake
index c9ed45d5e8..256206a99d 100644
--- a/cmake/QtSetup.cmake
+++ b/cmake/QtSetup.cmake
@@ -175,7 +175,7 @@ if (CMAKE_CROSSCOMPILING)
endif()
if(NOT "${QT_HOST_PATH}" STREQUAL "")
- find_package(Qt${PROJECT_VERSION_MAJOR}HostInfo
+ find_package(${INSTALL_CMAKE_NAMESPACE}HostInfo
CONFIG
REQUIRED
PATHS "${QT_HOST_PATH}"