DCMTK.cmake 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #
  2. # DCMTK
  3. #
  4. superbuild_include_once()
  5. set(DCMTK_enabling_variable DCMTK_LIBRARIES)
  6. set(${DCMTK_enabling_variable}_INCLUDE_DIRS DCMTK_INCLUDE_DIR)
  7. set(${DCMTK_enabling_variable}_FIND_PACKAGE_CMD DCMTK)
  8. set(DCMTK_DEPENDENCIES "")
  9. ctkMacroCheckExternalProjectDependency(DCMTK)
  10. set(proj DCMTK)
  11. if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
  12. unset(DCMTK_DIR CACHE)
  13. find_package(DCMTK REQUIRED)
  14. endif()
  15. # Sanity checks
  16. if(DEFINED DCMTK_DIR AND NOT EXISTS ${DCMTK_DIR})
  17. message(FATAL_ERROR "DCMTK_DIR variable is defined but corresponds to non-existing directory")
  18. endif()
  19. if(NOT DEFINED DCMTK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
  20. set(revision_tag ae3b946f6e6231)
  21. if(${proj}_REVISION_TAG)
  22. set(revision_tag ${${proj}_REVISION_TAG})
  23. endif()
  24. set(location_args )
  25. if(${proj}_URL)
  26. set(location_args URL ${${proj}_URL})
  27. elseif(${proj}_GIT_REPOSITORY)
  28. set(location_args GIT_REPOSITORY ${${proj}_GIT_REPOSITORY}
  29. GIT_TAG ${revision_tag})
  30. else()
  31. set(location_args GIT_REPOSITORY "${git_protocol}://git.dcmtk.org/dcmtk.git"
  32. GIT_TAG ${revision_tag})
  33. endif()
  34. set(ep_project_include_arg)
  35. if(CTEST_USE_LAUNCHERS)
  36. set(ep_project_include_arg
  37. "-DCMAKE_PROJECT_DCMTK_INCLUDE:FILEPATH=${CMAKE_ROOT}/Modules/CTestUseLaunchers.cmake")
  38. endif()
  39. ExternalProject_Add(${proj}
  40. SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
  41. BINARY_DIR ${proj}-build
  42. PREFIX ${proj}${ep_suffix}
  43. ${location_args}
  44. CMAKE_GENERATOR ${gen}
  45. UPDATE_COMMAND ""
  46. BUILD_COMMAND ""
  47. LIST_SEPARATOR ${sep}
  48. CMAKE_ARGS
  49. -DDCMTK_INSTALL_BINDIR:STRING=bin/${CMAKE_CFG_INTDIR}
  50. -DDCMTK_INSTALL_LIBDIR:STRING=lib/${CMAKE_CFG_INTDIR}
  51. CMAKE_CACHE_ARGS
  52. ${ep_common_cache_args}
  53. ${ep_project_include_arg}
  54. -DBUILD_SHARED_LIBS:BOOL=OFF
  55. -DDCMTK_WITH_DOXYGEN:BOOL=OFF
  56. -DDCMTK_WITH_ZLIB:BOOL=OFF # see github issue #25
  57. -DDCMTK_WITH_OPENSSL:BOOL=OFF # see github issue #25
  58. -DDCMTK_WITH_PNG:BOOL=OFF # see github issue #25
  59. -DDCMTK_WITH_TIFF:BOOL=OFF # see github issue #25
  60. -DDCMTK_WITH_XML:BOOL=OFF # see github issue #25
  61. -DDCMTK_WITH_ICONV:BOOL=OFF # see github issue #178
  62. -DDCMTK_FORCE_FPIC_ON_UNIX:BOOL=ON
  63. -DDCMTK_OVERWRITE_WIN32_COMPILER_FLAGS:BOOL=OFF
  64. DEPENDS
  65. ${${proj}_DEPENDENCIES}
  66. )
  67. set(DCMTK_DIR ${ep_install_dir})
  68. # This was used during heavy development on DCMTK itself.
  69. # Disabling it for now. (It also leads to to build errors
  70. # with the XCode CMake generator on Mac).
  71. #
  72. # ExternalProject_Add_Step(${proj} force_rebuild
  73. # COMMENT "Force ${proj} re-build"
  74. # DEPENDERS build # Steps that depend on this step
  75. # ALWAYS 1
  76. # WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${proj}-build
  77. # DEPENDS
  78. # ${proj_DEPENDENCIES}
  79. # )
  80. # Since DCMTK is statically build, there is not need to add its corresponding
  81. # library output directory to CTK_EXTERNAL_LIBRARY_DIRS
  82. else()
  83. ctkMacroEmptyExternalproject(${proj} "${${proj}_DEPENDENCIES}")
  84. endif()
  85. list(APPEND CTK_SUPERBUILD_EP_VARS
  86. DCMTK_DIR:PATH
  87. )