Debian Codegraph @

CMakeModules/CMakeColors.cmake

raw
1 # === This file is part of Calamares - <https://calamares.io> ===
2 #
3 # SPDX-FileCopyrightText: 2014 Teo Mrnjavac <[email protected]>
4 # SPDX-FileCopyrightText: 2014 Kevin Kofler <[email protected]>
5 # SPDX-FileCopyrightText: 2017 Adriaan de Groot <[email protected]>
6 # SPDX-License-Identifier: BSD-2-Clause
7 #
8 ###
9 #
10 # Defines a handful of strings that, with normal xterm handling,
11 # will change colors in the output, so it's nicer to read.
12 if(NOT WIN32)
13 set(_use_color ON)
14 if("0" STREQUAL "$ENV{CLICOLOR}")
15 set(_use_color OFF)
16 endif()
17 if("0" STREQUAL "$ENV{CLICOLOR_FORCE}")
18 set(_use_color OFF)
19 endif()
20 if(NOT CMAKE_COLOR_MAKEFILE)
21 set(_use_color OFF)
22 endif()
23
24 if(_use_color)
25 string(ASCII 27 Esc)
26 set(ColorReset "${Esc}[m")
27 set(ColorBold "${Esc}[1m")
28 set(Red "${Esc}[31m")
29 set(Green "${Esc}[32m")
30 set(Yellow "${Esc}[33m")
31 set(Blue "${Esc}[34m")
32 set(Magenta "${Esc}[35m")
33 set(Cyan "${Esc}[36m")
34 set(White "${Esc}[37m")
35 set(BoldRed "${Esc}[1;31m")
36 set(BoldGreen "${Esc}[1;32m")
37 set(BoldYellow "${Esc}[1;33m")
38 set(BoldBlue "${Esc}[1;34m")
39 set(BoldMagenta "${Esc}[1;35m")
40 set(BoldCyan "${Esc}[1;36m")
41 set(BoldWhite "${Esc}[1;37m")
42 endif()
43 endif()