From 4a8d557d4444122fed9db828013ba1e95e24a154 Mon Sep 17 00:00:00 2001 From: Yamakaky Date: Thu, 27 Aug 2015 09:56:46 +0200 Subject: [PATCH] cmake: Enable -fdiagnostics-color=auto gcc flag. #3137 --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b5875e599..2b83b56f75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,9 @@ set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}) set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPS_PREFIX}/lib/pkgconfig") +# used for check_c_compiler_flag +include(CheckCCompilerFlag) + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") # CMake tries to treat /sw and /opt/local as extension of the system path, but # that doesn't really work out very well. Once you have a dependency that @@ -125,7 +128,6 @@ if(MINGW) add_definitions(-D__USE_MINGW_ANSI_STDIO) endif() -include(CheckCCompilerFlag) check_c_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG_FLAG) check_c_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR_FLAG) @@ -135,6 +137,11 @@ elseif(HAS_FSTACK_PROTECTOR_FLAG) add_definitions(-fstack-protector --param ssp-buffer-size=4) endif() +check_c_compiler_flag(-fdiagnostics-color=auto HAS_DIAG_COLOR_FLAG) +if(HAS_DIAG_COLOR_FLAG) + add_definitions(-fdiagnostics-color=auto) +endif() + option( TRAVIS_CI_BUILD "Travis CI build. Extra compilation flags will be set." OFF)