cmake/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake

59 lines
2.0 KiB
CMake
Raw Normal View History

2015-04-27 22:25:09 +02:00
include(RunCMake)
2018-10-28 12:09:07 +01:00
run_cmake(IncludeScope-Add)
run_cmake(IncludeScope-Add_Step)
2015-08-17 11:37:30 +02:00
run_cmake(NoOptions)
run_cmake(SourceEmpty)
run_cmake(SourceMissing)
2015-04-27 22:25:09 +02:00
run_cmake(CMAKE_CACHE_ARGS)
run_cmake(CMAKE_CACHE_DEFAULT_ARGS)
run_cmake(CMAKE_CACHE_mix)
run_cmake(NO_DEPENDS)
run_cmake(Add_StepDependencies)
2015-08-17 11:37:30 +02:00
run_cmake(Add_StepDependencies_iface)
run_cmake(Add_StepDependencies_iface_step)
2015-04-27 22:25:09 +02:00
run_cmake(Add_StepDependencies_no_target)
2015-11-17 17:22:37 +01:00
run_cmake(UsesTerminal)
2018-01-26 17:06:56 +01:00
# Run both cmake and build steps. We always do a clean before the
# build to ensure that the download step re-runs each time.
2018-04-23 21:13:27 +02:00
function(__ep_test_with_build testName)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build)
set(RunCMake_TEST_NO_CLEAN 1)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
run_cmake(${testName})
run_cmake_command(${testName}-clean ${CMAKE_COMMAND} --build . --target clean)
run_cmake_command(${testName}-build ${CMAKE_COMMAND} --build .)
endfunction()
__ep_test_with_build(MultiCommand)
2020-08-30 11:54:41 +02:00
set(RunCMake_TEST_OUTPUT_MERGE 1)
__ep_test_with_build(PreserveEmptyArgs)
set(RunCMake_TEST_OUTPUT_MERGE 0)
2019-11-11 23:01:05 +01:00
# Output is not predictable enough to be able to verify it reliably
# when using the various different Visual Studio generators
if(NOT RunCMake_GENERATOR MATCHES "Visual Studio")
__ep_test_with_build(LogOutputOnFailure)
__ep_test_with_build(LogOutputOnFailureMerged)
endif()
2018-04-23 21:13:27 +02:00
# We can't test the substitution when using the old MSYS due to
# make/sh mangling the paths (substitution is performed correctly,
# but the mangling means we can't reliably test the output).
# There is no such issue when using the newer MSYS though. Therefore,
# we need to bypass the substitution test if using old MSYS.
# See merge request 1537 for discussion.
set(doSubstitutionTest YES)
if(RunCMake_GENERATOR STREQUAL "MSYS Makefiles")
execute_process(COMMAND uname OUTPUT_VARIABLE uname)
if(uname MATCHES "^MINGW32_NT")
set(doSubstitutionTest NO)
endif()
endif()
if(doSubstitutionTest)
__ep_test_with_build(Substitutions)
endif()