summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-10-09 19:35:54 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2020-10-09 19:35:54 (GMT)
commit94c955e508daa0ed84290cc1d3e946a74fde0e40 (patch)
treed0d68c36ee4bfe43f2638b9d3813a4accc1ccda0 /Tests
parentd6af1e83bc1fa7f8dcdeadcf57a91d8e5469dae8 (diff)
downloadCMake-94c955e508daa0ed84290cc1d3e946a74fde0e40.zip
CMake-94c955e508daa0ed84290cc1d3e946a74fde0e40.tar.gz
CMake-94c955e508daa0ed84290cc1d3e946a74fde0e40.tar.bz2
Tests: Test the CMakePresets.json example in the documentation
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakePresets/DocumentationExample.cmake3
-rw-r--r--Tests/RunCMake/CMakePresets/RunCMakeTest.cmake9
2 files changed, 12 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakePresets/DocumentationExample.cmake b/Tests/RunCMake/CMakePresets/DocumentationExample.cmake
new file mode 100644
index 0000000..1f2fc00
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/DocumentationExample.cmake
@@ -0,0 +1,3 @@
+include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake)
+
+test_variable(MY_CACHE_VARIABLE "BOOL" "OFF")
diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
index 4b430b3..18ea093 100644
--- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
@@ -1,3 +1,5 @@
+cmake_minimum_required(VERSION 3.19) # CMP0053
+
include(RunCMake)
# Fix Visual Studio generator name
@@ -214,3 +216,10 @@ unset(CMakePresets_WARN_UNUSED_CLI)
set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/Debug.json.in")
run_cmake_presets(NoDebug)
run_cmake_presets(Debug)
+
+# Test the example from the documentation
+file(READ "${RunCMake_SOURCE_DIR}/../../../Help/manual/presets/example.json" _example)
+string(REPLACE "\"generator\": \"Ninja\"" "\"generator\": \"@RunCMake_GENERATOR@\"" _example "${_example}")
+file(WRITE "${RunCMake_BINARY_DIR}/example.json.in" "${_example}")
+set(CMakePresets_FILE "${RunCMake_BINARY_DIR}/example.json.in")
+run_cmake_presets(DocumentationExample --preset=default)