ITK.cmake 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #
  2. # ITK
  3. #
  4. set(proj ITK)
  5. set(${proj}_DEPENDENCIES "")
  6. ExternalProject_Include_Dependencies(${proj}
  7. PROJECT_VAR proj
  8. DEPENDS_VAR ${proj}_DEPENDENCIES
  9. EP_ARGS_VAR ${proj}_EXTERNAL_PROJECT_ARGS
  10. USE_SYSTEM_VAR ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}
  11. )
  12. if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
  13. unset(ITK_DIR CACHE)
  14. find_package(ITK REQUIRED NO_MODULE)
  15. endif()
  16. # Sanity checks
  17. if(DEFINED ITK_DIR AND NOT EXISTS ${ITK_DIR})
  18. message(FATAL_ERROR "ITK_DIR variable is defined but corresponds to non-existing directory")
  19. endif()
  20. if(NOT DEFINED ITK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
  21. set(revision_tag "v3.20.1")
  22. if(${proj}_REVISION_TAG)
  23. set(revision_tag ${${proj}_REVISION_TAG})
  24. endif()
  25. set(location_args )
  26. if(${proj}_URL)
  27. set(location_args URL ${${proj}_URL})
  28. elseif(${proj}_GIT_REPOSITORY)
  29. set(location_args GIT_REPOSITORY ${${proj}_GIT_REPOSITORY}
  30. GIT_TAG ${revision_tag})
  31. else()
  32. set(location_args GIT_REPOSITORY "${EP_GIT_PROTOCOL}://itk.org/ITK.git"
  33. GIT_TAG ${revision_tag})
  34. endif()
  35. set(ep_project_include_arg)
  36. if(CTEST_USE_LAUNCHERS)
  37. set(ep_project_include_arg
  38. "-DCMAKE_PROJECT_ITK_INCLUDE:FILEPATH=${CMAKE_ROOT}/Modules/CTestUseLaunchers.cmake")
  39. endif()
  40. ExternalProject_Add(${proj}
  41. ${${proj}_EXTERNAL_PROJECT_ARGS}
  42. SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
  43. BINARY_DIR ${proj}-build
  44. PREFIX ${proj}${ep_suffix}
  45. ${location_args}
  46. INSTALL_COMMAND ""
  47. CMAKE_CACHE_ARGS
  48. ${ep_common_cache_args}
  49. ${ep_project_include_arg}
  50. -DBUILD_EXAMPLES:BOOL=OFF
  51. -DBUILD_SHARED_LIBS:BOOL=ON
  52. -DITK_USE_REVIEW:BOOL=ON
  53. -DITK_USE_REVIEW_STATISTICS:BOOL=ON
  54. -DITK_USE_OPTIMIZED_REGISTRATION_METHODS:BOOL=ON
  55. -DITK_USE_PORTABLE_ROUND:BOOL=ON
  56. -DITK_USE_CENTERED_PIXEL_COORDINATES_CONSISTENTLY:BOOL=ON
  57. -DITK_USE_TRANSFORM_IO_FACTORIES:BOOL=ON
  58. -DITK_LEGACY_REMOVE:BOOL=ON
  59. DEPENDS
  60. ${${proj}_DEPENDENCIES}
  61. )
  62. set(ITK_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
  63. else()
  64. ExternalProject_Add_Empty(${proj} DEPENDS ${${proj}_DEPENDENCIES})
  65. endif()
  66. mark_as_superbuild(
  67. VARS ITK_DIR:PATH
  68. LABELS "FIND_PACKAGE"
  69. )