From 77a2b036cb27c743be559d9125d1b6cc01ff2176 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Mon, 14 Feb 2022 08:38:15 +0100 Subject: [PATCH] CMake: Add mode to all cmake message() statements Pure status messages shall be printed to stdout. But without mode, they were printed to stderr. --- CMakeLists.txt | 2 +- autotest/CMakeLists.txt | 8 ++++---- cmake/helpers/CheckDependentLibraries.cmake | 4 ++-- gdal.cmake | 2 +- scripts/install_bash_completions.cmake.in | 4 ++-- swig/csharp/CMakeLists.txt | 11 +++-------- swig/java/build_java_doc.cmake | 2 +- swig/python/CMakeLists.txt | 4 ++-- 8 files changed, 16 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ae3193448f0..6e5480f175e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,7 +140,7 @@ if (APPLE) PROPERTY TYPE) if (NOT result) set(CMAKE_FIND_FRAMEWORK LAST) - message("Setting CMAKE_FIND_FRAMEWORK=${CMAKE_FIND_FRAMEWORK}") + message(STATUS "Setting CMAKE_FIND_FRAMEWORK=${CMAKE_FIND_FRAMEWORK}") endif () endif () diff --git a/autotest/CMakeLists.txt b/autotest/CMakeLists.txt index a107bac4e08a..22a3bf507ad6 100644 --- a/autotest/CMakeLists.txt +++ b/autotest/CMakeLists.txt @@ -52,14 +52,14 @@ if (Python_Interpreter_FOUND) RESULT res SYMBOLIC) if (NOT res EQUAL 0) - message("Copying content of ${source} to ${destination}") + message(STATUS "Copying content of ${source} to ${destination}") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${source} ${destination}) endif () else () if (NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${source} ${destination}) else () - message("Copying content of ${source} to ${destination}") + message(STATUS "Copying content of ${source} to ${destination}") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${source} ${destination}) endif () endif () @@ -69,7 +69,7 @@ if (Python_Interpreter_FOUND) # Needed for a autotest/osr test symlink_or_copy(${CMAKE_CURRENT_SOURCE_DIR}/cpp/data ${CMAKE_CURRENT_BINARY_DIR}/cpp/data) if (SKIP_COPYING_AUTOTEST_SUBDIRS) - message("Skipping copying ${CMAKE_CURRENT_SOURCE_DIR}/pymod") + message(STATUS "Skipping copying ${CMAKE_CURRENT_SOURCE_DIR}/pymod") else () symlink_or_copy(${CMAKE_CURRENT_SOURCE_DIR}/pymod ${CMAKE_CURRENT_BINARY_DIR}/pymod) endif () @@ -85,7 +85,7 @@ if (Python_Interpreter_FOUND) pyscripts utilities) if (SKIP_COPYING_AUTOTEST_SUBDIRS) - message("Skipping copying ${CMAKE_CURRENT_SOURCE_DIR}/${tgt}") + message(STATUS "Skipping copying ${CMAKE_CURRENT_SOURCE_DIR}/${tgt}") else () symlink_or_copy(${CMAKE_CURRENT_SOURCE_DIR}/${tgt} ${CMAKE_CURRENT_BINARY_DIR}/${tgt}) endif () diff --git a/cmake/helpers/CheckDependentLibraries.cmake b/cmake/helpers/CheckDependentLibraries.cmake index 0c1538288407..ef887abefd2c 100644 --- a/cmake/helpers/CheckDependentLibraries.cmake +++ b/cmake/helpers/CheckDependentLibraries.cmake @@ -133,7 +133,7 @@ macro (gdal_check_package name purpose) elseif (NOT GDAL_USE_EXTERNAL_LIBS) set(_gcpp_status OFF) if (HAVE_${key} AND NOT GDAL_USE_${key}) - message( + message(STATUS "${key} has been found, but is disabled due to GDAL_USE_EXTERNAL_LIBS=OFF. Enable it by setting GDAL_USE_${key}=ON" ) endif () @@ -141,7 +141,7 @@ macro (gdal_check_package name purpose) if (_gcpp_status AND _GCP_DISABLED_BY_DEFAULT) set(_gcpp_status OFF) if (HAVE_${key} AND NOT GDAL_USE_${key}) - message("${key} has been found, but is disabled by default. Enable it by setting GDAL_USE_${key}=ON") + message(STATUS "${key} has been found, but is disabled by default. Enable it by setting GDAL_USE_${key}=ON") endif () endif () cmake_dependent_option(GDAL_USE_${key} "Set ON to use ${key}" ${_gcpp_status} "HAVE_${key}" OFF) diff --git a/gdal.cmake b/gdal.cmake index f6d9a527f68e..dde4adf302e8 100644 --- a/gdal.cmake +++ b/gdal.cmake @@ -178,7 +178,7 @@ else () endif () -# message("GDAL_C_WARNING_FLAGS: ${GDAL_C_WARNING_FLAGS}") message("GDAL_CXX_WARNING_FLAGS: ${GDAL_CXX_WARNING_FLAGS}") +# message(STATUS "GDAL_C_WARNING_FLAGS: ${GDAL_C_WARNING_FLAGS}") message(STATUS "GDAL_CXX_WARNING_FLAGS: ${GDAL_CXX_WARNING_FLAGS}") if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") check_cxx_compiler_flag(-fno-finite-math-only HAVE_FLAG_NO_FINITE_MATH_ONLY) diff --git a/scripts/install_bash_completions.cmake.in b/scripts/install_bash_completions.cmake.in index 89fbff9fd4b8..e172c890900e 100644 --- a/scripts/install_bash_completions.cmake.in +++ b/scripts/install_bash_completions.cmake.in @@ -41,11 +41,11 @@ set(PROGRAMS set(INSTALL_DIR "$ENV{DESTDIR}@CMAKE_INSTALL_PREFIX@/@BASH_COMPLETIONS_DIR@") file(MAKE_DIRECTORY "${INSTALL_DIR}") -message("Installing ${INSTALL_DIR}/gdalinfo") +message(STATUS "Installing ${INSTALL_DIR}/gdalinfo") configure_file("@CMAKE_CURRENT_SOURCE_DIR@/gdal-bash-completion.sh" "${INSTALL_DIR}/gdalinfo" COPYONLY) foreach (program IN LISTS PROGRAMS) - message("Installing ${INSTALL_DIR}/${program}") + message(STATUS "Installing ${INSTALL_DIR}/${program}") if (NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "gdalinfo" "${INSTALL_DIR}/${program}") else () diff --git a/swig/csharp/CMakeLists.txt b/swig/csharp/CMakeLists.txt index 13c39e91ae21..07da8e0cc3b2 100644 --- a/swig/csharp/CMakeLists.txt +++ b/swig/csharp/CMakeLists.txt @@ -184,7 +184,7 @@ function (gdal_csharp_dll) else () if (CMAKE_VERBOSE_MAKEFILE) - message("BUILDING : " ${_CSHARP_TARGET} " : " ${CSHARP_COMPILER} ${CSC_OPTIONS} /out:${_CSHARP_TARGET}) + message(STATUS "BUILDING : " ${_CSHARP_TARGET} " : " ${CSHARP_COMPILER} ${CSC_OPTIONS} /out:${_CSHARP_TARGET}) endif () add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_CSHARP_TARGET} @@ -362,13 +362,8 @@ function (gdal_build_csharp_sample) else () if (CMAKE_VERBOSE_MAKEFILE) message( - "BUILDING : " - ${_GBCS_OUTPUT} - " : " - ${CSHARP_COMPILER} - ${CSC_OPTIONS} - /out:${_GBCS_OUTPUT_NATIVE} - ${SOURCE_NATIVE}) + STATUS + "BUILDING : ${_GBCS_OUTPUT} : ${CSHARP_COMPILER} ${CSC_OPTIONS} /out:${_GBCS_OUTPUT_NATIVE} ${SOURCE_NATIVE}") endif () add_custom_command( OUTPUT ${OUTPUT_FILENAME} diff --git a/swig/java/build_java_doc.cmake b/swig/java/build_java_doc.cmake index 75721a226a77..200cb6a49073 100644 --- a/swig/java/build_java_doc.cmake +++ b/swig/java/build_java_doc.cmake @@ -1,4 +1,4 @@ -message("Building javadoc") +message(STATUS "Building javadoc") file(GLOB_RECURSE SOURCE_JAVA_FILES RELATIVE "${BUILD_DIR}" "${BUILD_DIR}/org/*.java") diff --git a/swig/python/CMakeLists.txt b/swig/python/CMakeLists.txt index 4cf656a3fe19..feadfd0a483c 100644 --- a/swig/python/CMakeLists.txt +++ b/swig/python/CMakeLists.txt @@ -123,14 +123,14 @@ function (symlink_or_copy source destination) RESULT res SYMBOLIC) if (NOT res EQUAL 0) - message("Copying content of ${source} to ${destination}") + message(STATUS "Copying content of ${source} to ${destination}") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${source} ${destination}) endif () else () if (NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${source} ${destination}) else () - message("Copying content of ${source} to ${destination}") + message(STATUS "Copying content of ${source} to ${destination}") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${source} ${destination}) endif () endif ()