DCMTK.cmake 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 085525e643cab5ac82)
  19. if(${proj}_REVISION_TAG)
  20. set(revision_tag ${${proj}_REVISION_TAG})
  21. endif()
  22. # message(STATUS "Adding project:${proj}")
  23. ExternalProject_Add(${proj}
  24. SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
  25. BINARY_DIR ${proj}-build
  26. PREFIX ${proj}${ep_suffix}
  27. GIT_REPOSITORY "${git_protocol}://git.dcmtk.org/dcmtk.git"
  28. GIT_TAG ${revision_tag}
  29. CMAKE_GENERATOR ${gen}
  30. UPDATE_COMMAND ""
  31. BUILD_COMMAND ""
  32. CMAKE_CACHE_ARGS
  33. ${ep_common_cache_args}
  34. -DDCMTK_WITH_ZLIB:BOOL=OFF # see github issue #25
  35. -DDCMTK_WITH_OPENSSL:BOOL=OFF # see github issue #25
  36. -DDCMTK_WITH_PNG:BOOL=OFF # see github issue #25
  37. -DDCMTK_WITH_TIFF:BOOL=OFF # see github issue #25
  38. -DDCMTK_WITH_XML:BOOL=OFF # see github issue #25
  39. -DDCMTK_FORCE_FPIC_ON_UNIX:BOOL=ON
  40. -DDCMTK_OVERWRITE_WIN32_COMPILER_FLAGS:BOOL=OFF
  41. )
  42. set(DCMTK_DIR ${ep_install_dir})
  43. # This was used during heavy development on DCMTK itself.
  44. # Disabling it for now. (It also leads to to build errors
  45. # with the XCode CMake generator on Mac).
  46. #
  47. # ExternalProject_Add_Step(${proj} force_rebuild
  48. # COMMENT "Force ${proj} re-build"
  49. # DEPENDERS build # Steps that depend on this step
  50. # ALWAYS 1
  51. # WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${proj}-build
  52. # DEPENDS
  53. # ${proj_DEPENDENCIES}
  54. # )
  55. # Since DCMTK is statically build, there is not need to add its corresponding
  56. # library output directory to CTK_EXTERNAL_LIBRARY_DIRS
  57. else()
  58. ctkMacroEmptyExternalproject(${proj} "${proj_DEPENDENCIES}")
  59. endif()
  60. list(APPEND CTK_SUPERBUILD_EP_VARS DCMTK_DIR:PATH)
  61. endif()
  62. endif()