diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2023-03-07 19:05:25 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2023-03-07 19:30:29 (GMT) |
commit | f1aedf22402bfef66c4e83265f5d52b7c3d4b015 (patch) | |
tree | 563e7023281e3458532a4f3d8286143957de8618 /Tests | |
parent | 3d6075da4df6a4f93a835e446c2bbf29488f50bd (diff) | |
download | CMake-f1aedf22402bfef66c4e83265f5d52b7c3d4b015.zip CMake-f1aedf22402bfef66c4e83265f5d52b7c3d4b015.tar.gz CMake-f1aedf22402bfef66c4e83265f5d52b7c3d4b015.tar.bz2 |
Tests/RunCMake: Add script to auto-generate RunCMake test suite stub
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/AddRunCMakeTest.cmake | 10 | ||||
-rw-r--r-- | Tests/RunCMake/README.rst | 7 |
2 files changed, 17 insertions, 0 deletions
diff --git a/Tests/RunCMake/AddRunCMakeTest.cmake b/Tests/RunCMake/AddRunCMakeTest.cmake new file mode 100644 index 0000000..c0c3bba --- /dev/null +++ b/Tests/RunCMake/AddRunCMakeTest.cmake @@ -0,0 +1,10 @@ +if(NOT DEFINED RunCMake_TEST_SUITE) + message("Usage: ${CMAKE_COMMAND} -DRunCMake_TEST_SUITE=<test name> -P Tests/RunCMake/AddRunCMakeTestSuite.cmake") +else() + include("Source/CMakeVersion.cmake") + set(RunCMake_TEST_DIR "Tests/RunCMake/${RunCMake_TEST_SUITE}") + file(MAKE_DIRECTORY "${RunCMake_TEST_DIR}") + file(WRITE "${RunCMake_TEST_DIR}/CMakeLists.txt" "cmake_minimum_required(VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR})\nproject(\${RunCMake_TEST} NONE)\ninclude(\${RunCMake_TEST}.cmake)\n") + file(WRITE "${RunCMake_TEST_DIR}/RunCMakeTest.cmake" "include(RunCMake)\n\n# Write your test cases below, like so:\n#\n# run_cmake(TestCaseName)\n") + file(APPEND "Tests/RunCMake/CMakeLists.txt" "add_RunCMake_test(${RunCMake_TEST_SUITE})\n") +endif() diff --git a/Tests/RunCMake/README.rst b/Tests/RunCMake/README.rst index ebe40cf..d8cae8b 100644 --- a/Tests/RunCMake/README.rst +++ b/Tests/RunCMake/README.rst @@ -82,3 +82,10 @@ match the regular expression are not run. For example:: This will only run subtests in ``RunCMake.Example`` that start with ``example``. + +To speed up the process of creating a new ``RunCMake`` test, you can run a +script that will automatically perform steps 1 through 4 for you:: + + cmake -DRunCMake_TEST_SUITE=<test suite name> -P Tests/RunCMake/AddRunCMakeTestSuite.cmake + +Be sure to run this from the top-level CMake source directory. |