comparison CMakeLists.txt @ 3233:47fbb0467a62

Build a static library to share code between the plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 15 Feb 2019 10:26:32 +0100
parents 4bbadcd03966
children 92d679112657
comparison
equal deleted inserted replaced
3232:01a5b2530b68 3233:47fbb0467a62
336 ${GOOGLE_TEST_LIBRARIES} 336 ${GOOGLE_TEST_LIBRARIES}
337 ) 337 )
338 338
339 339
340 ##################################################################### 340 #####################################################################
341 ## Build a static library to share code between the plugins
342 #####################################################################
343
344 if (ENABLE_PLUGINS AND
345 (BUILD_SERVE_FOLDERS OR BUILD_MODALITY_WORKLISTS))
346 add_library(ThirdPartyPlugins STATIC
347 ${BOOST_SOURCES}
348 ${JSONCPP_SOURCES}
349 ${LIBICONV_SOURCES}
350 ${LIBICU_SOURCES}
351 Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
352 )
353
354 # Add the "-fPIC" option as this static library must be embedded
355 # inside shared libraries (important on UNIX)
356 set_property(
357 TARGET ThirdPartyPlugins
358 PROPERTY POSITION_INDEPENDENT_CODE ON
359 )
360 endif()
361
362
363 #####################################################################
341 ## Build the "ServeFolders" plugin 364 ## Build the "ServeFolders" plugin
342 ##################################################################### 365 #####################################################################
343 366
344 if (ENABLE_PLUGINS AND BUILD_SERVE_FOLDERS) 367 if (ENABLE_PLUGINS AND BUILD_SERVE_FOLDERS)
345 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 368 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
357 380
358 list(APPEND SERVE_FOLDERS_RESOURCES ${AUTOGENERATED_DIR}/ServeFolders.rc) 381 list(APPEND SERVE_FOLDERS_RESOURCES ${AUTOGENERATED_DIR}/ServeFolders.rc)
359 endif() 382 endif()
360 383
361 add_library(ServeFolders SHARED 384 add_library(ServeFolders SHARED
362 ${BOOST_SOURCES}
363 ${JSONCPP_SOURCES}
364 ${LIBICONV_SOURCES}
365 Plugins/Samples/ServeFolders/Plugin.cpp 385 Plugins/Samples/ServeFolders/Plugin.cpp
366 Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
367 ${SERVE_FOLDERS_RESOURCES} 386 ${SERVE_FOLDERS_RESOURCES}
368 ) 387 )
388
389 target_link_libraries(ServeFolders ThirdPartyPlugins)
369 390
370 set_target_properties( 391 set_target_properties(
371 ServeFolders PROPERTIES 392 ServeFolders PROPERTIES
372 VERSION ${ORTHANC_VERSION} 393 VERSION ${ORTHANC_VERSION}
373 SOVERSION ${ORTHANC_VERSION} 394 SOVERSION ${ORTHANC_VERSION}
402 423
403 list(APPEND MODALITY_WORKLISTS_RESOURCES ${AUTOGENERATED_DIR}/ModalityWorklists.rc) 424 list(APPEND MODALITY_WORKLISTS_RESOURCES ${AUTOGENERATED_DIR}/ModalityWorklists.rc)
404 endif() 425 endif()
405 426
406 add_library(ModalityWorklists SHARED 427 add_library(ModalityWorklists SHARED
407 ${BOOST_SOURCES}
408 ${JSONCPP_SOURCES}
409 ${LIBICONV_SOURCES}
410 Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
411 Plugins/Samples/ModalityWorklists/Plugin.cpp 428 Plugins/Samples/ModalityWorklists/Plugin.cpp
412 ${MODALITY_WORKLISTS_RESOURCES} 429 ${MODALITY_WORKLISTS_RESOURCES}
413 ) 430 )
431
432 target_link_libraries(ModalityWorklists ThirdPartyPlugins)
414 433
415 set_target_properties( 434 set_target_properties(
416 ModalityWorklists PROPERTIES 435 ModalityWorklists PROPERTIES
417 VERSION ${ORTHANC_VERSION} 436 VERSION ${ORTHANC_VERSION}
418 SOVERSION ${ORTHANC_VERSION} 437 SOVERSION ${ORTHANC_VERSION}