diff options
author | Colby Pike <vectorofbool@gmail.com> | 2017-01-24 03:14:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-01-26 16:18:50 (GMT) |
commit | 895f7f16a79428689a263ba5cd9a72647dc8e912 (patch) | |
tree | 6c3ba32ffb5b9cbfedaf7e61ce45d63b94057c04 /Tests/RunCMake/GeneratorExpression | |
parent | 8ea12a8b80c4c3153cc602f1d0735b3db8581ae8 (diff) | |
download | CMake-895f7f16a79428689a263ba5cd9a72647dc8e912.zip CMake-895f7f16a79428689a263ba5cd9a72647dc8e912.tar.gz CMake-895f7f16a79428689a263ba5cd9a72647dc8e912.tar.bz2 |
Genex: Add `IF` generator expression
This allows a single condition to be used to choose between two
alternatives. Without this the condition must be duplicated with
one surrounded by `NOT`.
Closes: #15585
Diffstat (limited to 'Tests/RunCMake/GeneratorExpression')
4 files changed, 22 insertions, 0 deletions
diff --git a/Tests/RunCMake/GeneratorExpression/BadIF-result.txt b/Tests/RunCMake/GeneratorExpression/BadIF-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadIF-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadIF-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadIF-stderr.txt new file mode 100644 index 0000000..7c7506c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadIF-stderr.txt @@ -0,0 +1,15 @@ +CMake Error at BadIF.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<IF:asdf,a,b> + + First parameter to \$<IF> must resolve to exactly one '0' or '1' value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadIF.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<IF:asdf,a> + + \$<IF> expression requires 3 comma separated parameters, but got 2 instead. diff --git a/Tests/RunCMake/GeneratorExpression/BadIF.cmake b/Tests/RunCMake/GeneratorExpression/BadIF.cmake new file mode 100644 index 0000000..583f68d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadIF.cmake @@ -0,0 +1,5 @@ + +add_custom_target(check ALL COMMAND check + $<IF:asdf,a,b> + $<IF:asdf,a> + ) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index f5584d5..084b5c3 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(BadIF) run_cmake(BadCONFIG) run_cmake(BadOR) run_cmake(BadAND) |