Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUILD] CMake cleanup for message() #2582

Merged
merged 2 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,16 @@ 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)
set(CMAKE_TOOLCHAIN_FILE
${CMAKE_CURRENT_SOURCE_DIR}/tools/vcpkg/scripts/buildsystems/vcpkg.cmake
CACHE FILEPATH "")
message(
"Make sure that vcpkg.cmake is set as the CMAKE_TOOLCHAIN_FILE at the START of the cmake build process!
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."
)

Expand Down Expand Up @@ -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)
Expand All @@ -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()

Expand Down Expand Up @@ -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})
Expand Down Expand Up @@ -485,15 +486,15 @@ 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)
add_compile_options(-Wextra)

# 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

Expand All @@ -518,15 +519,15 @@ 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)
add_compile_options(-Wextra)

# 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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion examples/grpc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down