diff options
Diffstat (limited to 'dep/protobuf')
-rw-r--r-- | dep/protobuf/CMakeLists.txt | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/dep/protobuf/CMakeLists.txt b/dep/protobuf/CMakeLists.txt index 5ea6a4e188b..a530cedc970 100644 --- a/dep/protobuf/CMakeLists.txt +++ b/dep/protobuf/CMakeLists.txt @@ -57,7 +57,14 @@ else() ) endif() -add_library(protobuf STATIC ${protobuf_STAT_SRCS}) +if (UNIX) + # Enable the default unix export behaviour for protobuf so we don't + # need to patch it's sources. + string(REPLACE "-fvisibility=hidden" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) + string(REPLACE "-fvisibility=hidden" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) +endif() + +add_library(protobuf ${protobuf_STAT_SRCS}) target_include_directories(protobuf PUBLIC @@ -69,7 +76,28 @@ target_link_libraries(protobuf PUBLIC threads) +if (BUILD_SHARED_LIBS) + target_compile_definitions(protobuf + PRIVATE + -DLIBPROTOBUF_EXPORTS + -DLIBPROTOC_EXPORTS + PUBLIC + -DPROTOBUF_USE_DLLS) +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() |