diff options
author | Damjan Marion <damarion@cisco.com> | 2018-08-18 14:36:57 +0200 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2018-08-18 14:36:58 +0200 |
commit | 9f540ed348e3a3ef01951208211603a07fd574d6 (patch) | |
tree | b89b90f4d163c64271b5c34afbc895e801ab3385 /src/CMakeLists.txt | |
parent | 74dfaa665bd05e75bd44f5b18376dba053fef15f (diff) |
cmake: highlight warning and error messages
Change-Id: Id4b73368382b5e78c138987fe092429af5cb0afd
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r-- | src/CMakeLists.txt | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 13ae93d6e24..e0527543c94 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,6 +18,29 @@ project(vpp C) include(CheckCCompilerFlag) ############################################################################## +# Highlight WARNING and ERROR messages +############################################################################## +function(message) + list(GET ARGV 0 type) + string(ASCII 27 esc) + set(red "${esc}[1;31m") + set(yellow "${esc}[1;33m") + set(reset "${esc}[m") + if(type STREQUAL FATAL_ERROR OR type STREQUAL SEND_ERROR) + list(REMOVE_AT ARGV 0) + _message(${type} "${red}${ARGV}${reset}") + elseif(type STREQUAL WARNING) + list(REMOVE_AT ARGV 0) + _message(STATUS "${yellow}${ARGV}${reset}") + elseif(type STREQUAL STATUS) + list(REMOVE_AT ARGV 0) + _message(STATUS "${ARGV}") + else() + _message(${ARGV}) + endif() +endfunction() + +############################################################################## # CPU optimizations and multiarch support ############################################################################## if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*") |