diff options
author | Damjan Marion <damarion@cisco.com> | 2018-09-01 15:17:02 +0200 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2018-09-01 20:07:48 +0200 |
commit | cc4eb994e4a8a8c4a32beb64a9928c657e9cf60e (patch) | |
tree | 480193c7e10097afd187b99f998f952f5e8a9368 | |
parent | ad1e1c5b2d5134e88456a2078f38fa207599171f (diff) |
cmake: respect TERM
Change-Id: I8e2dd1902f57ee173dd266743b46f5602548a4c1
Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r-- | src/cmake/message.cmake | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/cmake/message.cmake b/src/cmake/message.cmake index fb740fdf7d9..c1e16bf89a9 100644 --- a/src/cmake/message.cmake +++ b/src/cmake/message.cmake @@ -16,10 +16,12 @@ ############################################################################## 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("$ENV{TERM}" STREQUAL "xterm-256color") + string(ASCII 27 esc) + set(red "${esc}[1;31m") + set(yellow "${esc}[1;33m") + set(reset "${esc}[m") + endif() if(type STREQUAL FATAL_ERROR OR type STREQUAL SEND_ERROR) list(REMOVE_AT ARGV 0) _message(${type} "${red}${ARGV}${reset}") @@ -38,10 +40,11 @@ endfunction() # aligned config output ############################################################################## function(pr desc val) - string(ASCII 27 esc) - set(reset "${esc}[m") - set(cyan "${esc}[36m") - + if("$ENV{TERM}" STREQUAL "xterm-256color") + string(ASCII 27 esc) + set(reset "${esc}[m") + set(cyan "${esc}[36m") + endif() string(LENGTH ${desc} len) while (len LESS 20) set (desc "${desc} ") |