1 # https://stackoverflow.com/a/19578320
2 # Some color defintions
3 if ( NOT "${PRINT_OPTION_SUPPRESS_COLOR}" )
6 set( COLOR_RESET "${ESC}[m" )
7 set( COLOR_BOLD "${ESC}[1m" )
8 set( RED "${ESC}[31m" )
9 set( GREEN "${ESC}[32m" )
10 set( YELLOW "${ESC}[33m" )
11 set( BLUE "${ESC}[34m" )
12 set( MAGENTA "${ESC}[35m" )
13 set( CYAN "${ESC}[36m" )
14 set( WHITE "${ESC}[37m" )
15 set( BOLD_RED "${ESC}[1;31m" )
16 set( BOLD_GREEN "${ESC}[1;32m" )
17 set( BOLD_YELLOW "${ESC}[1;33m" )
18 set( BOLD_BLUE "${ESC}[1;34m" )
19 set( BOLD_MAGENTA "${ESC}[1;35m" )
20 set( BOLD_CYAN "${ESC}[1;36m" )
21 set( BOLD_WHITE "${ESC}[1;37m" )
25 function( print_option )
26 set( OPTION ${ARGV0} )
27 set( JUSTIFY ${ARGV1} )
29 if ( ${ARGC} GREATER_EQUAL 3 )
30 set( ALT_COLOR ${ARGV2} )
33 if ( DEFINED ALT_COLOR )
34 set( OPT_COLOR ${ALT_COLOR} )
36 set( OPT_COLOR ${RED} )
38 set( OPT_COLOR ${GREEN} )
42 set( OPTION_STR "${OPTION}" )
43 string( LENGTH ${OPTION_STR} OPTION_STR_LEN )
44 math( EXPR N_JUSTIFY "${JUSTIFY} - ${OPTION_STR_LEN}" )
46 if ( ${N_JUSTIFY} LESS 1 )
50 string( REPEAT " " ${N_JUSTIFY} JUSTIFY_WHITESPACE )
52 message( STATUS "${OPTION_STR}${JUSTIFY_WHITESPACE} : ${OPT_COLOR}${${OPTION}}${COLOR_RESET}" )