Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

Commit 7dd252f

Browse files
authored
Only test dynamic loading if building jaegertracing shared lib (#92)
Signed-off-by: Isaac Hier <[email protected]>
1 parent 405ded8 commit 7dd252f

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

CMakeLists.txt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,8 @@ function(add_lib_deps lib)
242242
endfunction()
243243

244244
option(JAEGERTRACING_PLUGIN "Build dynamic plugin" OFF)
245-
if(NOT JAEGERTRACING_PLUGIN)
246-
set(no_plugin)
247-
endif()
248245
cmake_dependent_option(BUILD_SHARED_LIBS "Build shared libraries" ON
249-
"no_plugin" OFF)
246+
"NOT JAEGERTRACING_PLUGIN" OFF)
250247

251248
if(BUILD_SHARED_LIBS)
252249
add_library(jaegertracing SHARED ${SRC})
@@ -321,17 +318,19 @@ if(BUILD_TESTING)
321318
UnitTest testutils GTest::main ${JAEGERTRACING_LIB} ${LIBS})
322319
add_test(NAME UnitTest COMMAND UnitTest)
323320

324-
add_executable(DynamicallyLoadTracerTest src/jaegertracing/DynamicallyLoadTracerTest.cpp)
325-
target_include_directories(DynamicallyLoadTracerTest PUBLIC
326-
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src>)
327-
target_link_libraries(
328-
DynamicallyLoadTracerTest OpenTracing::opentracing-static)
329-
add_test(NAME DynamicallyLoadTracerTest COMMAND DynamicallyLoadTracerTest
330-
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}jaegertracing${CMAKE_SHARED_LIBRARY_SUFFIX})
331-
if(JAEGERTRACING_COVERAGE)
332-
setup_target_for_coverage(NAME UnitTestCoverage
333-
EXECUTABLE UnitTest
334-
DEPENDENCIES UnitTest)
321+
if(TARGET jaegertracing)
322+
add_executable(DynamicallyLoadTracerTest src/jaegertracing/DynamicallyLoadTracerTest.cpp)
323+
target_include_directories(DynamicallyLoadTracerTest PUBLIC
324+
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src>)
325+
target_link_libraries(
326+
DynamicallyLoadTracerTest OpenTracing::opentracing-static)
327+
add_test(NAME DynamicallyLoadTracerTest
328+
COMMAND DynamicallyLoadTracerTest $<TARGET_FILE:jaegertracing>)
329+
if(JAEGERTRACING_COVERAGE)
330+
setup_target_for_coverage(NAME UnitTestCoverage
331+
EXECUTABLE UnitTest
332+
DEPENDENCIES UnitTest)
333+
endif()
335334
endif()
336335
endif()
337336

0 commit comments

Comments
 (0)