summaryrefslogtreecommitdiffstats
path: root/mocktracer/CMakeLists.txt
blob: 9835fe3d7b26b7f32f9e3327669d72cfc526233b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
include_directories(include)

set(SRCS src/mock_span_context.cpp
         src/mock_span.cpp
         src/in_memory_recorder.cpp
         src/json_recorder.cpp
         src/base64.cpp
         src/propagation.cpp
         src/utility.cpp
         src/json.cpp
         src/tracer.cpp
         src/tracer_factory.cpp)

if (BUILD_SHARED_LIBS)
  add_library(opentracing_mocktracer SHARED ${SRCS} src/dynamic_load.cpp)
  target_include_directories(opentracing_mocktracer INTERFACE "$<INSTALL_INTERFACE:include/>")
  set_target_properties(opentracing_mocktracer PROPERTIES VERSION ${OPENTRACING_VERSION_STRING}
                                               SOVERSION ${OPENTRACING_VERSION_MAJOR})
  target_link_libraries(opentracing_mocktracer PUBLIC opentracing)
  target_compile_definitions(opentracing_mocktracer PRIVATE OPENTRACING_MOCK_TRACER_EXPORTS)
  install(TARGETS opentracing_mocktracer
          COMPONENT DIST
          EXPORT OpenTracingTargets
          LIBRARY DESTINATION ${LIB_INSTALL_DIR}
          ARCHIVE DESTINATION ${LIB_INSTALL_DIR})

  
endif()

if (BUILD_STATIC_LIBS)
  add_library(opentracing_mocktracer-static STATIC ${SRCS})
  # Windows generates a lib and dll files for a shared library. using the same name will override the lib file generated by the shared target
  if (NOT WIN32)
    set_target_properties(opentracing_mocktracer-static PROPERTIES OUTPUT_NAME opentracing_mocktracer)
  endif()
  target_compile_definitions(opentracing_mocktracer-static PUBLIC OPENTRACING_MOCK_TRACER_STATIC)
  target_include_directories(opentracing_mocktracer-static INTERFACE "$<INSTALL_INTERFACE:include/>")
  target_link_libraries(opentracing_mocktracer-static opentracing-static)
  install(TARGETS opentracing_mocktracer-static EXPORT OpenTracingTargets
	  ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
endif()

install(DIRECTORY include/opentracing DESTINATION include
            FILES_MATCHING PATTERN "*.h")

# ==============================================================================
# Testing

include(CTest)
if(BUILD_TESTING)
  add_subdirectory(test)
endif()