aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2020-02-12 19:47:29 +0100
committerGitHub <noreply@github.com>2020-02-12 19:47:29 +0100
commit949171a6e1f1a53aa60651b7e6d653cdefa97d2f (patch)
tree590b0b420c28359006005d7f7cca38016df3a507
parentf9bf35c0ae90735018519cc705a05683783847aa (diff)
parent5179435614ab9bf8493bdfdd852221b27cd6ea0e (diff)
downloadPROJ-949171a6e1f1a53aa60651b7e6d653cdefa97d2f.tar.gz
PROJ-949171a6e1f1a53aa60651b7e6d653cdefa97d2f.zip
Merge pull request #1923 from mwtoews/cmake-output
CMake: simplify message functions
-rw-r--r--CMakeLists.txt17
-rw-r--r--cmake/ProjMac.cmake6
-rw-r--r--cmake/ProjUtilities.cmake70
-rw-r--r--cmake/ProjVersion.cmake5
-rw-r--r--src/lib_proj.cmake14
5 files changed, 26 insertions, 86 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d3ccac86..76d2c407 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,8 +94,7 @@ set(CMAKE_MODULE_PATH ${PROJ_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
include(ProjUtilities)
-message(STATUS "")
-colormsg(_HIBLUE_ "Configuring PROJ:")
+message(STATUS "Configuring PROJ:")
################################################################################
#PROJ version information
@@ -141,9 +140,7 @@ if(DISABLE_TIFF)
message(WARNING "TIFF support has been disabled and will result in the inability to read some grids")
else()
find_package(TIFF REQUIRED)
- if(TIFF_FOUND)
- boost_report_value(TIFF_FOUND)
- else()
+ if(NOT TIFF_FOUND)
message(SEND_ERROR "libtiff dependency not found!")
endif()
add_definitions(-DTIFF_ENABLED)
@@ -156,9 +153,7 @@ endif()
option(ENABLE_CURL "Enable Curl support" ON)
if(ENABLE_CURL)
find_package(CURL REQUIRED)
- if(CURL_FOUND)
- boost_report_value(CURL_FOUND)
- else()
+ if(NOT CURL_FOUND)
message(SEND_ERROR "curl dependency not found!")
endif()
add_definitions(-DCURL_ENABLED)
@@ -212,7 +207,7 @@ endif()
# Put the libraries and binaries that get built into directories at the
# top of the build tree rather than in hard-to-find leaf
# directories. This simplifies manual testing and the use of the build
-# tree rather than installed Boost libraries.
+# tree rather than installed PROJ libraries.
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
@@ -246,9 +241,10 @@ if(DEFINED PROJ_TESTS)
set(BUILD_TESTING ${PROJ_TESTS})
endif()
-boost_report_value(BUILD_TESTING)
if(BUILD_TESTING)
include(ProjTest)
+else()
+ message(STATUS "Testing disabled")
endif()
################################################################################
@@ -256,7 +252,6 @@ endif()
################################################################################
include_directories(${PROJ_SOURCE_DIR}/src)
-message(STATUS "")
add_subdirectory(data)
add_subdirectory(include)
add_subdirectory(src)
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()
diff --git a/src/lib_proj.cmake b/src/lib_proj.cmake
index d14a48c6..177b077f 100644
--- a/src/lib_proj.cmake
+++ b/src/lib_proj.cmake
@@ -1,8 +1,8 @@
+message(STATUS "Configuring proj library:")
+
##############################################
### SWITCH BETWEEN STATIC OR SHARED LIBRARY###
##############################################
-colormsg(_HIBLUE_ "Configuring proj library:")
-message(STATUS "")
# default config, shared on unix and static on Windows
if(UNIX)
@@ -64,7 +64,7 @@ if(ENABLE_LTO)
set(ENABLE_LTO_METHOD "property")
endif()
endif()
-boost_report_value(ENABLE_LTO)
+print_variable(ENABLE_LTO)
##############################################
@@ -460,7 +460,7 @@ endif()
##############################################
# Core configuration summary
##############################################
-boost_report_value(PROJ_CORE_TARGET)
-boost_report_value(PROJ_CORE_TARGET_OUTPUT_NAME)
-boost_report_value(PROJ_LIBRARY_TYPE)
-boost_report_value(PROJ_LIBRARIES)
+print_variable(PROJ_CORE_TARGET)
+print_variable(PROJ_CORE_TARGET_OUTPUT_NAME)
+print_variable(PROJ_LIBRARY_TYPE)
+print_variable(PROJ_LIBRARIES)