comparison OrthancServer/CMakeLists.txt @ 5357:fddb5d8d0021

Prevent the leak of the full path of the source files in the binaries
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 06 Jul 2023 17:04:31 +0200
parents 7cb1b851f5c8
children 48b8dae6dc77
comparison
equal deleted inserted replaced
5354:65b4e6ae2703 5357:fddb5d8d0021
377 ${ORTHANC_CORE_SOURCES} 377 ${ORTHANC_CORE_SOURCES}
378 ${ORTHANC_DICOM_SOURCES} 378 ${ORTHANC_DICOM_SOURCES}
379 ${AUTOGENERATED_SOURCES} 379 ${AUTOGENERATED_SOURCES}
380 ) 380 )
381 381
382 DefineSourceBasenameForTarget(CoreLibrary)
383
382 add_dependencies(CoreLibrary AutogeneratedTarget) 384 add_dependencies(CoreLibrary AutogeneratedTarget)
383 385
384 if (LIBICU_LIBRARIES) 386 if (LIBICU_LIBRARIES)
385 target_link_libraries(CoreLibrary ${LIBICU_LIBRARIES}) 387 target_link_libraries(CoreLibrary ${LIBICU_LIBRARIES})
386 endif() 388 endif()
392 394
393 if (ENABLE_PLUGINS) 395 if (ENABLE_PLUGINS)
394 add_custom_command( 396 add_custom_command(
395 COMMAND 397 COMMAND
396 ${PROTOC_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Plugins/Include/orthanc/OrthancDatabasePlugin.proto --cpp_out=${AUTOGENERATED_DIR} -I${CMAKE_SOURCE_DIR}/Plugins/Include/orthanc 398 ${PROTOC_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Plugins/Include/orthanc/OrthancDatabasePlugin.proto --cpp_out=${AUTOGENERATED_DIR} -I${CMAKE_SOURCE_DIR}/Plugins/Include/orthanc
399 COMMAND
400 ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Resources/PreventProtobufDirectoryLeaks.py ${AUTOGENERATED_DIR}/OrthancDatabasePlugin.pb.cc
397 DEPENDS 401 DEPENDS
398 ProtobufCompiler 402 ProtobufCompiler
403 ${CMAKE_SOURCE_DIR}/Resources/PreventProtobufDirectoryLeaks.py
399 ${CMAKE_SOURCE_DIR}/Plugins/Include/orthanc/OrthancDatabasePlugin.proto 404 ${CMAKE_SOURCE_DIR}/Plugins/Include/orthanc/OrthancDatabasePlugin.proto
400 OUTPUT 405 OUTPUT
401 ${AUTOGENERATED_DIR}/OrthancDatabasePlugin.pb.cc 406 ${AUTOGENERATED_DIR}/OrthancDatabasePlugin.pb.cc
402 ${AUTOGENERATED_DIR}/OrthancDatabasePlugin.pb.h 407 ${AUTOGENERATED_DIR}/OrthancDatabasePlugin.pb.h
403 ) 408 )
418 STATIC 423 STATIC
419 ${ORTHANC_SERVER_PCH} 424 ${ORTHANC_SERVER_PCH}
420 ${ORTHANC_SERVER_SOURCES} 425 ${ORTHANC_SERVER_SOURCES}
421 ) 426 )
422 427
428 DefineSourceBasenameForTarget(ServerLibrary)
429
423 # Ensure autogenerated code is built before building ServerLibrary 430 # Ensure autogenerated code is built before building ServerLibrary
424 add_dependencies(ServerLibrary CoreLibrary OrthancDatabaseProtobuf) 431 add_dependencies(ServerLibrary CoreLibrary OrthancDatabaseProtobuf)
425 432
426 add_executable(Orthanc 433 add_executable(Orthanc
427 ${CMAKE_SOURCE_DIR}/Sources/main.cpp 434 ${CMAKE_SOURCE_DIR}/Sources/main.cpp
428 ${ORTHANC_RESOURCES} 435 ${ORTHANC_RESOURCES}
429 ) 436 )
437
438 DefineSourceBasenameForTarget(Orthanc)
430 439
431 target_link_libraries(Orthanc ServerLibrary CoreLibrary ${DCMTK_LIBRARIES}) 440 target_link_libraries(Orthanc ServerLibrary CoreLibrary ${DCMTK_LIBRARIES})
432 441
433 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") 442 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
434 # The link flag below hides all the global functions so that a Linux 443 # The link flag below hides all the global functions so that a Linux
455 ${ORTHANC_UNIT_TESTS_PCH} 464 ${ORTHANC_UNIT_TESTS_PCH}
456 ${ORTHANC_FRAMEWORK_UNIT_TESTS} 465 ${ORTHANC_FRAMEWORK_UNIT_TESTS}
457 ${ORTHANC_SERVER_UNIT_TESTS} 466 ${ORTHANC_SERVER_UNIT_TESTS}
458 ${BOOST_EXTENDED_SOURCES} 467 ${BOOST_EXTENDED_SOURCES}
459 ) 468 )
469
470 DefineSourceBasenameForTarget(UnitTests)
460 471
461 target_link_libraries(UnitTests 472 target_link_libraries(UnitTests
462 ServerLibrary 473 ServerLibrary
463 CoreLibrary 474 CoreLibrary
464 ${DCMTK_LIBRARIES} 475 ${DCMTK_LIBRARIES}
504 515
505 add_library(PluginsDependencies STATIC 516 add_library(PluginsDependencies STATIC
506 ${PLUGINS_DEPENDENCIES_SOURCES} 517 ${PLUGINS_DEPENDENCIES_SOURCES}
507 ) 518 )
508 519
520 DefineSourceBasenameForTarget(PluginsDependencies)
521
509 # Add the "-fPIC" option as this static library must be embedded 522 # Add the "-fPIC" option as this static library must be embedded
510 # inside shared libraries (important on UNIX) 523 # inside shared libraries (important on UNIX)
511 set_target_properties( 524 set_target_properties(
512 PluginsDependencies 525 PluginsDependencies
513 PROPERTIES POSITION_INDEPENDENT_CODE ON 526 PROPERTIES POSITION_INDEPENDENT_CODE ON
544 add_library(ServeFolders SHARED 557 add_library(ServeFolders SHARED
545 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ServeFolders/Plugin.cpp 558 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ServeFolders/Plugin.cpp
546 ${SERVE_FOLDERS_RESOURCES} 559 ${SERVE_FOLDERS_RESOURCES}
547 ) 560 )
548 561
562 DefineSourceBasenameForTarget(ServeFolders)
563
549 target_link_libraries(ServeFolders PluginsDependencies) 564 target_link_libraries(ServeFolders PluginsDependencies)
550 565
551 set_target_properties( 566 set_target_properties(
552 ServeFolders PROPERTIES 567 ServeFolders PROPERTIES
553 VERSION ${ORTHANC_VERSION} 568 VERSION ${ORTHANC_VERSION}
592 add_library(ModalityWorklists SHARED 607 add_library(ModalityWorklists SHARED
593 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ModalityWorklists/Plugin.cpp 608 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ModalityWorklists/Plugin.cpp
594 ${MODALITY_WORKLISTS_RESOURCES} 609 ${MODALITY_WORKLISTS_RESOURCES}
595 ) 610 )
596 611
612 DefineSourceBasenameForTarget(ModalityWorklists)
613
597 target_link_libraries(ModalityWorklists PluginsDependencies) 614 target_link_libraries(ModalityWorklists PluginsDependencies)
598 615
599 set_target_properties( 616 set_target_properties(
600 ModalityWorklists PROPERTIES 617 ModalityWorklists PROPERTIES
601 VERSION ${ORTHANC_VERSION} 618 VERSION ${ORTHANC_VERSION}
653 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ConnectivityChecks/Plugin.cpp 670 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ConnectivityChecks/Plugin.cpp
654 671
655 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ConnectivityChecks/OrthancFrameworkDependencies.cpp 672 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ConnectivityChecks/OrthancFrameworkDependencies.cpp
656 ${CONNECTIVITY_CHECKS_RESOURCES} 673 ${CONNECTIVITY_CHECKS_RESOURCES}
657 ) 674 )
658 675
676 DefineSourceBasenameForTarget(ConnectivityChecks)
677
659 target_link_libraries(ConnectivityChecks PluginsDependencies) 678 target_link_libraries(ConnectivityChecks PluginsDependencies)
660 679
661 set_target_properties( 680 set_target_properties(
662 ConnectivityChecks PROPERTIES 681 ConnectivityChecks PROPERTIES
663 VERSION ${ORTHANC_VERSION} 682 VERSION ${ORTHANC_VERSION}
706 725
707 ${CMAKE_SOURCE_DIR}/Plugins/Samples/DelayedDeletion/OrthancFrameworkDependencies.cpp 726 ${CMAKE_SOURCE_DIR}/Plugins/Samples/DelayedDeletion/OrthancFrameworkDependencies.cpp
708 ${DELAYED_DELETION_RESOURCES} 727 ${DELAYED_DELETION_RESOURCES}
709 ) 728 )
710 729
730 DefineSourceBasenameForTarget(DelayedDeletion)
731
711 target_link_libraries(DelayedDeletion PluginsDependencies) 732 target_link_libraries(DelayedDeletion PluginsDependencies)
712 733
713 set_target_properties( 734 set_target_properties(
714 DelayedDeletion PROPERTIES 735 DelayedDeletion PROPERTIES
715 VERSION ${ORTHANC_VERSION} 736 VERSION ${ORTHANC_VERSION}
753 add_library(Housekeeper SHARED 774 add_library(Housekeeper SHARED
754 ${CMAKE_SOURCE_DIR}/Plugins/Samples/Housekeeper/Plugin.cpp 775 ${CMAKE_SOURCE_DIR}/Plugins/Samples/Housekeeper/Plugin.cpp
755 ${HOUSEKEEPER_RESOURCES} 776 ${HOUSEKEEPER_RESOURCES}
756 ) 777 )
757 778
779 DefineSourceBasenameForTarget(Housekeeper)
780
758 target_link_libraries(Housekeeper PluginsDependencies) 781 target_link_libraries(Housekeeper PluginsDependencies)
759 782
760 set_target_properties( 783 set_target_properties(
761 Housekeeper PROPERTIES 784 Housekeeper PROPERTIES
762 VERSION ${ORTHANC_VERSION} 785 VERSION ${ORTHANC_VERSION}
818 ${CMAKE_SOURCE_DIR}/Plugins/Samples/MultitenantDicom/OrthancFrameworkDependencies.cpp 841 ${CMAKE_SOURCE_DIR}/Plugins/Samples/MultitenantDicom/OrthancFrameworkDependencies.cpp
819 ${AUTOGENERATED_DIR}/MultitenantDicomResources.cpp 842 ${AUTOGENERATED_DIR}/MultitenantDicomResources.cpp
820 ${MULTITENANT_DICOM_RESOURCES} 843 ${MULTITENANT_DICOM_RESOURCES}
821 ) 844 )
822 845
846 DefineSourceBasenameForTarget(MultitenantDicom)
847
823 target_link_libraries(MultitenantDicom PluginsDependencies ${DCMTK_LIBRARIES}) 848 target_link_libraries(MultitenantDicom PluginsDependencies ${DCMTK_LIBRARIES})
824 849
825 set_target_properties( 850 set_target_properties(
826 MultitenantDicom PROPERTIES 851 MultitenantDicom PROPERTIES
827 VERSION ${ORTHANC_VERSION} 852 VERSION ${ORTHANC_VERSION}
863 ${AUTOGENERATED_DIR}/OrthancRecoverCompressedFile.rc 888 ${AUTOGENERATED_DIR}/OrthancRecoverCompressedFile.rc
864 ) 889 )
865 endif() 890 endif()
866 891
867 add_executable(OrthancRecoverCompressedFile ${RECOVER_COMPRESSED_SOURCES}) 892 add_executable(OrthancRecoverCompressedFile ${RECOVER_COMPRESSED_SOURCES})
893 DefineSourceBasenameForTarget(OrthancRecoverCompressedFile)
868 894
869 target_link_libraries(OrthancRecoverCompressedFile CoreLibrary) 895 target_link_libraries(OrthancRecoverCompressedFile CoreLibrary)
870 896
871 install( 897 install(
872 TARGETS OrthancRecoverCompressedFile 898 TARGETS OrthancRecoverCompressedFile