ITK.cmake 2.3 KB

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