From 884d9de8b7d7201a4461711335ac10aae743777d Mon Sep 17 00:00:00 2001 From: Semyon Kolton Date: Tue, 15 Feb 2022 18:17:24 +0300 Subject: color: Introduce CMAKE_COLOR_DIAGNOSTICS variable Add a variable to control both makefile color messages and compiler color diagnostics. Fixes: #15502 --- Modules/CMakeGenericSystem.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Modules/CMakeGenericSystem.cmake') diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index 9ae68c483c..e54a0287ee 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -48,10 +48,11 @@ 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(CMAKE_GENERATOR MATCHES "Make") - set(CMAKE_COLOR_MAKEFILE ON CACHE BOOL - "Enable/Disable color output during build." - ) + if(NOT DEFINED CMAKE_COLOR_DIAGNOSTICS) + set(CMAKE_COLOR_MAKEFILE ON CACHE BOOL "Enable/Disable color output during build.") + endif() mark_as_advanced(CMAKE_COLOR_MAKEFILE) + if(DEFINED CMAKE_RULE_MESSAGES) set_property(GLOBAL PROPERTY RULE_MESSAGES ${CMAKE_RULE_MESSAGES}) endif() -- cgit v1.2.1 From 78adb1b952d92608e8de708084c8cdac69286616 Mon Sep 17 00:00:00 2001 From: Semyon Kolton Date: Wed, 16 Feb 2022 12:01:55 +0300 Subject: color: Add CMAKE_COLOR_DIAGNOSTICS environment variable --- Modules/CMakeGenericSystem.cmake | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Modules/CMakeGenericSystem.cmake') diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index e54a0287ee..cb105ed1df 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -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.") -- cgit v1.2.1