Skip to content

Commit

Permalink
cmake: use color gcc/clang output when possible
Browse files Browse the repository at this point in the history
Test for the -fdiagnostics-color=auto compiler option supported by gcc
and probably clang, and turn it on if it's available.

This option colorizes compiler warnings/errors/etc. when output to a
terminal.

Also fix a typo above when adding the -fopenmp flag.
  • Loading branch information
rkitover committed Jan 30, 2019
1 parent e912c35 commit c6fa724
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Expand Up @@ -438,7 +438,13 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
endif()
endif()

set(MYU_C_FLAGS ${MY_C_FLAGS} -fopenmp)

set(MY_C_FLAGS ${MY_C_FLAGS} -fopenmp)
endif()

check_cxx_compiler_flag(-fdiagnostics-color=auto COMPILER_COLOR_OUTPUT)
if(COMPILER_COLOR_OUTPUT)
add_compile_options(-fdiagnostics-color=auto)
endif()

if(MINGW)
Expand Down

0 comments on commit c6fa724

Please sign in to comment.