summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-07-22 17:30:24 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-07-22 16:02:21 +0000
commitf60e4058aa27d19fcbb5dbde3d179ccbc6655003 (patch)
tree867665e889004b00fabc9c9015f67b4e0ee91383 /cmake
parent31341ad63abbf67fc6a058284e5f48c33a6c4e8f (diff)
Fix non-prefix builds for non qtbase repos
QT_WILL_INSTALL was previously always set to ON when doing a qtdeclarative build, because CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT evaluated to false due to always having to set CMAKE_INSTALL_PREFIX to point to the qtbase build directory. Instead of recomputing the value of QT_WILL_INSTALL, compute it once while configuring qtbase, and add it to the generated QtBuildInternalsExtra.cmake file, so it propagates to all other repos that will be built. Change-Id: If8bf63e7501b5758fe7aa0f799cb0746704f4811 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuildInternalsExtra.cmake.in4
-rw-r--r--cmake/QtSetup.cmake26
2 files changed, 21 insertions, 9 deletions
diff --git a/cmake/QtBuildInternalsExtra.cmake.in b/cmake/QtBuildInternalsExtra.cmake.in
index 028cfe2717..6f070ed043 100644
--- a/cmake/QtBuildInternalsExtra.cmake.in
+++ b/cmake/QtBuildInternalsExtra.cmake.in
@@ -15,3 +15,7 @@ set(CMAKE_INSTALL_PREFIX @CMAKE_INSTALL_PREFIX@ CACHE PATH
if(@FEATURE_developer_build@)
set(FEATURE_developer_build ON CACHE BOOL "Developer build." FORCE)
endif()
+
+# Propagate non-prefix builds.
+set(QT_WILL_INSTALL @QT_WILL_INSTALL@ CACHE BOOL
+ "Boolean indicating if doing a Qt prefix build (vs non-prefix build)." FORCE)
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake
index fcc26c844a..9fac9875c5 100644
--- a/cmake/QtSetup.cmake
+++ b/cmake/QtSetup.cmake
@@ -42,19 +42,25 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
# Detect non-prefix builds, either when the install prefix is set to the binary dir
# or when enabling developer builds and no prefix is specified.
-if((CMAKE_INSTALL_PREFIX STREQUAL CMAKE_BINARY_DIR) OR (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND FEATURE_developer_build))
- set(QT_WILL_INSTALL OFF)
- # Handle non-prefix builds by setting the cmake install prefix to the project binary dir.
- if(PROJECT_NAME STREQUAL "QtBase")
+# This detection only happens when building qtbase, and later is propagated via the generated
+# QtBuildInternalsExtra.cmake file.
+if (PROJECT_NAME STREQUAL "QtBase")
+ if((CMAKE_INSTALL_PREFIX STREQUAL CMAKE_BINARY_DIR) OR
+ (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND FEATURE_developer_build))
+
+ set(__qt_will_install_value OFF)
+ # Handle non-prefix builds by setting the CMake install prefix to point to qtbase's build
+ # dir.
+ # While building another repo (like qtsvg), the CMAKE_INSTALL_PREFIX or CMAKE_PREFIX_PATH
+ # (either work) should be set on the command line to point to the qtbase build dir.
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH
"Install path prefix, prepended onto install directories." FORCE)
else()
- # No-op. While building another module, the CMAKE_INSTALL_PREFIX or CMAKE_PREFIX_PATH
- # (either work) should be set on the command line to point to the qtbase build dir.
+ set(__qt_will_install_value ON)
endif()
-else()
- set(QT_WILL_INSTALL ON)
- set(QT_BUILD_TESTING OFF)
+ set(QT_WILL_INSTALL ${__qt_will_install_value} CACHE BOOL
+ "Boolean indicating if doing a Qt prefix build (vs non-prefix build)." FORCE)
+ unset(__qt_will_install_value)
endif()
if(FEATURE_developer_build)
@@ -64,6 +70,8 @@ if(FEATURE_developer_build)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif()
set(QT_BUILD_TESTING ON)
+else()
+ set(QT_BUILD_TESTING OFF)
endif()
## Set up testing