1
0

CTestTargets.cmake 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 distribute 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()
  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()
  29. configure_file(
  30. ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
  31. ${PROJECT_BINARY_DIR}/DartConfiguration.tcl )
  32. endif()
  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()
  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. set_property(TARGET ${mode} PROPERTY FOLDER "CTestDashboardTargets")
  60. endforeach()
  61. # For Makefile generators add more granular targets.
  62. if("${CMAKE_GENERATOR}" MATCHES "(Ninja|Make)")
  63. # Make targets for Experimental builds
  64. foreach(mode Nightly Experimental Continuous)
  65. foreach(testtype
  66. Start Update Configure Build Test Coverage MemCheck Submit
  67. # missing purify
  68. )
  69. add_custom_target(${mode}${testtype}
  70. ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype}
  71. )
  72. set_property(TARGET ${mode}${testtype} PROPERTY RULE_LAUNCH_CUSTOM "")
  73. set_property(TARGET ${mode}${testtype} PROPERTY FOLDER "CTestDashboardTargets")
  74. endforeach()
  75. endforeach()
  76. endif()
  77. # If requested, add an alias that is the equivalent of the built-in "test"
  78. # or "RUN_TESTS" target:
  79. if(CTEST_TEST_TARGET_ALIAS)
  80. add_custom_target(${CTEST_TEST_TARGET_ALIAS}
  81. ${CMAKE_CTEST_COMMAND} ${__conf_types}
  82. )
  83. endif()
  84. endif()