RunCMakeTest.cmake 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. endif()
  37. # We can't test the substitution when using the old MSYS due to
  38. # make/sh mangling the paths (substitution is performed correctly,
  39. # but the mangling means we can't reliably test the output).
  40. # There is no such issue when using the newer MSYS though. Therefore,
  41. # we need to bypass the substitution test if using old MSYS.
  42. # See merge request 1537 for discussion.
  43. set(doSubstitutionTest YES)
  44. if(RunCMake_GENERATOR STREQUAL "MSYS Makefiles")
  45. execute_process(COMMAND uname OUTPUT_VARIABLE uname)
  46. if(uname MATCHES "^MINGW32_NT")
  47. set(doSubstitutionTest NO)
  48. endif()
  49. endif()
  50. if(doSubstitutionTest)
  51. __ep_test_with_build(Substitutions)
  52. endif()