@@ -36,11 +36,6 @@ project(opentelemetry-cpp)
3636# Mark variables as used so cmake doesn't complain about them
3737mark_as_advanced (CMAKE_TOOLCHAIN_FILE)
3838
39- # Note: CMAKE_FIND_PACKAGE_PREFER_CONFIG requires cmake 3.15. Prefer cmake
40- # CONFIG search mode to find dependencies. This is important to properly find
41- # protobuf versions 3.22.0 and above due to the abseil-cpp dependency.
42- set (CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE )
43-
4439# Don't use customized cmake modules if vcpkg is used to resolve dependence.
4540if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
4641 list (APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR} /cmake/modules/" )
@@ -79,10 +74,6 @@ if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
7974 CACHE STRING "" )
8075endif ()
8176
82- if (VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
83- include ("${VCPKG_CHAINLOAD_TOOLCHAIN_FILE} " )
84- endif ()
85-
8677option (WITH_ABI_VERSION_1 "ABI version 1" ON )
8778option (WITH_ABI_VERSION_2 "EXPERIMENTAL: ABI version 2 preview" OFF )
8879
@@ -501,6 +492,14 @@ if((NOT WITH_API_ONLY) AND USE_NLOHMANN_JSON)
501492 include ("${opentelemetry-cpp_SOURCE_DIR}/cmake/nlohmann-json.cmake" )
502493endif ()
503494
495+ #
496+ # Do we need OpenTracing ?
497+ #
498+
499+ if (WITH_OPENTRACING)
500+ include ("${opentelemetry-cpp_SOURCE_DIR}/cmake/opentracing-cpp.cmake" )
501+ endif ()
502+
504503if (OTELCPP_MAINTAINER_MODE)
505504 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
506505 message (STATUS "Building with gcc in maintainer mode." )
@@ -709,6 +708,10 @@ endif()
709708if (prometheus-cpp_FOUND)
710709 message (STATUS "prometheus-cpp: ${prometheus-cpp_VERSION}" )
711710endif ()
711+ if (WITH_OPENTRACING)
712+ message (
713+ STATUS "opentracing-cpp: ${OpenTracing_VERSION} (${OpenTracing_PROVIDER} )" )
714+ endif ()
712715message (STATUS "---------------------------------------------" )
713716
714717include ("${opentelemetry-cpp_SOURCE_DIR}/cmake/otel-install-functions.cmake" )
@@ -732,30 +735,6 @@ endif()
732735add_subdirectory (api)
733736
734737if (WITH_OPENTRACING)
735- find_package (OpenTracing CONFIG QUIET )
736- if (NOT OpenTracing_FOUND)
737- set (OPENTRACING_DIR "third_party/opentracing-cpp" )
738- message (STATUS "Trying to use local ${OPENTRACING_DIR} from submodule" )
739- if (EXISTS "${PROJECT_SOURCE_DIR} /${OPENTRACING_DIR} /.git" )
740- set (SAVED_BUILD_TESTING ${BUILD_TESTING} )
741- set (BUILD_TESTING OFF )
742- set (SAVED_CMAKE_CXX_INCLUDE_WHAT_YOU_USE
743- ${CMAKE_CXX_INCLUDE_WHAT_YOU_USE} )
744- set (CMAKE_CXX_INCLUDE_WHAT_YOU_USE "" )
745- add_subdirectory (${OPENTRACING_DIR} )
746- set (BUILD_TESTING ${SAVED_BUILD_TESTING} )
747- set (CMAKE_CXX_INCLUDE_WHAT_YOU_USE
748- ${SAVED_CMAKE_CXX_INCLUDE_WHAT_YOU_USE} )
749- else ()
750- message (
751- FATAL_ERROR
752- "\n opentracing-cpp package was not found. Please either provide it manually or clone with submodules. "
753- "To initialize, fetch and checkout any nested submodules, you can use the following command:\n "
754- "git submodule update --init --recursive" )
755- endif ()
756- else ()
757- message (STATUS "Using external opentracing-cpp" )
758- endif ()
759738 add_subdirectory (opentracing-shim)
760739endif ()
761740
0 commit comments