summaryrefslogtreecommitdiffstats
path: root/Tests/GeneratorExpression
diff options
context:
space:
mode:
authorColby Pike <vectorofbool@gmail.com>2017-01-24 03:14:03 (GMT)
committerBrad King <brad.king@kitware.com>2017-01-26 16:18:50 (GMT)
commit895f7f16a79428689a263ba5cd9a72647dc8e912 (patch)
tree6c3ba32ffb5b9cbfedaf7e61ce45d63b94057c04 /Tests/GeneratorExpression
parent8ea12a8b80c4c3153cc602f1d0735b3db8581ae8 (diff)
downloadCMake-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/GeneratorExpression')
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt4
-rw-r--r--Tests/GeneratorExpression/check-part4.cmake5
2 files changed, 9 insertions, 0 deletions
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index f0d6abf..f920188 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -246,6 +246,10 @@ add_custom_target(check-part4 ALL
# CMake as command-line argument
-Dtest_shell_path=${path_prefix}$<SHELL_PATH:${test_shell_path}>
-Dpath_prefix=${path_prefix}
+ -Dif_1=$<IF:1,a,b>
+ -Dif_2=$<IF:0,a,b>
+ -Dif_3=$<IF:$<EQUAL:10,30>,a,b>
+ -Dif_4=$<IF:$<EQUAL:30,30>,a,b>
-DWIN32=${WIN32}
-DCMAKE_GENERATOR=${CMAKE_GENERATOR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/check-part4.cmake
diff --git a/Tests/GeneratorExpression/check-part4.cmake b/Tests/GeneratorExpression/check-part4.cmake
index 9e516d5..f5d14dd 100644
--- a/Tests/GeneratorExpression/check-part4.cmake
+++ b/Tests/GeneratorExpression/check-part4.cmake
@@ -13,3 +13,8 @@ if(WIN32)
else()
check(test_shell_path [[/shell/path]])
endif()
+
+check(if_1 "a")
+check(if_2 "b")
+check(if_3 "b")
+check(if_4 "a")