diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-06-22 18:01:30 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-07-01 18:09:03 +0200 |
commit | 062318feb2d3b7598409c7e81e4459c2f4607764 (patch) | |
tree | 72fd987ee02f90a48bda03ddd5db93111339fdf7 /cmake/QtSetup.cmake | |
parent | 389c772fd4a04933d95904e88470506a44535f92 (diff) |
CMake: Fix non-prefix build detection when CMAKE_STAGING_PREFIX is set
It wasn't possible to create a cross, non-prefix build with
CMAKE_INSTALL_PREFIX set to something else but the qtbase build dir
and CMAKE_STAGING_PREFIX set to the qtbase build dir.
This would be equivalent to
configure -prefix /usr \
-extprefix ~/my/qtbase/build/dir
Fix this by comparing the qtbase build dir against
CMAKE_STAGING_PREFIX if it is set. We also have to adjust the
QT_BUILD_DIR variable in a similar way.
Change-Id: Iaba5cf0f6954ae4b15d8af1fc62634f5d7f68835
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtSetup.cmake')
-rw-r--r-- | cmake/QtSetup.cmake | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake index b23b9924e0..bdb93e6fd0 100644 --- a/cmake/QtSetup.cmake +++ b/cmake/QtSetup.cmake @@ -66,21 +66,30 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) # This detection only happens when building qtbase, and later is propagated via the generated # QtBuildInternalsExtra.cmake file. if (PROJECT_NAME STREQUAL "QtBase" AND NOT QT_BUILD_STANDALONE_TESTS) - if((CMAKE_INSTALL_PREFIX STREQUAL QtBase_BINARY_DIR) OR - (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND FEATURE_developer_build)) - - set(__qt_will_install_value OFF) + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND FEATURE_developer_build) # 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_PREFIX_PATH # should be set on the command line to point to the qtbase build dir. set(CMAKE_INSTALL_PREFIX ${QtBase_BINARY_DIR} CACHE PATH "Install path prefix, prepended onto install directories." FORCE) + endif() + if(CMAKE_CROSSCOMPILING) + set(__qt_prefix "${CMAKE_STAGING_PREFIX}") + else() + set(__qt_prefix_ "") + endif() + if(__qt_prefix STREQUAL "") + set(__qt_prefix "${CMAKE_INSTALL_PREFIX}") + endif() + if(__qt_prefix STREQUAL QtBase_BINARY_DIR) + set(__qt_will_install_value OFF) else() set(__qt_will_install_value ON) endif() 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_prefix) unset(__qt_will_install_value) endif() |