# HG changeset patch # User Sebastien Jodogne # Date 1550222792 -3600 # Node ID 47fbb0467a6299bc10ba12e83450192548a878f9 # Parent 01a5b2530b682c45403c679255d0bda19fab784d Build a static library to share code between the plugins diff -r 01a5b2530b68 -r 47fbb0467a62 CMakeLists.txt --- a/CMakeLists.txt Fri Feb 15 09:27:10 2019 +0100 +++ b/CMakeLists.txt Fri Feb 15 10:26:32 2019 +0100 @@ -338,6 +338,29 @@ ##################################################################### +## Build a static library to share code between the plugins +##################################################################### + +if (ENABLE_PLUGINS AND + (BUILD_SERVE_FOLDERS OR BUILD_MODALITY_WORKLISTS)) + add_library(ThirdPartyPlugins STATIC + ${BOOST_SOURCES} + ${JSONCPP_SOURCES} + ${LIBICONV_SOURCES} + ${LIBICU_SOURCES} + Plugins/Samples/Common/OrthancPluginCppWrapper.cpp + ) + + # Add the "-fPIC" option as this static library must be embedded + # inside shared libraries (important on UNIX) + set_property( + TARGET ThirdPartyPlugins + PROPERTY POSITION_INDEPENDENT_CODE ON + ) +endif() + + +##################################################################### ## Build the "ServeFolders" plugin ##################################################################### @@ -359,14 +382,12 @@ endif() add_library(ServeFolders SHARED - ${BOOST_SOURCES} - ${JSONCPP_SOURCES} - ${LIBICONV_SOURCES} Plugins/Samples/ServeFolders/Plugin.cpp - Plugins/Samples/Common/OrthancPluginCppWrapper.cpp ${SERVE_FOLDERS_RESOURCES} ) + target_link_libraries(ServeFolders ThirdPartyPlugins) + set_target_properties( ServeFolders PROPERTIES VERSION ${ORTHANC_VERSION} @@ -404,14 +425,12 @@ endif() add_library(ModalityWorklists SHARED - ${BOOST_SOURCES} - ${JSONCPP_SOURCES} - ${LIBICONV_SOURCES} - Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Plugins/Samples/ModalityWorklists/Plugin.cpp ${MODALITY_WORKLISTS_RESOURCES} ) + target_link_libraries(ModalityWorklists ThirdPartyPlugins) + set_target_properties( ModalityWorklists PROPERTIES VERSION ${ORTHANC_VERSION}