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: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Cristian Adam
2023-10-14 14:35:07 +02:00
parent eab779d13a
commit d7f44cdd24
2 changed files with 4 additions and 0 deletions

View File

@@ -66,6 +66,8 @@ BuildDirParameters::BuildDirParameters(CMakeBuildSystem *buildSystem)
environment.set("ICECC", "no"); environment.set("ICECC", "no");
environment.set("QTC_RUN", "1"); environment.set("QTC_RUN", "1");
environment.setFallback("CMAKE_COLOR_DIAGNOSTICS", "1");
environment.setFallback("CLICOLOR_FORCE", "1");
cmakeToolId = CMakeKitAspect::cmakeToolId(k); cmakeToolId = CMakeKitAspect::cmakeToolId(k);
} }

View File

@@ -261,6 +261,8 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Id id) :
env.set("NINJA_STATUS", ninjaProgressString + "%o/sec] "); env.set("NINJA_STATUS", ninjaProgressString + "%o/sec] ");
env.modify(m_userEnvironmentChanges); env.modify(m_userEnvironmentChanges);
env.setFallback("CLICOLOR_FORCE", "1");
if (useStaging()) if (useStaging())
env.set("DESTDIR", stagingDir().path()); env.set("DESTDIR", stagingDir().path());
}); });