CTestTargets.cmake 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #=============================================================================
  2. # Copyright 2005-2009 Kitware, Inc.
  3. #
  4. # Distributed under the OSI-approved BSD License (the "License");
  5. # see accompanying file Copyright.txt for details.
  6. #
  7. # This software is distributed WITHOUT ANY WARRANTY; without even the
  8. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. # See the License for more information.
  10. #=============================================================================
  11. # (To distributed this file outside of CMake, substitute the full
  12. # License text for the above reference.)
  13. IF(NOT RUN_FROM_CTEST_OR_DART)
  14. MESSAGE(FATAL_ERROR "Do not incldue CTestTargets.cmake directly")
  15. ENDIF(NOT RUN_FROM_CTEST_OR_DART)
  16. # make directories in the binary tree
  17. FILE(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/Testing/Temporary)
  18. GET_FILENAME_COMPONENT(CMAKE_HOST_PATH ${CMAKE_COMMAND} PATH)
  19. SET(CMAKE_TARGET_PATH ${EXECUTABLE_OUTPUT_PATH})
  20. FIND_PROGRAM(CMAKE_CTEST_COMMAND ctest ${CMAKE_HOST_PATH} ${CMAKE_TARGET_PATH})
  21. MARK_AS_ADVANCED(CMAKE_CTEST_COMMAND)
  22. # Use CTest
  23. # configure files
  24. IF(CTEST_NEW_FORMAT)
  25. CONFIGURE_FILE(
  26. ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
  27. ${PROJECT_BINARY_DIR}/CTestConfiguration.ini )
  28. ELSE(CTEST_NEW_FORMAT)
  29. CONFIGURE_FILE(
  30. ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
  31. ${PROJECT_BINARY_DIR}/DartConfiguration.tcl )
  32. ENDIF(CTEST_NEW_FORMAT)
  33. #
  34. # Section 3:
  35. #
  36. # Custom targets to perform dashboard builds and submissions.
  37. # These should NOT need to be modified from project to project.
  38. #
  39. SET(__conf_types "")
  40. IF(CMAKE_CONFIGURATION_TYPES)
  41. # We need to pass the configuration type on the test command line.
  42. SET(__conf_types -C "${CMAKE_CFG_INTDIR}")
  43. ENDIF(CMAKE_CONFIGURATION_TYPES)
  44. # Add convenience targets. Do this at most once in case of nested
  45. # projects.
  46. DEFINE_PROPERTY(GLOBAL PROPERTY CTEST_TARGETS_ADDED
  47. BRIEF_DOCS "Internal property used by CTestTargets module."
  48. FULL_DOCS "Set by the CTestTargets module to track addition of testing targets."
  49. )
  50. GET_PROPERTY(_CTEST_TARGETS_ADDED GLOBAL PROPERTY CTEST_TARGETS_ADDED)
  51. IF(NOT _CTEST_TARGETS_ADDED)
  52. SET_PROPERTY(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1)
  53. # For all generators add basic testing targets.
  54. FOREACH(mode Experimental Nightly Continuous NightlyMemoryCheck)
  55. ADD_CUSTOM_TARGET(${mode}
  56. ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}
  57. )
  58. SET_PROPERTY(TARGET ${mode} PROPERTY RULE_LAUNCH_CUSTOM "")
  59. ENDFOREACH(mode)
  60. # For Makefile generators add more granular targets.
  61. IF("${CMAKE_GENERATOR}" MATCHES Make)
  62. # Make targets for Experimental builds
  63. FOREACH(mode Nightly Experimental Continuous)
  64. FOREACH(testtype
  65. Start Update Configure Build Test Coverage MemCheck Submit
  66. # missing purify
  67. )
  68. ADD_CUSTOM_TARGET(${mode}${testtype}
  69. ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype}
  70. )
  71. SET_PROPERTY(TARGET ${mode}${testtype} PROPERTY RULE_LAUNCH_CUSTOM "")
  72. ENDFOREACH(testtype)
  73. ENDFOREACH(mode)
  74. ENDIF("${CMAKE_GENERATOR}" MATCHES Make)
  75. ENDIF(NOT _CTEST_TARGETS_ADDED)