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:
9
Help/envvar/CMAKE_COLOR_DIAGNOSTICS.rst
Normal file
9
Help/envvar/CMAKE_COLOR_DIAGNOSTICS.rst
Normal 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.
|
@@ -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
|
||||
|
@@ -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`.
|
||||
|
@@ -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.
|
||||
|
@@ -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.")
|
||||
|
Reference in New Issue
Block a user