OpenIGTLink.cmake 1.6 KB

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