1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 05:26:58 +08:00

color: Add CMAKE_COLOR_DIAGNOSTICS environment variable

This commit is contained in:
Semyon Kolton
2022-02-16 12:01:55 +03:00
committed by Brad King
parent 884d9de8b7
commit 78adb1b952
5 changed files with 20 additions and 1 deletions

View File

@@ -0,0 +1,9 @@
CMAKE_COLOR_DIAGNOSTICS
-----------------------
.. versionadded:: 3.24
.. include:: ENV_VAR.txt
Specifies a default value for the :variable:`CMAKE_COLOR_DIAGNOSTICS` variable
when there is no explicit value given on the first run.

View File

@@ -31,6 +31,7 @@ Environment Variables that Control the Build
/envvar/CMAKE_APPLE_SILICON_PROCESSOR
/envvar/CMAKE_BUILD_PARALLEL_LEVEL
/envvar/CMAKE_BUILD_TYPE
/envvar/CMAKE_COLOR_DIAGNOSTICS
/envvar/CMAKE_CONFIGURATION_TYPES
/envvar/CMAKE_CONFIG_TYPE
/envvar/CMAKE_EXPORT_COMPILE_COMMANDS

View File

@@ -5,3 +5,6 @@ color-diagnostics
color diagnostics generated by compilers. This variable also controls
color buildsystem messages with :ref:`Makefile Generators`, replacing
:variable:`CMAKE_COLOR_MAKEFILE`.
The :envvar:`CMAKE_COLOR_DIAGNOSTICS` environment was added to set
a default value for :variable:`CMAKE_COLOR_DIAGNOSTICS`.

View File

@@ -32,4 +32,6 @@ When ``OFF``:
* GNU/Clang compilers are invoked with a flag disabling color diagnostics
(``-fno-color-diagnostics``).
``CMAKE_COLOR_DIAGNOSTICS`` is not defined by default.
If the :envvar:`CMAKE_COLOR_DIAGNOSTICS` environment variable is set, its
value is used. Otherwise, ``CMAKE_COLOR_DIAGNOSTICS`` is not defined by
default.

View File

@@ -47,6 +47,10 @@ set (CMAKE_SKIP_INSTALL_RPATH "NO" CACHE BOOL
set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.")
if(DEFINED ENV{CMAKE_COLOR_DIAGNOSTICS} AND NOT DEFINED CACHE{CMAKE_COLOR_DIAGNOSTICS})
set(CMAKE_COLOR_DIAGNOSTICS $ENV{CMAKE_COLOR_DIAGNOSTICS} CACHE BOOL "Enable colored diagnostics throughout.")
endif()
if(CMAKE_GENERATOR MATCHES "Make")
if(NOT DEFINED CMAKE_COLOR_DIAGNOSTICS)
set(CMAKE_COLOR_MAKEFILE ON CACHE BOOL "Enable/Disable color output during build.")