diff --git a/CMakeLists.txt b/CMakeLists.txt index af20343..63eb6bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,15 @@ endif() set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "CMake Configuration Types" FORCE) +option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." TRUE) +if(${FORCE_COLORED_OUTPUT}) + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + add_compile_options(-fdiagnostics-color=always) + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang") + add_compile_options(-fcolor-diagnostics) + endif() +endif() + set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF)