qRestAPI.cmake 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #
  2. # qRestAPI
  3. #
  4. set(proj qRestAPI)
  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. message(FATAL_ERROR "Enabling ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} is not supported !")
  14. endif()
  15. # Sanity checks
  16. if(DEFINED ${proj}_DIR AND NOT EXISTS ${${proj}_DIR})
  17. message(FATAL_ERROR "${proj}_DIR variable is defined but corresponds to non-existing directory")
  18. endif()
  19. if(NOT DEFINED ${proj}_DIR)
  20. set(revision_tag "c5e4c2a7d5")
  21. if(${proj}_REVISION_TAG)
  22. set(revision_tag ${${proj}_REVISION_TAG})
  23. endif()
  24. set(location_args )
  25. if(${proj}_URL)
  26. set(location_args URL ${${proj}_URL})
  27. elseif(${proj}_GIT_REPOSITORY)
  28. set(location_args GIT_REPOSITORY ${${proj}_GIT_REPOSITORY}
  29. GIT_TAG ${revision_tag})
  30. else()
  31. set(location_args GIT_REPOSITORY "${git_protocol}://github.com/commontk/qRestAPI.git"
  32. GIT_TAG ${revision_tag})
  33. endif()
  34. set(ep_cache_args)
  35. if(CTK_QT_VERSION VERSION_LESS "5")
  36. list(APPEND ep_cache_args
  37. -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
  38. )
  39. else()
  40. list(APPEND ep_cache_args
  41. -DQt5_DIR:PATH=${Qt5_DIR}
  42. )
  43. # XXX Backward compatible way
  44. if(DEFINED CMAKE_PREFIX_PATH)
  45. list(APPEND ep_cache_args
  46. -DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH}
  47. )
  48. endif()
  49. endif()
  50. ExternalProject_Add(${proj}
  51. ${${proj}_EXTERNAL_PROJECT_ARGS}
  52. SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
  53. BINARY_DIR ${proj}-build
  54. PREFIX ${proj}${ep_suffix}
  55. ${location_args}
  56. INSTALL_COMMAND ""
  57. CMAKE_CACHE_ARGS
  58. ${ep_common_cache_args}
  59. -DqRestAPI_QT_VERSION:STRING=${CTK_QT_VERSION}
  60. ${ep_cache_args}
  61. DEPENDS
  62. ${${proj}_DEPENDENCIES}
  63. )
  64. set(qRestAPI_DIR ${CMAKE_CURRENT_BINARY_DIR}/${proj}-build)
  65. else()
  66. ExternalProject_Add_Empty(${proj} DEPENDS ${${proj}_DEPENDENCIES})
  67. endif()
  68. mark_as_superbuild(
  69. VARS qRestAPI_DIR:PATH
  70. LABELS "FIND_PACKAGE"
  71. )