RunCMakeTest.cmake 1.6 KB

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