Browse Source

Add a global option to force colored output from compiler.

Taken from https://medium.com/@alasher/colored-c-compiler-output-with-ninja-clang-gcc-10bfe7f2b949

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/60/head
Slávek Banko 1 month ago
parent
commit
0459cbaf3e
No known key found for this signature in database GPG Key ID: 608F5293A04BE668
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      modules/TDEMacros.cmake

+ 13
- 0
modules/TDEMacros.cmake View File

@@ -41,6 +41,19 @@ if( NOT TDE_CMAKE_ROOT )
CACHE FILEPATH "TDE CMake templates" )

endif()


option( FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." FALSE )
if( ${FORCE_COLORED_OUTPUT} )
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" )
if( NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9" )
add_compile_options (-fdiagnostics-color=always)
endif()
elseif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
add_compile_options (-fcolor-diagnostics)
endif()
endif()

endif()




Loading…
Cancel
Save