diff options
author | Konstantin Podsvirov <konstantin@podsvirov.pro> | 2015-10-15 02:56:48 +0300 |
---|---|---|
committer | Konstantin Podsvirov <konstantin@podsvirov.pro> | 2015-10-15 02:56:48 +0300 |
commit | c3aa4c2675f993f3e6601547f03d76fd93183628 (patch) | |
tree | d55eedb087cc7f2b1361da0916cd3d74159aafcd /cmake/libprotobuf.cmake | |
parent | f397ede7c6441a780c6dac7eb32a2459635baa9c (diff) | |
download | protobuf-c3aa4c2675f993f3e6601547f03d76fd93183628.tar.gz protobuf-c3aa4c2675f993f3e6601547f03d76fd93183628.tar.bz2 protobuf-c3aa4c2675f993f3e6601547f03d76fd93183628.zip |
Improved SHARED build from CMake project
Diffstat (limited to 'cmake/libprotobuf.cmake')
-rw-r--r-- | cmake/libprotobuf.cmake | 9 |
1 files changed, 7 insertions, 2 deletions
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}") |