summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-09-16 14:09:07 (GMT)
committerBrad King <brad.king@kitware.com>2015-09-17 14:21:09 (GMT)
commit73a058f85680a044aeeecd815f8d6cc34fd29f3d (patch)
tree5dd8aebf5d61ae6c5c68a970ab081e4d91b1e23d /Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
parent438fabf242bae84dde71d51298b43c2b6fa760eb (diff)
downloadCMake-73a058f85680a044aeeecd815f8d6cc34fd29f3d.zip
CMake-73a058f85680a044aeeecd815f8d6cc34fd29f3d.tar.gz
CMake-73a058f85680a044aeeecd815f8d6cc34fd29f3d.tar.bz2
Tests: Add RunCMake.BuildDepends test
This will allow more granular checks than the main BuildDepends test. Start with a simple single-source C program.
Diffstat (limited to 'Tests/RunCMake/BuildDepends/RunCMakeTest.cmake')
-rw-r--r--Tests/RunCMake/BuildDepends/RunCMakeTest.cmake23
1 files changed, 23 insertions, 0 deletions
diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
new file mode 100644
index 0000000..98132cc
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
@@ -0,0 +1,23 @@
+include(RunCMake)
+
+function(run_BuildDepends CASE)
+ # Use a single build tree for a few tests without cleaning.
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${CASE}-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
+ set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
+ endif()
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ include(${RunCMake_SOURCE_DIR}/${CASE}.step1.cmake OPTIONAL)
+ run_cmake(${CASE})
+ set(RunCMake-check-file check.cmake)
+ set(check_step 1)
+ run_cmake_command(${CASE}-build1 ${CMAKE_COMMAND} --build . --config Debug)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1.125) # handle 1s resolution
+ include(${RunCMake_SOURCE_DIR}/${CASE}.step2.cmake OPTIONAL)
+ set(check_step 2)
+ run_cmake_command(${CASE}-build2 ${CMAKE_COMMAND} --build . --config Debug)
+endfunction()
+
+run_BuildDepends(C-Exe)