QtTesting.cmake 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #
  2. # QtTesting
  3. #
  4. set(QtTesting_DEPENDS)
  5. if(CTK_USE_QTTESTING)
  6. # Sanity checks
  7. if(DEFINED QtTesting_DIR AND NOT EXISTS ${QtTesting_DIR})
  8. message(FATAL_ERROR "QtTesting_DIR variable is defined but corresponds to non-existing directory")
  9. endif()
  10. set(proj QtTesting)
  11. set(proj_DEPENDENCIES)
  12. list(APPEND CTK_DEPENDENCIES ${proj})
  13. set(QtTesting_DEPENDS ${proj})
  14. set(${QtTesting_enabling_variable}_INCLUDE_DIRS QtTesting_INCLUDE_DIRS)
  15. set(${QtTesting_enabling_variable}_FIND_PACKAGE_CMD QtTesting)
  16. if(CTK_SUPERBUILD)
  17. if(NOT DEFINED QtTesting_DIR)
  18. set(revision_tag d26842afd5fc7c2fd6e08eb35bdaf982a9e61869)
  19. if(${proj}_REVISION_TAG)
  20. set(revision_tag ${${proj}_REVISION_TAG})
  21. endif()
  22. set(location_args )
  23. if(${proj}_URL)
  24. set(location_args URL ${${proj}_URL})
  25. elseif(${proj}_GIT_REPOSITORY)
  26. set(location_args GIT_REPOSITORY ${${proj}_GIT_REPOSITORY}
  27. GIT_TAG ${revision_tag})
  28. else()
  29. set(location_args GIT_REPOSITORY "${git_protocol}://github.com/benjaminlong/QtTesting.git"
  30. GIT_TAG ${revision_tag})
  31. endif()
  32. # Set CMake OSX variable to pass down the external project
  33. set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
  34. if(APPLE)
  35. list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS
  36. -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
  37. -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
  38. -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET})
  39. endif()
  40. message(STATUS "Adding project:${proj}")
  41. ExternalProject_Add(${proj}
  42. SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
  43. BINARY_DIR ${proj}-build
  44. PREFIX ${proj}${ep_suffix}
  45. ${location_args}
  46. CMAKE_GENERATOR ${gen}
  47. UPDATE_COMMAND ""
  48. CMAKE_CACHE_ARGS
  49. ${ep_common_cache_args}
  50. -DBUILD_SHARED_LIBS:BOOL=ON
  51. -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
  52. DEPENDS
  53. ${proj_DEPENDENCIES}
  54. )
  55. set(QtTesting_INSTALL_DIR ${ep_install_dir})
  56. set(QtTesting_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
  57. # Since QtTesting is statically build, there is not need to add its corresponding
  58. # library output directory to CTK_EXTERNAL_LIBRARY_DIRS
  59. else()
  60. ctkMacroEmptyExternalproject(${proj} "${proj_DEPENDENCIES}")
  61. endif()
  62. list(APPEND CTK_SUPERBUILD_EP_VARS
  63. QtTesting_INSTALL_DIR:PATH
  64. QtTesting_DIR:PATH
  65. )
  66. endif()
  67. endif()