mirror of
https://github.com/reactos/CMake.git
synced 2024-11-23 11:39:48 +00:00
FindProtobuf: Fix usage of protobuf dynamic libraries on Windows
Define `PROTOBUF_USE_DLLS` on Windows when linking against dynamic protobuf libraries so that we import symbols from them. We use the condition `MSVC` to enable this because that is what the upstream buildsystem uses.
This commit is contained in:
parent
74ad28fa6a
commit
3bbd85d5ff
@ -526,6 +526,11 @@ if(Protobuf_INCLUDE_DIR)
|
||||
INTERFACE_COMPILE_FEATURES cxx_std_11
|
||||
)
|
||||
endif()
|
||||
if (MSVC AND NOT Protobuf_USE_STATIC_LIBS)
|
||||
set_property(TARGET protobuf::libprotobuf APPEND PROPERTY
|
||||
INTERFACE_COMPILE_DEFINITIONS "PROTOBUF_USE_DLLS"
|
||||
)
|
||||
endif()
|
||||
if(UNIX AND TARGET Threads::Threads)
|
||||
set_property(TARGET protobuf::libprotobuf APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES Threads::Threads)
|
||||
@ -554,6 +559,11 @@ if(Protobuf_INCLUDE_DIR)
|
||||
set_target_properties(protobuf::libprotobuf-lite PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${Protobuf_LITE_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
if (MSVC AND NOT Protobuf_USE_STATIC_LIBS)
|
||||
set_property(TARGET protobuf::libprotobuf-lite APPEND PROPERTY
|
||||
INTERFACE_COMPILE_DEFINITIONS "PROTOBUF_USE_DLLS"
|
||||
)
|
||||
endif()
|
||||
if(UNIX AND TARGET Threads::Threads)
|
||||
set_property(TARGET protobuf::libprotobuf-lite APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES Threads::Threads)
|
||||
@ -587,6 +597,11 @@ if(Protobuf_INCLUDE_DIR)
|
||||
INTERFACE_COMPILE_FEATURES cxx_std_11
|
||||
)
|
||||
endif()
|
||||
if (MSVC AND NOT Protobuf_USE_STATIC_LIBS)
|
||||
set_property(TARGET protobuf::libprotoc APPEND PROPERTY
|
||||
INTERFACE_COMPILE_DEFINITIONS "PROTOBUF_USE_DLLS"
|
||||
)
|
||||
endif()
|
||||
if(UNIX AND TARGET Threads::Threads)
|
||||
set_property(TARGET protobuf::libprotoc APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES Threads::Threads)
|
||||
|
Loading…
Reference in New Issue
Block a user