From ee736717d35d10d15e05a8b93255088889f3a9ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Mon, 3 Jul 2023 15:57:41 +0200 Subject: [PATCH] CMake: Don't use VCPKG_DEFAULT_TRIPLET for triplet deduction This environment variable is used by vcpkg to avoid having to pass the --triplet argument on the command line on every vcpkg invocation and shouldn't influence the triplet used during build. In fact, the vcpkg.cmake toolchain will automatically attempt to deduce the target triplet if we don't define this beforehand. As a replacement, read from the QT_VCPKG_TARGET_TRIPLET environment variable. It has the QT_ prefix to make it clear this is not a standard vcpkg environment variable. [ChangeLog][Build System] Qt no longer uses the VCPKG_DEFAULT_TRIPLET environment variable to deduce target triplet. By default we let vcpkg's toolchain file automatically deduce the triplet to use. The new QT_VCPKG_TARGET_TRIPLET environment variable can be used instead, or pass -DVCPKG_TARGET_TRIPLET= to CMake. Pick-to: 6.6 Change-Id: Idc6cbd52a68578d1762ca175c4973355409688ac Reviewed-by: Alexandru Croitor Reviewed-by: Joerg Bornemann --- cmake/QtAutoDetect.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/QtAutoDetect.cmake b/cmake/QtAutoDetect.cmake index 17c0beac223..cbbda362b55 100644 --- a/cmake/QtAutoDetect.cmake +++ b/cmake/QtAutoDetect.cmake @@ -177,8 +177,8 @@ function(qt_auto_detect_vcpkg) endif() set(CMAKE_TOOLCHAIN_FILE "${vcpkg_toolchain_file}" CACHE STRING "" FORCE) message(STATUS "Using vcpkg from $ENV{VCPKG_ROOT}") - if(DEFINED ENV{VCPKG_DEFAULT_TRIPLET} AND NOT DEFINED VCPKG_TARGET_TRIPLET) - set(VCPKG_TARGET_TRIPLET "$ENV{VCPKG_DEFAULT_TRIPLET}" CACHE STRING "") + if(DEFINED ENV{QT_VCPKG_TARGET_TRIPLET} AND NOT DEFINED VCPKG_TARGET_TRIPLET) + set(VCPKG_TARGET_TRIPLET "$ENV{QT_VCPKG_TARGET_TRIPLET}" CACHE STRING "") message(STATUS "Using vcpkg triplet ${VCPKG_TARGET_TRIPLET}") endif() unset(vcpkg_toolchain_file)