@@ -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
@@ -497,6 +488,14 @@ if((NOT WITH_API_ONLY) AND USE_NLOHMANN_JSON)
497488 include ("${opentelemetry-cpp_SOURCE_DIR}/cmake/nlohmann-json.cmake" )
498489endif ()
499490
491+ #
492+ # Do we need OpenTracing ?
493+ #
494+
495+ if (WITH_OPENTRACING)
496+ include ("${opentelemetry-cpp_SOURCE_DIR}/cmake/opentracing-cpp.cmake" )
497+ endif ()
498+
500499if (OTELCPP_MAINTAINER_MODE)
501500 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
502501 message (STATUS "Building with gcc in maintainer mode." )
@@ -703,6 +702,10 @@ endif()
703702if (prometheus-cpp_FOUND)
704703 message (STATUS "prometheus-cpp: ${prometheus-cpp_VERSION}" )
705704endif ()
705+ if (WITH_OPENTRACING)
706+ message (
707+ STATUS "opentracing-cpp: ${OpenTracing_VERSION} (${OpenTracing_PROVIDER} )" )
708+ endif ()
706709message (STATUS "---------------------------------------------" )
707710
708711include ("${opentelemetry-cpp_SOURCE_DIR}/cmake/otel-install-functions.cmake" )
@@ -726,30 +729,6 @@ endif()
726729add_subdirectory (api)
727730
728731if (WITH_OPENTRACING)
729- find_package (OpenTracing CONFIG QUIET )
730- if (NOT OpenTracing_FOUND)
731- set (OPENTRACING_DIR "third_party/opentracing-cpp" )
732- message (STATUS "Trying to use local ${OPENTRACING_DIR} from submodule" )
733- if (EXISTS "${PROJECT_SOURCE_DIR} /${OPENTRACING_DIR} /.git" )
734- set (SAVED_BUILD_TESTING ${BUILD_TESTING} )
735- set (BUILD_TESTING OFF )
736- set (SAVED_CMAKE_CXX_INCLUDE_WHAT_YOU_USE
737- ${CMAKE_CXX_INCLUDE_WHAT_YOU_USE} )
738- set (CMAKE_CXX_INCLUDE_WHAT_YOU_USE "" )
739- add_subdirectory (${OPENTRACING_DIR} )
740- set (BUILD_TESTING ${SAVED_BUILD_TESTING} )
741- set (CMAKE_CXX_INCLUDE_WHAT_YOU_USE
742- ${SAVED_CMAKE_CXX_INCLUDE_WHAT_YOU_USE} )
743- else ()
744- message (
745- FATAL_ERROR
746- "\n opentracing-cpp package was not found. Please either provide it manually or clone with submodules. "
747- "To initialize, fetch and checkout any nested submodules, you can use the following command:\n "
748- "git submodule update --init --recursive" )
749- endif ()
750- else ()
751- message (STATUS "Using external opentracing-cpp" )
752- endif ()
753732 add_subdirectory (opentracing-shim)
754733endif ()
755734
0 commit comments