ITK.cmake 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 "${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. UPDATE_COMMAND ""
  47. INSTALL_COMMAND ""
  48. CMAKE_CACHE_ARGS
  49. ${ep_common_cache_args}
  50. ${ep_project_include_arg}
  51. -DBUILD_EXAMPLES:BOOL=OFF
  52. -DBUILD_SHARED_LIBS:BOOL=ON
  53. -DITK_USE_REVIEW:BOOL=ON
  54. -DITK_USE_REVIEW_STATISTICS:BOOL=ON
  55. -DITK_USE_OPTIMIZED_REGISTRATION_METHODS:BOOL=ON
  56. -DITK_USE_PORTABLE_ROUND:BOOL=ON
  57. -DITK_USE_CENTERED_PIXEL_COORDINATES_CONSISTENTLY:BOOL=ON
  58. -DITK_USE_TRANSFORM_IO_FACTORIES:BOOL=ON
  59. -DITK_LEGACY_REMOVE:BOOL=ON
  60. DEPENDS
  61. ${${proj}_DEPENDENCIES}
  62. )
  63. set(ITK_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
  64. else()
  65. ExternalProject_Add_Empty(${proj} DEPENDS ${${proj}_DEPENDENCIES})
  66. endif()
  67. mark_as_superbuild(
  68. VARS ITK_DIR:PATH
  69. LABELS "FIND_PACKAGE"
  70. )