From 1237f7acc56f8cff25a522007cf13f6c1036bbd5 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Wed, 25 Jun 2014 19:12:21 +0200 Subject: [PATCH] Only enable colorized messages if g++ version is >=4.9 --- CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 762677e98..2e2587608 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,18 @@ project( calamares ) cmake_minimum_required( VERSION 2.8.12 ) set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" ) #set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wl,--no-undefined" ) -set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fdiagnostics-color=always" ) +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" ) + +if( CMAKE_COMPILER_IS_GNUCXX ) + execute_process( COMMAND ${CMAKE_C_COMPILER} -dumpversion + OUTPUT_VARIABLE GCC_VERSION ) + string( REGEX REPLACE "(\r?\n)+$" "" GCC_VERSION "${GCC_VERSION}" ) + if( GCC_VERSION VERSION_GREATER 4.9 OR GCC_VERSION VERSION_EQUAL 4.9 ) + message( STATUS "Found GNU g++ ${GCC_VERSION}, enabling colorized error messages." ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always" ) + endif() +endif() + cmake_policy( SET CMP0023 OLD )