Add a flag to allow for linking against shared system protobuf (#7577)

In some environments you would like to link to the shared libprotobuf from the system. This is fine to use if you have full control over all protobuf users in your environment.

This need for the existence of this option is already mentioned as a comment in CMakeLists.txt, this adds it now.
This commit is contained in:
Uwe L. Korn 2021-05-19 18:37:50 +02:00 committed by GitHub
parent 3a68c389d9
commit 203efef147
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -690,9 +690,9 @@ if(Protobuf_FOUND OR Protobuf_FOUND)
#We have a check here but most of the cmake users don't know the Protobuf_USE_STATIC_LIBS
# variable exists and may leave it in a wrong state.
if(NOT Protobuf_USE_STATIC_LIBS)
#Indeed here should be a warning, not a fatal error. ONNX Runtime itself can work in such a
#setting but it may cause compatibility issue when ONNX Runtime is integrated with the other ONNX ecosystem softwares.
message(FATAL_ERROR "Please enable Protobuf_USE_STATIC_LIBS")
# ONNX Runtime itself can work in such a setting but it may cause compatibility issues
# when ONNX Runtime is integrated with the other ONNX ecosystem softwares.
message(WARNING "Use Protobuf_USE_STATIC_LIBS to ensure compatibility with other ONNX ecosystem components.")
endif()
else()
set(PROTOBUF_LIB protobuf::libprotobuf-lite)