From 3cb4f45ca8476aee0e67caae159d3fbb80354c54 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 6 Oct 2020 15:23:05 +0200 Subject: CMake: Introduce QT_CHAINLOAD_TOOLCHAIN_FILE This variable can be set when using qt-cmake[-private] to override the CMake toolchain file that is chainloaded by Qt's toolchain file. Task-number: QTBUG-87068 Change-Id: Id529408381e4174becda1ba07a489535c8cf1314 Reviewed-by: Alexandru Croitor --- cmake/README.md | 2 ++ cmake/qt.toolchain.cmake.in | 3 +++ 2 files changed, 5 insertions(+) (limited to 'cmake') diff --git a/cmake/README.md b/cmake/README.md index 3ac875605f..54c5f1094e 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -262,6 +262,8 @@ A Qt installation's bin directory contains a number of convenience scripts. This is a wrapper around the CMake executable which passes a Qt-internal `CMAKE_TOOLCHAIN_FILE`. Use this to build projects against the installed Qt. +To use a custom toolchain file, use `-DQT_CHAINLOAD_TOOLCHAIN_FILE=`. + ## qt-cmake-private The same as `qt-cmake`, but in addition, sets the CMake generator to Ninja. diff --git a/cmake/qt.toolchain.cmake.in b/cmake/qt.toolchain.cmake.in index c76c89c116..fcc31eea0c 100644 --- a/cmake/qt.toolchain.cmake.in +++ b/cmake/qt.toolchain.cmake.in @@ -4,6 +4,9 @@ @init_qt_host_path_cmake_dir@ @init_original_toolchain_file@ @init_vcpkg@ +if(NOT "${QT_CHAINLOAD_TOOLCHAIN_FILE}" STREQUAL "") + set(__qt_chainload_toolchain_file "${QT_CHAINLOAD_TOOLCHAIN_FILE}") +endif() if(__qt_chainload_toolchain_file) get_filename_component(__qt_chainload_toolchain_file_real_path "${__qt_chainload_toolchain_file}" REALPATH) -- cgit v1.2.3