From d7f44cdd2417443b2b6e669029a678bf92a991a4 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Sat, 14 Oct 2023 14:35:07 +0200 Subject: [PATCH] CMakePM: Enable ANSI codes colored output Qt Creator is able to display colored output for the _Compile Output_ and _General Messages_ panes. This commit enables CMake and tools to use this functionality. See https://cmake.org/cmake/help/latest/variable/ CMAKE_COLOR_DIAGNOSTICS.html and http://bixense.com/clicolors/ for more details. Change-Id: Ied4058bbd2522750d559b05d585092830ce3a911 Reviewed-by: Reviewed-by: Marcus Tillmanns --- src/plugins/cmakeprojectmanager/builddirparameters.cpp | 2 ++ src/plugins/cmakeprojectmanager/cmakebuildstep.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/plugins/cmakeprojectmanager/builddirparameters.cpp b/src/plugins/cmakeprojectmanager/builddirparameters.cpp index b231cc74b77..2a72521d1c5 100644 --- a/src/plugins/cmakeprojectmanager/builddirparameters.cpp +++ b/src/plugins/cmakeprojectmanager/builddirparameters.cpp @@ -66,6 +66,8 @@ BuildDirParameters::BuildDirParameters(CMakeBuildSystem *buildSystem) environment.set("ICECC", "no"); environment.set("QTC_RUN", "1"); + environment.setFallback("CMAKE_COLOR_DIAGNOSTICS", "1"); + environment.setFallback("CLICOLOR_FORCE", "1"); cmakeToolId = CMakeKitAspect::cmakeToolId(k); } diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index 7fba5bb98eb..8187311a887 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -261,6 +261,8 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Id id) : env.set("NINJA_STATUS", ninjaProgressString + "%o/sec] "); env.modify(m_userEnvironmentChanges); + env.setFallback("CLICOLOR_FORCE", "1"); + if (useStaging()) env.set("DESTDIR", stagingDir().path()); });