summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CMakePresets
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2021-03-10 21:46:20 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2021-03-15 18:41:42 (GMT)
commit0d497e159b5854ed050d9eb8c4e965976a03de11 (patch)
treeea194808ab962ed15d8329ab527d6e2c5472fc7c /Tests/RunCMake/CMakePresets
parent79d03ab5055da1397c525c31d8cb13c30965a911 (diff)
downloadCMake-0d497e159b5854ed050d9eb8c4e965976a03de11.zip
CMake-0d497e159b5854ed050d9eb8c4e965976a03de11.tar.gz
CMake-0d497e159b5854ed050d9eb8c4e965976a03de11.tar.bz2
CMakePresets.json: Add ${hostSystemName} macro
Diffstat (limited to 'Tests/RunCMake/CMakePresets')
-rw-r--r--Tests/RunCMake/CMakePresets/HostSystemName.cmake3
-rw-r--r--Tests/RunCMake/CMakePresets/HostSystemName.json.in13
-rw-r--r--Tests/RunCMake/CMakePresets/HostSystemNameFuture-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/HostSystemNameFuture-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresets/HostSystemNameFuture.json.in13
-rw-r--r--Tests/RunCMake/CMakePresets/RunCMakeTest.cmake6
6 files changed, 38 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakePresets/HostSystemName.cmake b/Tests/RunCMake/CMakePresets/HostSystemName.cmake
new file mode 100644
index 0000000..dc0998a
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/HostSystemName.cmake
@@ -0,0 +1,3 @@
+include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake)
+
+test_variable(TEST_HOST_SYSTEM_NAME "" "${CMAKE_HOST_SYSTEM_NAME}")
diff --git a/Tests/RunCMake/CMakePresets/HostSystemName.json.in b/Tests/RunCMake/CMakePresets/HostSystemName.json.in
new file mode 100644
index 0000000..7fcd8c8
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/HostSystemName.json.in
@@ -0,0 +1,13 @@
+{
+ "version": 3,
+ "configurePresets": [
+ {
+ "name": "HostSystemName",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build",
+ "cacheVariables": {
+ "TEST_HOST_SYSTEM_NAME": "${hostSystemName}"
+ }
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/HostSystemNameFuture-result.txt b/Tests/RunCMake/CMakePresets/HostSystemNameFuture-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/HostSystemNameFuture-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresets/HostSystemNameFuture-stderr.txt b/Tests/RunCMake/CMakePresets/HostSystemNameFuture-stderr.txt
new file mode 100644
index 0000000..7f4bb9a
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/HostSystemNameFuture-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/HostSystemNameFuture: Invalid macro expansion$
diff --git a/Tests/RunCMake/CMakePresets/HostSystemNameFuture.json.in b/Tests/RunCMake/CMakePresets/HostSystemNameFuture.json.in
new file mode 100644
index 0000000..7a2f0aa
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/HostSystemNameFuture.json.in
@@ -0,0 +1,13 @@
+{
+ "version": 2,
+ "configurePresets": [
+ {
+ "name": "HostSystemNameFuture",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build",
+ "cacheVariables": {
+ "TEST_HOST_SYSTEM_NAME": "${hostSystemName}"
+ }
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
index ee21130..24ac0e9 100644
--- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
@@ -261,6 +261,12 @@ set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/Debug.json.in")
run_cmake_presets(NoDebug)
run_cmake_presets(Debug)
+# Test ${hostSystemName} macro
+set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/HostSystemName.json.in")
+run_cmake_presets(HostSystemName)
+set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/HostSystemNameFuture.json.in")
+run_cmake_presets(HostSystemNameFuture)
+
# 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}")