summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/GeneratorExpressionShortCircuit
diff options
context:
space:
mode:
authorMartin Duffy <martin.duffy@kitware.com>2023-09-11 13:36:12 (GMT)
committerMartin Duffy <martin.duffy@kitware.com>2023-09-13 22:01:14 (GMT)
commit634079b86d56e4d53240a52d80a2d3ba985ffb5f (patch)
tree790e931efd1dc5dd965bcea6309d4750250ff2a6 /Tests/RunCMake/GeneratorExpressionShortCircuit
parent49e2a4a0a734f0e42e2d5717ab7c4bf4210af635 (diff)
downloadCMake-634079b86d56e4d53240a52d80a2d3ba985ffb5f.zip
CMake-634079b86d56e4d53240a52d80a2d3ba985ffb5f.tar.gz
CMake-634079b86d56e4d53240a52d80a2d3ba985ffb5f.tar.bz2
cmGeneratorExpressionEvaluator: Short-circuit boolean operators
Diffstat (limited to 'Tests/RunCMake/GeneratorExpressionShortCircuit')
-rw-r--r--Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND-stderr.txt8
-rw-r--r--Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND.cmake4
-rw-r--r--Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF-stderr.txt8
-rw-r--r--Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF.cmake4
-rw-r--r--Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR-stderr.txt8
-rw-r--r--Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR.cmake4
-rw-r--r--Tests/RunCMake/GeneratorExpressionShortCircuit/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/GeneratorExpressionShortCircuit/GoodAND.cmake4
-rw-r--r--Tests/RunCMake/GeneratorExpressionShortCircuit/GoodIF.cmake5
-rw-r--r--Tests/RunCMake/GeneratorExpressionShortCircuit/GoodOR.cmake4
-rw-r--r--Tests/RunCMake/GeneratorExpressionShortCircuit/RunCMakeTest.cmake9
14 files changed, 64 insertions, 0 deletions
diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND-result.txt b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND-stderr.txt b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND-stderr.txt
new file mode 100644
index 0000000..1267cb3
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at BadAND.cmake:2 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<0>
+
+ \$<0> expression requires a parameter.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND.cmake b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND.cmake
new file mode 100644
index 0000000..91efaf4
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND.cmake
@@ -0,0 +1,4 @@
+set(error $<0>)
+add_custom_target(check ALL COMMAND check
+ $<AND:1,${error}>
+)
diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF-result.txt b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF-stderr.txt b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF-stderr.txt
new file mode 100644
index 0000000..4e296a5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at BadIF.cmake:2 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<0>
+
+ \$<0> expression requires a parameter.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF.cmake b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF.cmake
new file mode 100644
index 0000000..797cc69
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF.cmake
@@ -0,0 +1,4 @@
+set(error $<0>)
+add_custom_target(check ALL COMMAND check
+ $<IF:0,1,${error}>
+)
diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR-result.txt b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR-stderr.txt b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR-stderr.txt
new file mode 100644
index 0000000..7876d7d
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at BadOR.cmake:2 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<0>
+
+ \$<0> expression requires a parameter.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR.cmake b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR.cmake
new file mode 100644
index 0000000..7477b8f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR.cmake
@@ -0,0 +1,4 @@
+set(error $<0>)
+add_custom_target(check ALL COMMAND check
+ $<OR:0,${error}>
+)
diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/CMakeLists.txt b/Tests/RunCMake/GeneratorExpressionShortCircuit/CMakeLists.txt
new file mode 100644
index 0000000..54a4d62
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.26)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodAND.cmake b/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodAND.cmake
new file mode 100644
index 0000000..26bcaba
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodAND.cmake
@@ -0,0 +1,4 @@
+set(error $<0>)
+add_custom_target(check ALL COMMAND check
+ $<AND:0,${error}>
+)
diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodIF.cmake b/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodIF.cmake
new file mode 100644
index 0000000..1f9fbe6
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodIF.cmake
@@ -0,0 +1,5 @@
+set(error $<0>)
+add_custom_target(check ALL
+ COMMAND check $<IF:1,1,${error}>
+ COMMAND Check $<IF:0,${error},1>
+)
diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodOR.cmake b/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodOR.cmake
new file mode 100644
index 0000000..b574937
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodOR.cmake
@@ -0,0 +1,4 @@
+set(error $<0>)
+add_custom_target(check ALL COMMAND check
+ $<OR:1,${error}>
+)
diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpressionShortCircuit/RunCMakeTest.cmake
new file mode 100644
index 0000000..b0ad679
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/RunCMakeTest.cmake
@@ -0,0 +1,9 @@
+include(RunCMake)
+
+run_cmake(GoodIF)
+run_cmake(GoodAND)
+run_cmake(GoodOR)
+
+run_cmake(BadIF)
+run_cmake(BadAND)
+run_cmake(BadOR)