From c3aa4c2675f993f3e6601547f03d76fd93183628 Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Thu, 15 Oct 2015 02:56:48 +0300 Subject: Improved SHARED build from CMake project --- cmake/libprotobuf.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'cmake/libprotobuf.cmake') diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake index bf5f5e25..a6ee8f2e 100644 --- a/cmake/libprotobuf.cmake +++ b/cmake/libprotobuf.cmake @@ -53,10 +53,15 @@ set(libprotobuf_files ${protobuf_source_dir}/src/google/protobuf/wrappers.pb.cc ) -add_library(libprotobuf ${libprotobuf_lite_files} ${libprotobuf_files}) +add_library(libprotobuf ${protobuf_SHARED_OR_STATIC} + ${libprotobuf_lite_files} ${libprotobuf_files}) target_link_libraries(libprotobuf ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES}) target_include_directories(libprotobuf PUBLIC ${protobuf_source_dir}/src) +if(MSVC AND protobuf_BUILD_SHARED_LIBS) + target_compile_definitions(libprotobuf + PUBLIC PROTOBUF_USE_DLLS + PRIVATE LIBPROTOBUF_EXPORTS) +endif() set_target_properties(libprotobuf PROPERTIES - COMPILE_DEFINITIONS LIBPROTOBUF_EXPORTS OUTPUT_NAME ${LIB_PREFIX}protobuf DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") -- cgit v1.2.3