cmake: enable CMAKE_COLOR_DIAGNOSTICS by default

Related to https://github.com/espressif/esp-idf/issues/4162

Setting this option informs CMake that it should pass
-fcolor-diagnostics flag to the compiler.

(Colorized build system output, like from GNU Make, is produced even
without this flag.)

Note that if the build is done using Ninja and the build output is
redirected (not a TTY), Ninja will still strip the escape codes from
the output. For the case of idf.py, this is handled in the next
commit.
pull/9715/head
Ivan Grokhotkov 2022-08-01 20:18:28 +02:00
rodzic a8c8946766
commit 56e6263350
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 1E050E141B280628
1 zmienionych plików z 6 dodań i 0 usunięć

Wyświetl plik

@ -344,6 +344,12 @@ macro(project project_name)
# Generate compile_commands.json (needs to come after project call).
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# If CMAKE_COLOR_DIAGNOSTICS not set in project CMakeLists.txt or in the environment,
# enable it by default.
if(NOT DEFINED CMAKE_COLOR_DIAGNOSTICS AND NOT DEFINED ENV{CMAKE_COLOR_DIAGNOSTICS})
set(CMAKE_COLOR_DIAGNOSTICS ON)
endif()
# Since components can import third-party libraries, the original definition of project() should be restored
# before the call to add components to the build.
function(project)