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>
This commit is contained in:
parent
389c772fd4
commit
062318feb2
@ -145,8 +145,13 @@ function(qt_internal_set_up_global_paths)
|
||||
set(QT_BUILD_DIR "${QtBase_BINARY_DIR}")
|
||||
set(QT_INSTALL_DIR "")
|
||||
else()
|
||||
set(QT_BUILD_DIR "${QtBase_BINARY_DIR}")
|
||||
set(QT_INSTALL_DIR "${QtBase_BINARY_DIR}")
|
||||
if("${CMAKE_STAGING_PREFIX}" STREQUAL "")
|
||||
set(QT_BUILD_DIR "${QtBase_BINARY_DIR}")
|
||||
set(QT_INSTALL_DIR "${QtBase_BINARY_DIR}")
|
||||
else()
|
||||
set(QT_BUILD_DIR "${CMAKE_STAGING_PREFIX}")
|
||||
set(QT_INSTALL_DIR "${CMAKE_STAGING_PREFIX}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
if(QT_WILL_INSTALL)
|
||||
@ -157,7 +162,11 @@ function(qt_internal_set_up_global_paths)
|
||||
else()
|
||||
# When doing a non-prefix build, both the build dir and install dir are the same,
|
||||
# pointing to the qtbase build dir.
|
||||
set(QT_BUILD_DIR "${CMAKE_INSTALL_PREFIX}")
|
||||
if("${CMAKE_STAGING_PREFIX}" STREQUAL "")
|
||||
set(QT_BUILD_DIR "${CMAKE_INSTALL_PREFIX}")
|
||||
else()
|
||||
set(QT_BUILD_DIR "${CMAKE_STAGING_PREFIX}")
|
||||
endif()
|
||||
set(QT_INSTALL_DIR "${QT_BUILD_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
@ -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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user