From 2c598814bb53fa9a84be5e53ed4dd5ba5af9cb20 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Mon, 18 Mar 2024 12:37:52 +0100 Subject: [PATCH] CMakePM: Always set the comiplers from the CMake Preset probe In cases when a CMake project is using a CMake preset with a toolchain file, the CMAKE_C|XX_COMIPLER value was not set in the CMakeCache.txt. This commit makes sure that the cache from the CMake preset probe contains CMAKE_C|XX_COMPILER values. Task-number: QTCREATORBUG-30474 Change-Id: I63ac6fe2b043e49dda98e286b6d85950e34be920 Reviewed-by: Alessandro Portale --- src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp index d16b35f1ef0..33c8d663557 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp @@ -245,6 +245,8 @@ static CMakeConfig configurationFromPresetProbe( cmakeListTxt.writeFileContents(QByteArray("cmake_minimum_required(VERSION 3.15)\n" "\n" "project(preset-probe)\n" + "set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\" CACHE FILEPATH \"\" FORCE)\n" + "set(CMAKE_CXX_COMPILER \"${CMAKE_CXX_COMPILER}\" CACHE FILEPATH \"\" FORCE)\n" "\n")); Process cmake;