]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: move ExternalProjectHelper & IncludeJaeger to BuildJaeger
authorDeepika Upadhyay <dupadhya@redhat.com>
Wed, 21 Jul 2021 15:55:23 +0000 (21:25 +0530)
committerDeepika Upadhyay <dupadhya@redhat.com>
Thu, 22 Jul 2021 05:31:08 +0000 (11:01 +0530)
set_library_properties_for_external_project assists with setting right target
properties for all jaeger dependencies.
IncludeJaeger would take care of linking and creating these targets
having them spread out when they are highly coupled seems not optimal.

Signed-off-by: Deepika Upadhyay <dupadhya@redhat.com>
cmake/modules/BuildJaeger.cmake
cmake/modules/ExternalProjectHelper.cmake [deleted file]
cmake/modules/IncludeJaeger.cmake [deleted file]
src/CMakeLists.txt

index 826b58fd4dd2198be425930003f48fd2dc89b839..8783a6fb7feb6c931fd671322fdf277160b8915d 100644 (file)
@@ -5,6 +5,28 @@
 # Find<package>.cmake
 # Boost Libraries: uses ceph build boost cmake/modules/BuildBoost.cmake
 
+include(BuildOpenTracing)
+
+# will do all linking and path setting
+function(set_library_properties_for_external_project _target _lib)
+  # Manually create the directory, it will be created as part of the build,
+  # but this runs in the configuration phase, and CMake generates an error if
+  # we add an include directory that does not exist yet.
+  set(_libfullname "${CMAKE_SHARED_LIBRARY_PREFIX}${_lib}${CMAKE_SHARED_LIBRARY_SUFFIX}")
+  set(_libpath "${CMAKE_BINARY_DIR}/external/lib/${_libfullname}")
+  set(_includepath "${CMAKE_BINARY_DIR}/external/include")
+  message(STATUS "Configuring ${_target} with ${_libpath}")
+  add_library(${_target} SHARED IMPORTED)
+  add_dependencies(${_target} ${_lib})
+
+  file(MAKE_DIRECTORY "${_includepath}")
+  set_target_properties(${_target} PROPERTIES
+    INTERFACE_LINK_LIBRARIES "${_libpath}"
+    IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+    IMPORTED_LOCATION "${_libpath}"
+    INTERFACE_INCLUDE_DIRECTORIES "${_includepath}")
+endfunction()
+
 function(build_jaeger)
   set(Jaeger_SOURCE_DIR "${CMAKE_SOURCE_DIR}/src/jaegertracing/jaeger-client-cpp")
   set(Jaeger_INSTALL_DIR "${CMAKE_BINARY_DIR}/external")
@@ -55,4 +77,9 @@ function(build_jaeger)
     DEPENDS "${dependencies}"
     BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/external/lib/libjaegertracing.so
     )
+
+  set_library_properties_for_external_project(opentracing::libopentracing
+  opentracing)
+  set_library_properties_for_external_project(jaegertracing::libjaegertracing
+  jaegertracing)
 endfunction()
diff --git a/cmake/modules/ExternalProjectHelper.cmake b/cmake/modules/ExternalProjectHelper.cmake
deleted file mode 100644 (file)
index 42beab1..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-function (set_library_properties_for_external_project _target _lib)
-  # Manually create the directory, it will be created as part of the build,
-  # but this runs in the configuration phase, and CMake generates an error if
-  # we add an include directory that does not exist yet.
-  set(_libfullname "${CMAKE_SHARED_LIBRARY_PREFIX}${_lib}${CMAKE_SHARED_LIBRARY_SUFFIX}")
-  set(_libpath "${CMAKE_BINARY_DIR}/external/lib/${_libfullname}")
-  set(_includepath "${CMAKE_BINARY_DIR}/external/include")
-  message(STATUS "Configuring ${_target} with ${_libpath}")
-
-  file(MAKE_DIRECTORY "${_includepath}")
-  set_target_properties(${_target} PROPERTIES
-    INTERFACE_LINK_LIBRARIES "${_libpath}"
-    IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
-    IMPORTED_LOCATION "${_libpath}"
-    INTERFACE_INCLUDE_DIRECTORIES "${_includepath}")
-  #  set_property(TARGET ${_target} APPEND PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES "CXX")
-endfunction ()
diff --git a/cmake/modules/IncludeJaeger.cmake b/cmake/modules/IncludeJaeger.cmake
deleted file mode 100644 (file)
index b62265c..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-include(BuildJaeger)
-include(BuildOpenTracing)
-
-include(ExternalProjectHelper)
-
-build_jaeger()
-
-add_library(opentracing::libopentracing SHARED IMPORTED)
-add_dependencies(opentracing::libopentracing opentracing)
-add_library(jaegertracing::libjaegertracing SHARED IMPORTED)
-add_dependencies(jaegertracing::libjaegertracing Jaeger)
-add_library(thrift::libthrift SHARED IMPORTED)
-add_dependencies(thrift::libthrift thrift)
-
-#(set_library_properties_for_external_project _target _lib)
-set_library_properties_for_external_project(opentracing::libopentracing
-  opentracing)
-set_library_properties_for_external_project(jaegertracing::libjaegertracing
-  jaegertracing)
-set_library_properties_for_external_project(thrift::libthrift
-  thrift)
index b862da4ad700ef71e247c3698577605555afdd95..e0ecb15b1e61840732c52ad24040d9e1226a4573 100644 (file)
@@ -431,6 +431,9 @@ if(WITH_JAEGER)
   list(APPEND jaeger_base
   opentracing::libopentracing
   jaegertracing::libjaegertracing)
+
+  build_jaeger()
+
   target_link_libraries(jaeger-base INTERFACE
   yaml-cpp::yaml-cpp
   opentracing::libopentracing