Skip to content

Instantly share code, notes, and snippets.

@Naios
Last active April 17, 2016 13:15
Show Gist options
  • Save Naios/a113db1b58193b9bda4b06173fa76b44 to your computer and use it in GitHub Desktop.
Save Naios/a113db1b58193b9bda4b06173fa76b44 to your computer and use it in GitHub Desktop.
diff --git a/dep/protobuf/CMakeLists.txt b/dep/protobuf/CMakeLists.txt
index 5ea6a4e..3b2a7e1 100644
--- a/dep/protobuf/CMakeLists.txt
+++ b/dep/protobuf/CMakeLists.txt
@@ -57,7 +57,7 @@ else()
)
endif()
-add_library(protobuf STATIC ${protobuf_STAT_SRCS})
+add_library(protobuf ${protobuf_STAT_SRCS})
target_include_directories(protobuf
PUBLIC
@@ -69,7 +69,27 @@ target_link_libraries(protobuf
PUBLIC
threads)
+if (BUILD_SHARED_LIBS)
+ target_compile_definitions(protobuf
+ PUBLIC
+ -DPROTOBUF_USE_DLLS
+ PRIVATE
+ -DLIBPROTOBUF_EXPORTS)
+endif()
+
set_target_properties(protobuf
- PROPERTIES
- FOLDER
- "dep")
+ PROPERTIES
+ FOLDER
+ "dep")
+
+if (BUILD_SHARED_LIBS)
+ if (UNIX)
+ install(TARGETS protobuf
+ LIBRARY
+ DESTINATION lib)
+ elseif (WIN32)
+ install(TARGETS protobuf
+ RUNTIME
+ DESTINATION "${CMAKE_INSTALL_PREFIX}")
+ endif()
+endif()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment