RunCMakeTest.cmake 1.2 KB

123456789101112131415161718192021222324252627282930
  1. include(RunCTest)
  2. function(run_InstrumentationInCTestXML CASE_NAME USE_INSTRUMENTATION USE_VERBOSE_INSTRUMENTATION)
  3. if(USE_VERBOSE_INSTRUMENTATION)
  4. set(ENV{CTEST_USE_VERBOSE_INSTRUMENTATION} "1")
  5. set(RunCMake_USE_VERBOSE_INSTRUMENTATION TRUE)
  6. else()
  7. set(ENV{CTEST_USE_VERBOSE_INSTRUMENTATION} "0")
  8. set(RunCMake_USE_VERBOSE_INSTRUMENTATION FALSE)
  9. endif()
  10. if(USE_INSTRUMENTATION)
  11. set(ENV{CTEST_USE_INSTRUMENTATION} "1")
  12. set(ENV{CTEST_EXPERIMENTAL_INSTRUMENTATION} "a37d1069-1972-4901-b9c9-f194aaf2b6e0")
  13. set(RunCMake_USE_INSTRUMENTATION TRUE)
  14. set(CASE_NAME InstrumentationInCTestXML)
  15. else()
  16. set(ENV{CTEST_USE_INSTRUMENTATION} "0")
  17. set(ENV{CTEST_EXPERIMENTAL_INSTRUMENTATION} "0")
  18. set(RunCMake_USE_INSTRUMENTATION FALSE)
  19. set(CASE_NAME NoInstrumentationInCTestXML)
  20. endif()
  21. configure_file(${RunCMake_SOURCE_DIR}/main.c
  22. ${RunCMake_BINARY_DIR}/${CASE_NAME}/main.c COPYONLY)
  23. run_ctest("${CASE_NAME}")
  24. unset(RunCMake_USE_LAUNCHERS)
  25. unset(RunCMake_USE_INSTRUMENTATION)
  26. endfunction()
  27. run_InstrumentationInCTestXML(InstrumentationInCTestXML ON OFF)
  28. run_InstrumentationInCTestXML(VerboseInstrumentationInCTestXML ON ON)
  29. run_InstrumentationInCTestXML(NoInstrumentationInCTestXML OFF OFF)