QtTesting.cmake 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #
  2. # QtTesting
  3. #
  4. set(proj QtTesting)
  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 QtTesting_DIR AND NOT EXISTS ${QtTesting_DIR})
  17. message(FATAL_ERROR "QtTesting_DIR variable is defined but corresponds to non-existing directory")
  18. endif()
  19. if(NOT DEFINED QtTesting_DIR)
  20. set(revision_tag 7dbef1003157941e7315220f53cf4e17d78b5e28)
  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}://paraview.org/QtTesting.git"
  32. GIT_TAG ${revision_tag})
  33. endif()
  34. # Set CMake OSX variable to pass down the external project
  35. set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
  36. if(APPLE)
  37. list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS
  38. -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
  39. -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
  40. -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET})
  41. endif()
  42. message(STATUS "Adding project:${proj}")
  43. ExternalProject_Add(${proj}
  44. ${${proj}_EXTERNAL_PROJECT_ARGS}
  45. SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
  46. BINARY_DIR ${proj}-build
  47. PREFIX ${proj}${ep_suffix}
  48. ${location_args}
  49. UPDATE_COMMAND ""
  50. CMAKE_CACHE_ARGS
  51. ${ep_common_cache_args}
  52. -DBUILD_SHARED_LIBS:BOOL=ON
  53. -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
  54. DEPENDS
  55. ${${proj}_DEPENDENCIES}
  56. )
  57. set(QtTesting_INSTALL_DIR ${ep_install_dir})
  58. set(QtTesting_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
  59. else()
  60. ExternalProject_Add_Empty(${proj} DEPENDS ${${proj}_DEPENDENCIES})
  61. endif()
  62. mark_as_superbuild(
  63. VARS
  64. QtTesting_INSTALL_DIR:PATH
  65. QtTesting_DIR:PATH
  66. LABELS "FIND_PACKAGE"
  67. )