diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2020-02-12 19:47:29 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-12 19:47:29 +0100 |
| commit | 949171a6e1f1a53aa60651b7e6d653cdefa97d2f (patch) | |
| tree | 590b0b420c28359006005d7f7cca38016df3a507 /cmake | |
| parent | f9bf35c0ae90735018519cc705a05683783847aa (diff) | |
| parent | 5179435614ab9bf8493bdfdd852221b27cd6ea0e (diff) | |
| download | PROJ-949171a6e1f1a53aa60651b7e6d653cdefa97d2f.tar.gz PROJ-949171a6e1f1a53aa60651b7e6d653cdefa97d2f.zip | |
Merge pull request #1923 from mwtoews/cmake-output
CMake: simplify message functions
Diffstat (limited to 'cmake')
| -rw-r--r-- | cmake/ProjMac.cmake | 6 | ||||
| -rw-r--r-- | cmake/ProjUtilities.cmake | 70 | ||||
| -rw-r--r-- | cmake/ProjVersion.cmake | 5 |
3 files changed, 13 insertions, 68 deletions
diff --git a/cmake/ProjMac.cmake b/cmake/ProjMac.cmake index 0de87941..d566ef0e 100644 --- a/cmake/ProjMac.cmake +++ b/cmake/ProjMac.cmake @@ -23,7 +23,7 @@ if(APPLE) "if set to ON, build a library framework and application bundle, \ otherwise install classical UNIX bin/lib" OFF) set(DEFAULT_BINDIR ${BUNDLEDIR}) - boost_report_value(BUNDLEDIR) - boost_report_value(PROJ_INSTALL_NAME_DIR) - boost_report_value(FRAMEWORKDIR) + print_variable(BUNDLEDIR) + print_variable(PROJ_INSTALL_NAME_DIR) + print_variable(FRAMEWORKDIR) endif() diff --git a/cmake/ProjUtilities.cmake b/cmake/ProjUtilities.cmake index 447276ff..6f43edb5 100644 --- a/cmake/ProjUtilities.cmake +++ b/cmake/ProjUtilities.cmake @@ -13,78 +13,24 @@ ################################################################################ # Macros in this module: # +# print_variable # proj_target_output_name: # ################################################################################ # -# A big shout out to the cmake gurus @ compiz -# - -function(colormsg) - string(ASCII 27 _escape) - set(WHITE "29") - set(GRAY "30") - set(RED "31") - set(GREEN "32") - set(YELLOW "33") - set(BLUE "34") - set(MAG "35") - set(CYAN "36") - - foreach(color WHITE GRAY RED GREEN YELLOW BLUE MAG CYAN) - set(HI${color} "1\;${${color}}") - set(LO${color} "2\;${${color}}") - set(_${color}_ "4\;${${color}}") - set(_HI${color}_ "1\;4\;${${color}}") - set(_LO${color}_ "2\;4\;${${color}}") - endforeach() - - set(str "") - set(coloron FALSE) - foreach(arg ${ARGV}) - if(NOT ${${arg}} STREQUAL "") - if(CMAKE_COLOR_MAKEFILE) - set(str "${str}${_escape}[${${arg}}m") - set(coloron TRUE) - endif() - else() - set(str "${str}${arg}") - if(coloron) - set(str "${str}${_escape}[0m") - set(coloron FALSE) - endif() - set(str "${str} ") - endif() - endforeach() - message(STATUS ${str}) -endfunction() - -# colormsg("Colors:" -# WHITE "white" GRAY "gray" GREEN "green" -# RED "red" YELLOW "yellow" BLUE "blue" MAG "mag" CYAN "cyan" -# _WHITE_ "white" _GRAY_ "gray" _GREEN_ "green" -# _RED_ "red" _YELLOW_ "yellow" _BLUE_ "blue" _MAG_ "mag" _CYAN_ "cyan" -# _HIWHITE_ "white" _HIGRAY_ "gray" _HIGREEN_ "green" -# _HIRED_ "red" _HIYELLOW_ "yellow" _HIBLUE_ "blue" _HIMAG_ "mag" -# _HICYAN_ "cyan" HIWHITE "white" HIGRAY "gray" HIGREEN "green" -# HIRED "red" HIYELLOW "yellow" HIBLUE "blue" HIMAG "mag" HICYAN "cyan" -# "right?") - -# # pretty-prints the value of a variable so that the # equals signs align # -function(boost_report_value NAME) +function(print_variable NAME) string(LENGTH "${NAME}" varlen) - # LOG - #message(STATUS "boost_report_value: NAME=${NAME} (${varlen})") - #message(STATUS "boost_report_value: \${NAME}=${${NAME}}") - math(EXPR padding_len 40-${varlen}) - string(SUBSTRING " " - 0 ${padding_len} varpadding) - colormsg("${NAME}${varpadding} = ${${NAME}}") + math(EXPR padding_len 30-${varlen}) + if(${padding_len} GREATER 0) + string(SUBSTRING " " + 0 ${padding_len} varpadding) + endif() + message(STATUS "${NAME}${varpadding} = ${${NAME}}") endfunction() # diff --git a/cmake/ProjVersion.cmake b/cmake/ProjVersion.cmake index d64795a8..deeaa2b4 100644 --- a/cmake/ProjVersion.cmake +++ b/cmake/ProjVersion.cmake @@ -45,9 +45,8 @@ ${${PROJECT_NAME}_VERSION_PATCH}") ${${PROJECT_NAME}_VERSION_MINOR}") endif() - message(STATUS "") - boost_report_value(${PROJECT_NAME}_VERSION) + print_variable(${PROJECT_NAME}_VERSION) if(WIN32) - boost_report_value(${PROJECT_NAME}_ABI_VERSION) + print_variable(${PROJECT_NAME}_ABI_VERSION) endif() endmacro() |
