OpenIGTLink.cmake 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #
  2. # OpenIGTLink
  3. #
  4. superbuild_include_once()
  5. set(proj OpenIGTLink)
  6. set(${proj}_DEPENDENCIES "")
  7. superbuild_include_dependencies(PROJECT_VAR proj)
  8. if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
  9. unset(OpenIGTLink_DIR CACHE)
  10. find_package(OpenIGTLink REQUIRED NO_MODULE)
  11. endif()
  12. # Sanity checks
  13. if(DEFINED OpenIGTLink_DIR AND NOT EXISTS ${OpenIGTLink_DIR})
  14. message(FATAL_ERROR "OpenIGTLink_DIR variable is defined but corresponds to non-existing directory")
  15. endif()
  16. if(NOT DEFINED OpenIGTLink_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
  17. set(location_args )
  18. if(${proj}_URL)
  19. set(location_args URL ${${proj}_URL})
  20. else()
  21. set(location_args SVN_REPOSITORY "http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink")
  22. endif()
  23. set(ep_project_include_arg)
  24. if(CTEST_USE_LAUNCHERS)
  25. set(ep_project_include_arg
  26. "-DCMAKE_PROJECT_OpenIGTLink_INCLUDE:FILEPATH=${CMAKE_ROOT}/Modules/CTestUseLaunchers.cmake")
  27. endif()
  28. ExternalProject_Add(${proj}
  29. ${${proj}_EXTERNAL_PROJECT_ARGS}
  30. SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
  31. BINARY_DIR ${proj}-build
  32. PREFIX ${proj}${ep_suffix}
  33. ${location_args}
  34. INSTALL_COMMAND ""
  35. CMAKE_CACHE_ARGS
  36. ${ep_common_cache_args}
  37. ${ep_project_include_arg}
  38. DEPENDS
  39. ${${proj}_DEPENDENCIES}
  40. )
  41. set(OpenIGTLink_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
  42. else()
  43. superbuild_add_empty_external_project(${proj} "${${proj}_DEPENDENCIES}")
  44. endif()
  45. mark_as_superbuild(
  46. VARS OpenIGTLink_DIR:PATH
  47. LABELS "FIND_PACKAGE"
  48. )