DCMTK.cmake 2.7 KB

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