From 7c0e76106bffdf33e854d4779ec090e0d556c606 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 7 Mar 2024 23:55:51 +0100 Subject: [PATCH 1/2] CMake cleanup for message() --- CMakeLists.txt | 27 ++++++++++++++------------- examples/grpc/CMakeLists.txt | 2 +- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cdb0f390a1..77dc55ba01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -301,7 +301,7 @@ function(install_windows_deps) set(VCPKG_TARGET_ARCHITECTURE ${ARCH} PARENT_SCOPE) - message("Installing build tools and dependencies...") + message(STATUS "Installing build tools and dependencies...") set(ENV{ARCH} ${ARCH}) execute_process( COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/setup-buildtools.cmd) @@ -309,6 +309,7 @@ function(install_windows_deps) ${CMAKE_CURRENT_SOURCE_DIR}/tools/vcpkg/scripts/buildsystems/vcpkg.cmake CACHE FILEPATH "") message( + STATUS "Make sure that vcpkg.cmake is set as the CMAKE_TOOLCHAIN_FILE at the START of the cmake build process! Can be command-line arg (cmake -DCMAKE_TOOLCHAIN_FILE=...) or set in your editor of choice." ) @@ -347,7 +348,7 @@ include(GNUInstallDirs) if(WITH_PROMETHEUS) find_package(prometheus-cpp CONFIG QUIET) if(NOT prometheus-cpp_FOUND) - message("Trying to use local prometheus-cpp from submodule") + message(STATUS "Trying to use local prometheus-cpp from submodule") if(EXISTS ${PROJECT_SOURCE_DIR}/third_party/prometheus-cpp/.git) set(SAVED_ENABLE_TESTING ${ENABLE_TESTING}) set(ENABLE_TESTING OFF) @@ -361,7 +362,7 @@ if(WITH_PROMETHEUS) "git submodule update --init --recursive") endif() else() - message("Using external prometheus-cpp") + message(STATUS "Using external prometheus-cpp") endif() endif() @@ -389,7 +390,7 @@ if(WITH_OTLP_GRPC OR WITH_OTLP_HTTP) endif() if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE)) - message(STATUS_FATAL "Windows dependency installation failed!") + message(FATAL_ERROR "Windows dependency installation failed!") endif() if(WIN32) include(${CMAKE_TOOLCHAIN_FILE}) @@ -485,7 +486,7 @@ endif() if(OTELCPP_MAINTAINER_MODE) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - message("Building with gcc in maintainer mode.") + message(STATUS "Building with gcc in maintainer mode.") add_compile_options(-Wall) add_compile_options(-Werror) @@ -493,7 +494,7 @@ if(OTELCPP_MAINTAINER_MODE) # Tested with GCC 9.4 on github. if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.4) - message("Building with additional warnings for gcc.") + message(STATUS "Building with additional warnings for gcc.") # Relaxed warnings @@ -518,7 +519,7 @@ if(OTELCPP_MAINTAINER_MODE) add_compile_options(-Wvla) endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - message("Building with clang in maintainer mode.") + message(STATUS "Building with clang in maintainer mode.") add_compile_options(-Wall) add_compile_options(-Werror) @@ -526,7 +527,7 @@ if(OTELCPP_MAINTAINER_MODE) # Tested with Clang 11.0 on github. if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0) - message("Building with additional warnings for clang.") + message(STATUS "Building with additional warnings for clang.") # Relaxed warnings add_compile_options(-Wno-error=unused-private-field) @@ -549,7 +550,7 @@ if(OTELCPP_MAINTAINER_MODE) add_compile_options(-Wold-style-cast) endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - message("Building with msvc in maintainer mode.") + message(STATUS "Building with msvc in maintainer mode.") add_compile_options(/WX) add_compile_options(/W4) @@ -619,8 +620,8 @@ if(BUILD_TESTING) if(GTEST_INCLUDE_DIRS) include_directories(SYSTEM ${GTEST_INCLUDE_DIRS}) endif() - message("GTEST_INCLUDE_DIRS = ${GTEST_INCLUDE_DIRS}") - message("GTEST_BOTH_LIBRARIES = ${GTEST_BOTH_LIBRARIES}") + message(STATUS "GTEST_INCLUDE_DIRS = ${GTEST_INCLUDE_DIRS}") + message(STATUS "GTEST_BOTH_LIBRARIES = ${GTEST_BOTH_LIBRARIES}") enable_testing() if(WITH_BENCHMARK) # Benchmark respects the CMAKE_PREFIX_PATH @@ -652,7 +653,7 @@ if(WITH_OPENTRACING) find_package(OpenTracing CONFIG QUIET) if(NOT OpenTracing_FOUND) set(OPENTRACING_DIR "third_party/opentracing-cpp") - message("Trying to use local ${OPENTRACING_DIR} from submodule") + message(STATUS "Trying to use local ${OPENTRACING_DIR} from submodule") if(EXISTS "${PROJECT_SOURCE_DIR}/${OPENTRACING_DIR}/.git") set(SAVED_BUILD_TESTING ${BUILD_TESTING}) set(BUILD_TESTING OFF) @@ -666,7 +667,7 @@ if(WITH_OPENTRACING) "git submodule update --init --recursive") endif() else() - message("Using external opentracing-cpp") + message(STATUS "Using external opentracing-cpp") endif() add_subdirectory(opentracing-shim) endif() diff --git a/examples/grpc/CMakeLists.txt b/examples/grpc/CMakeLists.txt index 938a009e0a..447f138a0f 100644 --- a/examples/grpc/CMakeLists.txt +++ b/examples/grpc/CMakeLists.txt @@ -5,7 +5,7 @@ get_filename_component(proto_file "./protos/messages.proto" ABSOLUTE) get_filename_component(proto_file_path "${proto_file}" PATH) -message("PATH:${proto_file_path}:${proto_file}") +message(STATUS "PATH:${proto_file_path}:${proto_file}") # Generated sources set(example_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/messages.pb.cc") set(example_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/messages.pb.h") From 63621d6134978e9e2002bbb2a3942eca29acf33c Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 7 Mar 2024 23:59:58 +0100 Subject: [PATCH 2/2] Format --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 77dc55ba01..9a1e372c4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -310,7 +310,7 @@ function(install_windows_deps) CACHE FILEPATH "") message( STATUS - "Make sure that vcpkg.cmake is set as the CMAKE_TOOLCHAIN_FILE at the START of the cmake build process! + "Make sure that vcpkg.cmake is set as the CMAKE_TOOLCHAIN_FILE at the START of the cmake build process! Can be command-line arg (cmake -DCMAKE_TOOLCHAIN_FILE=...) or set in your editor of choice." )