RunCMakeTest.cmake 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. include(RunCMake)
  2. run_cmake(IncludeScope-Add)
  3. run_cmake(IncludeScope-Add_Step)
  4. run_cmake(NoOptions)
  5. run_cmake(SourceEmpty)
  6. run_cmake(SourceMissing)
  7. run_cmake(CMAKE_CACHE_ARGS)
  8. run_cmake(CMAKE_CACHE_DEFAULT_ARGS)
  9. run_cmake(CMAKE_CACHE_mix)
  10. run_cmake(NO_DEPENDS)
  11. run_cmake(Add_StepDependencies)
  12. run_cmake(Add_StepDependencies_iface)
  13. run_cmake(Add_StepDependencies_iface_step)
  14. run_cmake(Add_StepDependencies_no_target)
  15. run_cmake(UsesTerminal)
  16. # Run both cmake and build steps. We always do a clean before the
  17. # build to ensure that the download step re-runs each time.
  18. function(__ep_test_with_build testName)
  19. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build)
  20. set(RunCMake_TEST_NO_CLEAN 1)
  21. file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
  22. file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
  23. run_cmake(${testName})
  24. run_cmake_command(${testName}-clean ${CMAKE_COMMAND} --build . --target clean)
  25. run_cmake_command(${testName}-build ${CMAKE_COMMAND} --build .)
  26. endfunction()
  27. __ep_test_with_build(MultiCommand)
  28. set(RunCMake_TEST_OUTPUT_MERGE 1)
  29. __ep_test_with_build(PreserveEmptyArgs)
  30. set(RunCMake_TEST_OUTPUT_MERGE 0)
  31. # Output is not predictable enough to be able to verify it reliably
  32. # when using the various different Visual Studio generators
  33. if(NOT RunCMake_GENERATOR MATCHES "Visual Studio")
  34. __ep_test_with_build(LogOutputOnFailure)
  35. __ep_test_with_build(LogOutputOnFailureMerged)
  36. __ep_test_with_build(DownloadTimeout)
  37. endif()
  38. # We can't test the substitution when using the old MSYS due to
  39. # make/sh mangling the paths (substitution is performed correctly,
  40. # but the mangling means we can't reliably test the output).
  41. # There is no such issue when using the newer MSYS though. Therefore,
  42. # we need to bypass the substitution test if using old MSYS.
  43. # See merge request 1537 for discussion.
  44. set(doSubstitutionTest YES)
  45. if(RunCMake_GENERATOR STREQUAL "MSYS Makefiles")
  46. execute_process(COMMAND uname OUTPUT_VARIABLE uname)
  47. if(uname MATCHES "^MINGW32_NT")
  48. set(doSubstitutionTest NO)
  49. endif()
  50. endif()
  51. if(doSubstitutionTest)
  52. __ep_test_with_build(Substitutions)
  53. endif()