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>
This commit is contained in:
parent
31341ad63a
commit
f60e4058aa
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user