Don't hardcode the binary directory name

INSTALL_BINDIR may point to a different location than "bin". In order
to avoid errors when trying to install qtbase, "bin" is replaced with
"INSTALL_BINDIR" where necessary.

Contributes to QTBUG-81289

Change-Id: I1d4f9fb2617547c9b0e44d6690caebb2b6768e2f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Christophe Giboudeaux 2020-01-21 15:02:58 +01:00 committed by Alexandru Croitor
parent 5fc2882ac5
commit 7f6eb6ead6
2 changed files with 14 additions and 14 deletions

View File

@ -131,10 +131,10 @@ qt_install(FILES "${__GlobalConfig_build_dir}/qt.toolchain.cmake" DESTINATION "$
# Also provide a convenience cmake wrapper
if(UNIX)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/bin/qt-cmake.in" "${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-cmake" @ONLY)
qt_install(PROGRAMS "${QT_BUILD_DIR}/bin/qt-cmake" DESTINATION "${INSTALL_BINDIR}")
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-cmake" DESTINATION "${INSTALL_BINDIR}")
else()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/bin/qt-cmake.bat.in" "${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-cmake.bat" @ONLY)
qt_install(PROGRAMS "${QT_BUILD_DIR}/bin/qt-cmake.bat" DESTINATION "${INSTALL_BINDIR}")
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-cmake.bat" DESTINATION "${INSTALL_BINDIR}")
endif()
# Provide a private convenience wrapper with options which should not be propagated via the public
@ -149,11 +149,11 @@ set(__qt_cmake_extra "-G\"${CMAKE_GENERATOR}\"")
if(UNIX)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/bin/qt-cmake.in"
"${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-cmake-private" @ONLY)
qt_install(PROGRAMS "${QT_BUILD_DIR}/bin/qt-cmake-private" DESTINATION "${INSTALL_BINDIR}")
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-cmake-private" DESTINATION "${INSTALL_BINDIR}")
else()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/bin/qt-cmake.bat.in"
"${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-cmake-private.bat" @ONLY)
qt_install(PROGRAMS "${QT_BUILD_DIR}/bin/qt-cmake-private.bat" DESTINATION "${INSTALL_BINDIR}")
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-cmake-private.bat" DESTINATION "${INSTALL_BINDIR}")
endif()
unset(__qt_cmake_extra)

View File

@ -2876,7 +2876,7 @@ function(qt_add_test name)
set_tests_properties(${name} PROPERTIES TIMEOUT ${arg_TIMEOUT})
endif()
# Get path to qtbase/bin, then prepend this path containing the shared libraries to PATH
set(INSTALL_PREFIX_BIN "${CMAKE_INSTALL_PREFIX}/bin")
set(INSTALL_PREFIX_BIN "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}")
set_property(TEST "${name}" APPEND PROPERTY ENVIRONMENT "PATH=${CMAKE_CURRENT_BINARY_DIR}${QT_PATH_SEPARATOR}${INSTALL_PREFIX_BIN}${QT_PATH_SEPARATOR}$ENV{PATH}")
set_property(TEST "${name}" APPEND PROPERTY ENVIRONMENT "QT_TEST_RUNNING_IN_CTEST=1")
@ -3438,13 +3438,13 @@ function(qt_add_docs)
set(doc_project ${ARGV1})
if (NOT QT_SUPERBUILD OR QT_WILL_INSTALL)
set(qdoc_bin "${CMAKE_INSTALL_PREFIX}/bin/qdoc")
set(qtattributionsscanner_bin "${CMAKE_INSTALL_PREFIX}/bin/qtattributionsscanner")
set(qhelpgenerator_bin "${CMAKE_INSTALL_PREFIX}/bin/qhelpgenerator")
set(qdoc_bin "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}/qdoc")
set(qtattributionsscanner_bin "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}/qtattributionsscanner")
set(qhelpgenerator_bin "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}/qhelpgenerator")
else()
set(qdoc_bin "${CMAKE_INSTALL_PREFIX}/qtbase/bin/qdoc")
set(qtattributionsscanner_bin "${CMAKE_INSTALL_PREFIX}/qtbase/bin/qtattributionsscanner")
set(qhelpgenerator_bin "${CMAKE_INSTALL_PREFIX}/qtbase/bin/qhelpgenerator")
set(qdoc_bin "${CMAKE_INSTALL_PREFIX}/qtbase/${INSTALL_BINDIR}/qdoc")
set(qtattributionsscanner_bin "${CMAKE_INSTALL_PREFIX}/qtbase/${INSTALL_BINDIR}/qtattributionsscanner")
set(qhelpgenerator_bin "${CMAKE_INSTALL_PREFIX}/qtbase/${INSTALL_BINDIR}/qhelpgenerator")
endif()
get_target_property(target_type ${target} TYPE)
@ -3948,7 +3948,7 @@ function(qt_generate_qconfig_cpp)
# TODO: Clean this up, there's a bunch of unrealistic assumptions here.
# See qtConfOutput_preparePaths in qtbase/configure.pri.
if(WIN32)
set(lib_location_absolute_path "${CMAKE_INSTALL_PREFIX}/bin")
set(lib_location_absolute_path "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}")
else()
set(lib_location_absolute_path "${CMAKE_INSTALL_PREFIX}/lib")
endif()
@ -3957,10 +3957,10 @@ function(qt_generate_qconfig_cpp)
if(QT_HOST_PATH)
set(host_prefix "${QT_HOST_PATH}")
set(host_bin_dir_absolute_path "${QT_HOST_PATH}/bin")
set(host_bin_dir_absolute_path "${QT_HOST_PATH}/${INSTALL_BINDIR}")
else()
set(host_prefix "${CMAKE_INSTALL_PREFIX}")
set(host_bin_dir_absolute_path "${CMAKE_INSTALL_PREFIX}/bin")
set(host_bin_dir_absolute_path "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}")
endif()
file(RELATIVE_PATH from_host_bin_dir_to_host_prefix