@@ -24,6 +24,15 @@ endif ()
2424
2525set (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 (DD_TRACE_TRANSPORT STREQUAL "curl" )
28+ include (cmake/deps/curl.cmake)
29+ message (STATUS "DD_TRACE_TRANSPORT is set to 'curl', including curl" )
30+ elseif (DD_TRACE_TRANSPORT STREQUAL "none" )
31+ message (STATUS "DD_TRACE_TRANSPORT is set to 'none', no default transport will be included" )
32+ else ()
33+ message (FATAL_ERROR "Invalid value for DD_TRACE_TRANSPORT: ${DD_TRACE_TRANSPORT} " )
34+ endif ()
35+
2736# Consumer of the library using FetchContent do not need
2837# to build unit tests, fuzzers and examples.
2938if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR )
@@ -41,7 +50,6 @@ endif ()
4150
4251# Linking this library requires threads.
4352find_package (Threads REQUIRED)
44- include (cmake/deps/curl.cmake)
4553include (cmake/deps/json.cmake)
4654include (cmake/utils.cmake)
4755
@@ -180,6 +188,11 @@ if (BUILD_SHARED_LIBS)
180188 PRIVATE
181189 CURL::libcurl_shared
182190 )
191+ else ()
192+ target_sources (dd_trace_cpp-shared
193+ PRIVATE
194+ src/datadog/default_http_client_null.cpp
195+ )
183196 endif ()
184197
185198 add_dependencies (dd_trace_cpp-shared dd_trace_cpp-objects CURL::libcurl_shared)
@@ -218,6 +231,11 @@ if (BUILD_STATIC_LIBS)
218231 PRIVATE
219232 CURL::libcurl_static
220233 )
234+ else ()
235+ target_sources (dd_trace_cpp-static
236+ PRIVATE
237+ src/datadog/default_http_client_null.cpp
238+ )
221239 endif ()
222240
223241 add_dependencies (dd_trace_cpp-static dd_trace_cpp-objects)
0 commit comments