File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -260,7 +260,7 @@ if(NOT ONNX_PROTOC_EXECUTABLE)
260260 set (ABSL_PROPAGATE_CXX_STD 1)
261261 set (ONNX_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS} )
262262 set (ONNX_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} )
263- # Use this setting to build thirdparty libs.
263+ # Use this setting to build third-party libs.
264264 set (BUILD_SHARED_LIBS ${ONNX_USE_PROTOBUF_SHARED_LIBS} )
265265 set (ProtobufURL https://github.com/protocolbuffers/protobuf/releases/download/v30.2/protobuf-30.2.tar.gz)
266266 set (ProtobufSHA1 f846d1f047255d09142361ba6d1985336db5e407)
@@ -474,7 +474,14 @@ if(ONNX_USE_LITE_PROTO)
474474 set (LINKED_PROTOBUF_TARGET protobuf::libprotobuf-lite)
475475 endif ()
476476endif ()
477- target_link_libraries (onnx_proto PUBLIC ${LINKED_PROTOBUF_TARGET} )
477+ if ((NOT ONNX_USE_PROTOBUF_SHARED_LIBS) AND Build_Protobuf)
478+ target_link_libraries (onnx_proto PRIVATE ${LINKED_PROTOBUF_TARGET} )
479+ target_include_directories (onnx_proto PUBLIC
480+ $<BUILD_INTERFACE:$<TARGET_PROPERTY:${LINKED_PROTOBUF_TARGET} ,INCLUDE_DIRECTORIES >>
481+ )
482+ else ()
483+ target_link_libraries (onnx_proto PUBLIC ${LINKED_PROTOBUF_TARGET} )
484+ endif ()
478485foreach (ABSL_USED_TARGET IN LISTS protobuf_ABSL_USED_TARGETS)
479486 if (TARGET ${ABSL_USED_TARGET} )
480487 target_link_libraries (onnx_proto PRIVATE ${ABSL_USED_TARGET} )
Original file line number Diff line number Diff line change 66# library version information
77set (ONNX_VERSION "@ONNX_VERSION@" )
88
9- find_package (Protobuf REQUIRED CONFIG)
9+ if ((NOT @@ONNX_USE_PROTOBUF_SHARED_LIBS@@) AND @@Build_Protobuf@@)
10+ find_package (Protobuf REQUIRED CONFIG)
11+ endif ()
1012
1113# import targets
1214include ("${CMAKE_CURRENT_LIST_DIR} /ONNXTargets.cmake" )
You can’t perform that action at this time.
0 commit comments