From dc40dec212c209ad179f9f22762d9f7df9c336ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Fri, 18 Oct 2019 19:29:04 +0200 Subject: [PATCH] Add colors to cmake output --- CMakeLists.txt | 20 ++++++++++++++++++++ version/CMakeLists.txt | 25 +++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5dca072..4412d17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,25 @@ project(gds-render) +if(NOT WIN32) + string(ASCII 27 Esc) + set(ColorReset "${Esc}[m") + set(ColorBold "${Esc}[1m") + set(Red "${Esc}[31m") + set(Green "${Esc}[32m") + set(Yellow "${Esc}[33m") + set(Blue "${Esc}[34m") + set(Magenta "${Esc}[35m") + set(Cyan "${Esc}[36m") + set(White "${Esc}[37m") + set(BoldRed "${Esc}[1;31m") + set(BoldGreen "${Esc}[1;32m") + set(BoldYellow "${Esc}[1;33m") + set(BoldBlue "${Esc}[1;34m") + set(BoldMagenta "${Esc}[1;35m") + set(BoldCyan "${Esc}[1;36m") + set(BoldWhite "${Esc}[1;37m") +endif() + cmake_minimum_required(VERSION 2.8) find_package(PkgConfig REQUIRED) pkg_search_module(GLIB REQUIRED glib-2.0) diff --git a/version/CMakeLists.txt b/version/CMakeLists.txt index 5bdb64c..92469be 100644 --- a/version/CMakeLists.txt +++ b/version/CMakeLists.txt @@ -1,4 +1,25 @@ project(libversion) + +if(NOT WIN32) + string(ASCII 27 Esc) + set(ColorReset "${Esc}[m") + set(ColorBold "${Esc}[1m") + set(Red "${Esc}[31m") + set(Green "${Esc}[32m") + set(Yellow "${Esc}[33m") + set(Blue "${Esc}[34m") + set(Magenta "${Esc}[35m") + set(Cyan "${Esc}[36m") + set(White "${Esc}[37m") + set(BoldRed "${Esc}[1;31m") + set(BoldGreen "${Esc}[1;32m") + set(BoldYellow "${Esc}[1;33m") + set(BoldBlue "${Esc}[1;34m") + set(BoldMagenta "${Esc}[1;35m") + set(BoldCyan "${Esc}[1;36m") + set(BoldWhite "${Esc}[1;37m") +endif() + add_library(version STATIC "version.c") execute_process(COMMAND bash ./generate-version-string.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} @@ -6,6 +27,6 @@ execute_process(COMMAND bash ./generate-version-string.sh execute_process(COMMAND bash ./generate-git-commit-string.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT) -message("Commit: ${GIT_COMMIT}") -message("Version: ${GIT_VER}") +message("${BoldGreen}Commit: ${GIT_COMMIT}") +message("Version: ${GIT_VER}${ColorReset}") target_compile_definitions(version PRIVATE PROJECT_GIT_VERSION=${GIT_VER} PROJECT_GIT_COMMIT=${GIT_COMMIT})