TheExternal_LibA.cmake 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #
  2. # LibA
  3. #
  4. superbuild_include_once()
  5. set(proj LibA)
  6. set(${proj}_DEPENDENCIES "")
  7. superbuild_include_dependencies(PROJECT_VAR proj)
  8. if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
  9. message(FATAL_ERROR "Enabling ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} is not supported !")
  10. endif()
  11. mark_as_superbuild(
  12. VARS ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}:BOOL
  13. LABELS "USE_SYSTEM"
  14. )
  15. # Sanity checks
  16. if(DEFINED LibA_DIR AND NOT EXISTS ${LibA_DIR})
  17. message(FATAL_ERROR "LibA_DIR variable is defined but corresponds to non-existing directory")
  18. endif()
  19. if(NOT DEFINED LibA_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
  20. ExternalProject_Add(${proj}
  21. ${${proj}_EXTERNAL_PROJECT_ARGS}
  22. SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${proj}
  23. BINARY_DIR ${proj}-build
  24. DOWNLOAD_COMMAND ""
  25. BUILD_COMMAND ""
  26. INSTALL_COMMAND ""
  27. DEPENDS
  28. ${${proj}_DEPENDENCIES}
  29. )
  30. set(LibA_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
  31. else()
  32. superbuild_add_empty_external_project(${proj} "${${proj}_DEPENDENCIES}")
  33. endif()
  34. mark_as_superbuild(
  35. VARS LibA_DIR:PATH
  36. LABELS "FIND_PACKAGE"
  37. )