@@ -22,8 +22,6 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
2222 project (opentelemetry-fluentd)
2323 set (MAIN_PROJECT ON )
2424endif ()
25- add_definitions (-DHAVE_CONSOLE_LOG)
26- add_definitions (-DENABLE_LOGS_PREVIEW)
2725
2826if (MAIN_PROJECT)
2927 find_package (opentelemetry-cpp CONFIG QUIET )
@@ -34,7 +32,7 @@ if (MAIN_PROJECT)
3432 build_opentelemetry()
3533 set (OPENTELEMETRY_CPP_INCLUDE_DIRS "" )
3634 set (OPENTELEMETRY_CPP_LIBRARIES "opentelemetry::libopentelemetry" )
37- message ("\n opentelemetry -cpp package was not found. Cloned from github" )
35+ message ("opentelemetry -cpp package was not found. Cloned from github" )
3836 endif ()
3937endif ()
4038
4846 set (nlohmann_json_SOURCE_DIR
4947 "${CMAKE_SOURCE_DIR} /nlohmann_json/single_include" )
5048 include_directories (${nlohmann_json_SOURCE_DIR} )
51- message ("\n nlohmann_json package was not found. Cloning from github" )
49+ message ("nlohmann_json package was not found. Cloning from github" )
5250endif ()
5351
5452find_package (CURL REQUIRED)
@@ -58,28 +56,42 @@ include_directories(include)
5856# create fluentd trace exporter
5957add_library (opentelemetry_exporter_fluentd_trace src/trace/fluentd_exporter.cc
6058 src/trace/recordable.cc)
61- target_include_directories (opentelemetry_exporter_fluentd_trace
59+ if (MAIN_PROJECT)
60+ target_include_directories (opentelemetry_exporter_fluentd_trace
6261 PRIVATE ${OPENTELEMETRY_CPP_INCLUDE_DIRS} )
63- target_link_libraries (
64- opentelemetry_exporter_fluentd_trace
65- PUBLIC ${OPENTELEMETRY_CPP_LIBRARIES}
66- INTERFACE nlohmann_json::nlohmann_json)
62+ target_link_libraries (
63+ opentelemetry_exporter_fluentd_trace
64+ PUBLIC ${OPENTELEMETRY_CPP_LIBRARIES}
65+ INTERFACE nlohmann_json::nlohmann_json)
66+ else ()
67+ target_link_libraries (
68+ opentelemetry_exporter_fluentd_trace
69+ PUBLIC opentelemetry_trace opentelemetry_resources opentelemetry_common
70+ INTERFACE nlohmann_json::nlohmann_json)
71+ endif ()
72+
6773set_target_properties (opentelemetry_exporter_fluentd_trace
6874 PROPERTIES EXPORT_NAME trace)
6975
7076# create fluentd logs exporter
7177
7278add_library (opentelemetry_exporter_fluentd_logs src/log /fluentd_exporter.cc
7379 src/log /recordable.cc)
74- target_include_directories (opentelemetry_exporter_fluentd_logs
80+ if (MAIN_PROJECT)
81+ target_include_directories (opentelemetry_exporter_fluentd_logs
7582 PRIVATE ${OPENTELEMETRY_CPP_INCLUDE_DIRS} )
76- target_link_libraries (
77- opentelemetry_exporter_fluentd_logs
78- PUBLIC ${OPENTELEMETRY_CPP_LIBRARIES}
79- INTERFACE nlohmann_json::nlohmann_json)
83+ target_link_libraries (
84+ opentelemetry_exporter_fluentd_logs
85+ PUBLIC ${OPENTELEMETRY_CPP_LIBRARIES}
86+ INTERFACE nlohmann_json::nlohmann_json)
87+ else ()
88+ target_link_libraries (
89+ opentelemetry_exporter_fluentd_logs
90+ PUBLIC opentelemetry_logs opentelemetry_resources opentelemetry_common
91+ INTERFACE nlohmann_json::nlohmann_json)
92+ endif ()
8093set_target_properties (opentelemetry_exporter_fluentd_logs PROPERTIES EXPORT_NAME
8194 logs)
82-
8395if (nlohmann_json_clone)
8496 add_dependencies (opentelemetry_exporter_fluentd_trace
8597 nlohmann_json::nlohmann_json)
0 commit comments