diff options
author | Brad King <brad.king@kitware.com> | 2023-09-26 13:31:34 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-09-26 13:31:42 (GMT) |
commit | b8151299dee511eda187b4a53e4ffb7aaafb972f (patch) | |
tree | f1334e1506ddd1b6c66883377b8f5c9e07fe06c4 /Tests/RunCMake | |
parent | dd1722d573502060e230287e6a27bfc090666175 (diff) | |
parent | 634079b86d56e4d53240a52d80a2d3ba985ffb5f (diff) | |
download | CMake-b8151299dee511eda187b4a53e4ffb7aaafb972f.zip CMake-b8151299dee511eda187b4a53e4ffb7aaafb972f.tar.gz CMake-b8151299dee511eda187b4a53e4ffb7aaafb972f.tar.bz2 |
Merge topic 'genexp-no-eval'
634079b86d cmGeneratorExpressionEvaluator: Short-circuit boolean operators
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Acked-by: Pavel Solodovnikov <hellyeahdominate@gmail.com>
Merge-request: !8791
Diffstat (limited to 'Tests/RunCMake')
15 files changed, 65 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index fbe3854..14b94c7 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -399,6 +399,7 @@ add_RunCMake_test(GenEx-PATH) add_RunCMake_test(GenEx-PATH_EQUAL) add_RunCMake_test(GenEx-LIST) add_RunCMake_test(GeneratorExpression) +add_RunCMake_test(GeneratorExpressionShortCircuit) add_RunCMake_test(GeneratorInstance) add_RunCMake_test(GeneratorPlatform) if(XCODE_VERSION) 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) |