diff options
author | Elvis Angelaccio <elvis.angelaccio@kde.org> | 2016-12-29 12:18:55 +0100 |
---|---|---|
committer | Elvis Angelaccio <elvis.angelaccio@kde.org> | 2016-12-29 12:18:55 +0100 |
commit | dc525a42ae70a68d67aa49d6453d4b6de4ecb561 (patch) | |
tree | e1a77e90805e753ce95e9a2b878aede7fd3a8ae0 | |
parent | c0a047a20591a50d87899d7869fea55268156f79 (diff) | |
download | extra-cmake-modules-dc525a42ae70a68d67aa49d6453d4b6de4ecb561.tar.gz extra-cmake-modules-dc525a42ae70a68d67aa49d6453d4b6de4ecb561.tar.bz2 |
Enable colored warnings in ninja's output
Summary:
Colored compiler warnings in ninja output only work with the
`-fdiagnostics-color=always` flag.
See https://github.com/ninja-build/ninja/issues/814 for a rationale.
This commit adds such flag in ecm for gcc >= 4.9 and clang >= 3.5,
and only if the CMAKE_GENERATOR is Ninja.
Test Plan: ninja+gcc and ninja+clang now show nice colored compiler warnings.
Reviewers: #frameworks
Differential Revision: https://phabricator.kde.org/D3733
-rw-r--r-- | kde-modules/KDECompilerSettings.cmake | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake index 8b458f55..24eea3a7 100644 --- a/kde-modules/KDECompilerSettings.cmake +++ b/kde-modules/KDECompilerSettings.cmake @@ -458,5 +458,13 @@ if (MINGW AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--export-all-symbols") endif() +if (CMAKE_GENERATOR STREQUAL "Ninja" AND + ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) OR + (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5))) + # Force colored warnings in Ninja's output, if the compiler has -fdiagnostics-color support. + # Rationale in https://github.com/ninja-build/ninja/issues/814 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always") +endif() + include("${ECM_MODULE_DIR}/ECMEnableSanitizers.cmake") include("${ECM_MODULE_DIR}/ECMCoverageOption.cmake") |