Skip to content

Commit

Permalink
Update CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
meastp authored Jan 2, 2024
1 parent dd398e8 commit 72b1ba4
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions ext/src/dll/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
set(OPENTELEMETRY_EXPORT_DEF
"${CMAKE_CURRENT_BINARY_DIR}/opentelemetry_cpp.def")

add_custom_command(
OUTPUT ${OPENTELEMETRY_EXPORT_DEF}
COMMENT "Generating ${OPENTELEMETRY_EXPORT_DEF} file with explicitly exported symbols from opentelemetry_cpp.src"
COMMAND
${CMAKE_CXX_COMPILER}
"-D$<JOIN:$<TARGET_PROPERTY:opentelemetry_cpp,COMPILE_DEFINITIONS>,;-D>" /EP
${CMAKE_CURRENT_SOURCE_DIR}/opentelemetry_cpp.src >
${OPENTELEMETRY_EXPORT_DEF}
DEPENDS ${OPENTELEMETRY_EXPORT_DEF}
COMMAND_EXPAND_LISTS VERBATIM)

add_library(opentelemetry_cpp SHARED dllmain.cc ${OPENTELEMETRY_EXPORT_DEF})

target_compile_definitions(opentelemetry_cpp INTERFACE OPENTELEMETRY_BUILD_IMPORT_DLL)
Expand Down Expand Up @@ -52,15 +63,6 @@ if(WITH_OTLP_HTTP)
PRIVATE opentelemetry_exporter_otlp_http_log)
endif()

add_custom_command(
OUTPUT ${OPENTELEMETRY_EXPORT_DEF}
COMMAND
${CMAKE_CXX_COMPILER}
"-D$<JOIN:$<TARGET_PROPERTY:opentelemetry_cpp,COMPILE_DEFINITIONS>,;-D>" /EP
${CMAKE_CURRENT_SOURCE_DIR}/opentelemetry_cpp.src >
${OPENTELEMETRY_EXPORT_DEF}
COMMAND_EXPAND_LISTS VERBATIM)

if(OPENTELEMETRY_INSTALL)
install(
TARGETS opentelemetry_cpp
Expand Down

0 comments on commit 72b1ba4

Please sign in to comment.