CMake: Fix incorrect host path used in generated toolchain file

A previous change accidentally broke what we we set for
QT_HOST_PATH and QT_HOST_PATH_CMAKE_DIR.

The QT_HOST_PATH variable should use an absolute path as it was
done before.

The QT_HOST_PATH_CMAKE_DIR variable incorrectly used the value of
"${QT_HOST_PATH}" instead of "${QT_HOST_PATH_CMAKE_DIR}".

Fix both of these, and change the names of intermediate variables
to be consistent.

Amends a6a3b82ffb

Task-number: QTBUG-85240
Change-Id: I328a7edee12a13ff793684e8a0a4c2e03204eca4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-09-15 11:51:59 +02:00
parent 9ce8281417
commit e957e9c28f

View File

@ -92,18 +92,20 @@ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
# Generate toolchain file for convenience
if(QT_HOST_PATH)
get_filename_component(init_qt_host_path "${QT_HOST_PATH}" ABSOLUTE)
# TODO: Figure out how to make these relocatable.
get_filename_component(__qt_host_path_absolute "${QT_HOST_PATH}" ABSOLUTE)
set(init_qt_host_path "
set(__qt_initial_qt_host_path \"${QT_HOST_PATH}\")
set(__qt_initial_qt_host_path \"${__qt_host_path_absolute}\")
if(NOT DEFINED QT_HOST_PATH AND EXISTS \"\${__qt_initial_qt_host_path}\")
set(QT_HOST_PATH \"\${__qt_initial_qt_host_path}\" CACHE PATH \"\" FORCE)
endif()")
get_filename_component(QT_HOST_PATH_CMAKE_DIR
get_filename_component(__qt_host_path_cmake_dir_absolute
"${Qt${PROJECT_VERSION_MAJOR}HostInfo_DIR}/.." ABSOLUTE)
set(init_qt_host_path_cmake_dir
"
set(__qt_initial_qt_host_path_cmake_dir \"${QT_HOST_PATH}\")
set(__qt_initial_qt_host_path_cmake_dir \"${__qt_host_path_cmake_dir_absolute}\")
if(NOT DEFINED QT_HOST_PATH_CMAKE_DIR AND EXISTS \"\${__qt_initial_qt_host_path_cmake_dir}\")
set(QT_HOST_PATH_CMAKE_DIR \"\${__qt_initial_qt_host_path_cmake_dir}\" CACHE PATH \"\" FORCE)
endif()")