CMake: Introduce QT_STAGING_PREFIX

Add the cache variable QT_STAGING_PREFIX that is the same as
CMAKE_STAGING_PREFIX - if it's set, or CMAKE_INSTALL_PREFIX otherwise.

Use the variable in the places where we check for the emptiness of
CMAKE_STAGING_PREFIX to use CMAKE_INSTALL_PREFIX.

Change-Id: I372d57dfa41818c1965b824c59ab3cac80b38f60
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2020-07-02 13:53:31 +02:00
parent f4e4ad6d2b
commit acf6ef536f
2 changed files with 4 additions and 10 deletions

View File

@ -162,11 +162,7 @@ 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.
if("${CMAKE_STAGING_PREFIX}" STREQUAL "")
set(QT_BUILD_DIR "${CMAKE_INSTALL_PREFIX}")
else()
set(QT_BUILD_DIR "${CMAKE_STAGING_PREFIX}")
endif()
set(QT_BUILD_DIR "${QT_STAGING_PREFIX}")
set(QT_INSTALL_DIR "${QT_BUILD_DIR}")
endif()
endif()
@ -1399,11 +1395,7 @@ function(qt_generate_qmake_wrapper_for_target)
qt_path_join(qt_conf_path "${INSTALL_BINDIR}" "target_qt.conf")
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(ext_prefix "${CMAKE_STAGING_PREFIX}")
if(ext_prefix STREQUAL "")
set(ext_prefix "${prefix}")
endif()
set(ext_prefix "${QT_STAGING_PREFIX}")
set(host_prefix "${QT_HOST_PATH}")
file(RELATIVE_PATH host_prefix_relative_to_conf_file "${ext_prefix}/${INSTALL_BINDIR}"
"${host_prefix}")

View File

@ -87,6 +87,8 @@ if (PROJECT_NAME STREQUAL "QtBase" AND NOT QT_BUILD_STANDALONE_TESTS)
else()
set(__qt_will_install_value ON)
endif()
set(QT_STAGING_PREFIX "${__qt_prefix}" CACHE INTERNAL
"Install prefix on the build machine. Either CMAKE_INSTALL_PREFIX or CMAKE_STAGING_PREFIX.")
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)