summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ctest_build
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/ctest_build')
-rw-r--r--Tests/RunCMake/ctest_build/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/ctest_build/SubdirTarget-check.cmake4
2 files changed, 16 insertions, 0 deletions
diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake
index 511cd71..e94a55d 100644
--- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake
@@ -49,6 +49,18 @@ function(run_BuildChangeId)
endfunction()
run_BuildChangeId()
+function(run_SubdirTarget)
+ set(CASE_CMAKELISTS_SUFFIX_CODE [=[
+file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/subdir/CMakeLists.txt [[
+add_custom_target(target_in_subdir COMMAND ${CMAKE_COMMAND} -E touch target_in_subdir.out VERBATIM)
+]])
+add_subdirectory(subdir)
+]=])
+ set(CASE_CTEST_BUILD_ARGS TARGET target_in_subdir)
+ run_ctest(SubdirTarget)
+endfunction()
+run_SubdirTarget()
+
set(RunCMake_USE_CUSTOM_BUILD_COMMAND TRUE)
set(RunCMake_BUILD_COMMAND "${FAKE_BUILD_COMMAND_EXE}")
run_ctest(BuildCommandFailure)
diff --git a/Tests/RunCMake/ctest_build/SubdirTarget-check.cmake b/Tests/RunCMake/ctest_build/SubdirTarget-check.cmake
new file mode 100644
index 0000000..81d21ec
--- /dev/null
+++ b/Tests/RunCMake/ctest_build/SubdirTarget-check.cmake
@@ -0,0 +1,4 @@
+set(expected_file "${RunCMake_TEST_BINARY_DIR}/subdir/target_in_subdir.out")
+if(NOT EXISTS "${expected_file}")
+ set(RunCMake_TEST_FAILED "Expected build output file not found:\n ${expected_file}")
+endif()