RunCMakeTest.cmake 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. include(RunCMake)
  2. function(run_GoogleTest)
  3. # Use a single build tree for a few tests without cleaning.
  4. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/GoogleTest-build)
  5. set(RunCMake_TEST_NO_CLEAN 1)
  6. if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
  7. set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
  8. endif()
  9. file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
  10. file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
  11. run_cmake(GoogleTest)
  12. run_cmake_command(GoogleTest-build
  13. ${CMAKE_COMMAND}
  14. --build .
  15. --config Debug
  16. --target fake_gtest
  17. )
  18. set(RunCMake_TEST_OUTPUT_MERGE 1)
  19. run_cmake_command(GoogleTest-timeout
  20. ${CMAKE_COMMAND}
  21. --build .
  22. --config Debug
  23. --target timeout_test
  24. )
  25. set(RunCMake_TEST_OUTPUT_MERGE 0)
  26. run_cmake_command(GoogleTest-test1
  27. ${CMAKE_CTEST_COMMAND}
  28. -C Debug
  29. -L TEST1
  30. --no-label-summary
  31. )
  32. run_cmake_command(GoogleTest-test2
  33. ${CMAKE_CTEST_COMMAND}
  34. -C Debug
  35. -L TEST2
  36. --no-label-summary
  37. )
  38. run_cmake_command(GoogleTest-test-missing
  39. ${CMAKE_CTEST_COMMAND}
  40. -C Debug
  41. -R timeout
  42. --no-label-summary
  43. )
  44. endfunction()
  45. run_GoogleTest()