Commit 3f67955f authored by PRUVOST Florent's avatar PRUVOST Florent
Browse files

add an option to colorize output messages

parent ee35fe66
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# @copyright (c) 2009-2014 The University of Tennessee and The University # @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation. # of Tennessee Research Foundation.
# All rights reserved. # All rights reserved.
# @copyright (c) 2012-2014 Inria. All rights reserved. # @copyright (c) 2012-2018 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. # @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
# #
### ###
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# Univ. of California Berkeley, # Univ. of California Berkeley,
# Univ. of Colorado Denver. # Univ. of Colorado Denver.
# #
# @version 0.9.0 # @version 1.0.0
# @author Cedric Castagnede # @author Cedric Castagnede
# @author Emmanuel Agullo # @author Emmanuel Agullo
# @author Mathieu Faverge # @author Mathieu Faverge
...@@ -28,51 +28,51 @@ ...@@ -28,51 +28,51 @@
### ###
# Set some colors # Set some colors
#if(NOT WIN32) if(NOT WIN32)
# string(ASCII 27 Esc) string(ASCII 27 Esc)
# set(ColourReset "${Esc}[m") set(ColourReset "${Esc}[m")
# set(ColourBold "${Esc}[1m") set(ColourBold "${Esc}[1m")
# set(Red "${Esc}[31m") set(Red "${Esc}[31m")
# set(Green "${Esc}[32m") set(Green "${Esc}[32m")
# set(Yellow "${Esc}[33m") set(Yellow "${Esc}[33m")
# set(Blue "${Esc}[34m") set(Blue "${Esc}[34m")
# set(Magenta "${Esc}[35m") set(Magenta "${Esc}[35m")
# set(Cyan "${Esc}[36m") set(Cyan "${Esc}[36m")
# set(White "${Esc}[37m") set(White "${Esc}[37m")
# set(BoldRed "${Esc}[1;31m") set(BoldRed "${Esc}[1;31m")
# set(BoldGreen "${Esc}[1;32m") set(BoldGreen "${Esc}[1;32m")
# set(BoldYellow "${Esc}[1;33m") set(BoldYellow "${Esc}[1;33m")
# set(BoldBlue "${Esc}[1;34m") set(BoldBlue "${Esc}[1;34m")
# set(BoldMagenta "${Esc}[1;35m") set(BoldMagenta "${Esc}[1;35m")
# set(BoldCyan "${Esc}[1;36m") set(BoldCyan "${Esc}[1;36m")
# set(BoldWhite "${Esc}[1;37m") set(BoldWhite "${Esc}[1;37m")
#endif()
# Colorize cmake messages during configure # Colorize cmake messages during configure
function(message) function(message)
list(GET ARGV 0 MessageType) list(GET ARGV 0 MessageType)
if(MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR) if(MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR)
list(REMOVE_AT ARGV 0) list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}") string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${BoldRed}${ARGV_STR}${ColourReset}") _message(${MessageType} "${BoldRed}${ARGV_STR}${ColourReset}")
elseif(MessageType STREQUAL WARNING) elseif(MessageType STREQUAL WARNING)
list(REMOVE_AT ARGV 0) list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}") string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${BoldYellow}${ARGV_STR}${ColourReset}") _message(${MessageType} "${BoldYellow}${ARGV_STR}${ColourReset}")
elseif(MessageType STREQUAL AUTHOR_WARNING) elseif(MessageType STREQUAL AUTHOR_WARNING)
list(REMOVE_AT ARGV 0) list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}") string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${BoldCyan}${ARGV_STR}${ColourReset}") _message(${MessageType} "${BoldCyan}${ARGV_STR}${ColourReset}")
elseif(MessageType STREQUAL STATUS) elseif(MessageType STREQUAL STATUS)
list(REMOVE_AT ARGV 0) list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}") string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${Green}${ARGV_STR}${ColourReset}") _message(${MessageType} "${Green}${ARGV_STR}${ColourReset}")
else() else()
string (REPLACE ";" " " ARGV_STR "${ARGV}") string (REPLACE ";" " " ARGV_STR "${ARGV}")
string (REPLACE "${Esc}[1 " "${Esc}[1;" ARGV_STR "${ARGV_STR}") string (REPLACE "${Esc}[1 " "${Esc}[1;" ARGV_STR "${ARGV_STR}")
_message("${ARGV_STR}") _message("${ARGV_STR}")
endif() endif()
endfunction() endfunction()
endif()
## ##
## @end file ColorizeMessage.cmake ## @end file ColorizeMessage.cmake
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# @copyright (c) 2009-2014 The University of Tennessee and The University # @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation. # of Tennessee Research Foundation.
# All rights reserved. # All rights reserved.
# @copyright (c) 2012-2016 Inria. All rights reserved. # @copyright (c) 2012-2018 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. # @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
# #
### ###
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# Univ. of California Berkeley, # Univ. of California Berkeley,
# Univ. of Colorado Denver. # Univ. of Colorado Denver.
# #
# @version 0.9.0 # @version 1.0.0
# @author Cedric Castagnede # @author Cedric Castagnede
# @author Emmanuel Agullo # @author Emmanuel Agullo
# @author Mathieu Faverge # @author Mathieu Faverge
...@@ -27,14 +27,25 @@ ...@@ -27,14 +27,25 @@
# #
### ###
# Global Morse options
option(MORSE_ENABLE_WARNING "Enable warning messages" OFF)
option(MORSE_ENABLE_COVERAGE "Enable flags for coverage test" OFF)
option(MORSE_ENABLE_COLOR_MESSAGE "Enable colors in messages" OFF)
#option(MORSE_VERBOSE_FIND_PACKAGE "Add additional messages concerning packages not found" OFF)
#message(STATUS "MORSE_VERBOSE_FIND_PACKAGE is set to OFF, turn it ON to get"
# " information about packages not found")
# This include is required to check symbols of libs in the main CMakeLists.txt # This include is required to check symbols of libs in the main CMakeLists.txt
include(CheckFunctionExists) include(CheckFunctionExists)
# This include is required to check defines in headers # This include is required to check defines in headers
include(CheckIncludeFiles) include(CheckIncludeFiles)
# To colorize messages if (MORSE_ENABLE_COLOR_MESSAGE)
#include(ColorizeMessage) # colorize messages
include(ColorizeMessage)
endif()
# To find headers and libs # To find headers and libs
include(FindHeadersAndLibs) include(FindHeadersAndLibs)
...@@ -52,12 +63,6 @@ include(Ressources) ...@@ -52,12 +63,6 @@ include(Ressources)
# Add the path where we handle our FindFOO.cmake to seek for liraries # Add the path where we handle our FindFOO.cmake to seek for liraries
list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find) list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find)
option(MORSE_ENABLE_WARNING "Enable warning messages" OFF)
option(MORSE_ENABLE_COVERAGE "Enable flags for coverage test" OFF)
#option(MORSE_VERBOSE_FIND_PACKAGE "Add additional messages concerning packages not found" OFF)
#message(STATUS "MORSE_VERBOSE_FIND_PACKAGE is set to OFF, turn it ON to get"
# " information about packages not found")
## ##
## @end file MorseInit.cmake ## @end file MorseInit.cmake
## ##
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment