diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-07-22 17:30:24 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-07-22 16:02:21 +0000 |
commit | f60e4058aa27d19fcbb5dbde3d179ccbc6655003 (patch) | |
tree | 867665e889004b00fabc9c9015f67b4e0ee91383 /cmake/QtSetup.cmake | |
parent | 31341ad63abbf67fc6a058284e5f48c33a6c4e8f (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/QtSetup.cmake')
-rw-r--r-- | cmake/QtSetup.cmake | 26 |
1 files changed, 17 insertions, 9 deletions
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 |