Skip to content

Commit f9399a6

Browse files
elsaelsakeirouz
authored andcommitted
cmake: include customlabels in deps
* CMakeLists.txt * cmake/deps/customlabels.cmake * include/datadog/tracer_signature.h * src/datadog/trace_segment.cpp
1 parent 5bcf94e commit f9399a6

File tree

4 files changed

+45
-3
lines changed

4 files changed

+45
-3
lines changed

CMakeLists.txt

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ endif ()
2424

2525
set(DD_TRACE_TRANSPORT "curl" CACHE STRING "HTTP transport that dd-trace-cpp uses to communicate with the Datadog Agent, can be either 'none' or 'curl'")
2626

27+
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
28+
include(cmake/deps/customlabels.cmake)
29+
message(STATUS "customlabels Library is available")
30+
endif()
31+
2732
if(DD_TRACE_TRANSPORT STREQUAL "curl")
2833
include(cmake/deps/curl.cmake)
2934
message(STATUS "DD_TRACE_TRANSPORT is set to 'curl', including curl")
@@ -203,11 +208,17 @@ if (BUILD_SHARED_LIBS)
203208
PUBLIC
204209
dd_trace::obj
205210
CURL::libcurl_shared
206-
customlabels
207211
PRIVATE
208212
dd_trace::specs
209213
)
210214

215+
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
216+
target_link_libraries(dd_trace_cpp-shared
217+
PUBLIC
218+
customlabels
219+
)
220+
endif ()
221+
211222
install(TARGETS dd_trace_cpp-objects dd_trace_cpp-shared
212223
EXPORT dd_trace_cpp-export
213224
FILE_SET public_headers DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
@@ -250,6 +261,13 @@ if (BUILD_STATIC_LIBS)
250261
dd_trace::specs
251262
)
252263

264+
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
265+
target_link_libraries(dd_trace_cpp-static
266+
PUBLIC
267+
customlabels
268+
)
269+
endif ()
270+
253271
install(TARGETS dd_trace_cpp-objects dd_trace_cpp-static
254272
EXPORT dd_trace_cpp-export
255273
FILE_SET public_headers DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
@@ -258,3 +276,10 @@ if (BUILD_STATIC_LIBS)
258276
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
259277
)
260278
endif ()
279+
280+
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
281+
target_include_directories(dd_trace_cpp-objects
282+
PRIVATE
283+
${customlabels_SOURCE_DIR}/src
284+
)
285+
endif()

cmake/deps/customlabels.cmake

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
include(FetchContent)
2+
3+
FetchContent_Declare(customlabels
4+
GIT_REPOSITORY https://github.com/DataDog/custom-labels.git
5+
GIT_TAG elsa/add-process-storage
6+
)
7+
8+
FetchContent_MakeAvailable(customlabels)
9+
10+
add_library(customlabels SHARED
11+
${customlabels_SOURCE_DIR}/src/customlabels.c
12+
)
13+
14+
target_include_directories(customlabels
15+
PUBLIC
16+
${customlabels_SOURCE_DIR}/src
17+
)

include/datadog/tracer_signature.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <cstring>
2424
#include <vector>
2525
extern "C" {
26-
#include <customlabels/customlabels.h>
26+
#include <customlabels.h>
2727
}
2828
#endif
2929

src/datadog/trace_segment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#ifdef __linux__
22
extern "C" {
3-
#include <customlabels/customlabels.h>
3+
#include <customlabels.h>
44
}
55
#endif
66

0 commit comments

Comments
 (0)