summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-01-27 14:04:58 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2017-01-27 14:04:58 (GMT)
commit325c6153088c673569971958f107f6cb97b67c50 (patch)
tree751c3c03e0cc2f6bf96db80859fdb0beaf54f746 /Tests
parent0ea578b498059340d575be263f5b6a91581f5ce5 (diff)
parent895f7f16a79428689a263ba5cd9a72647dc8e912 (diff)
downloadCMake-325c6153088c673569971958f107f6cb97b67c50.zip
CMake-325c6153088c673569971958f107f6cb97b67c50.tar.gz
CMake-325c6153088c673569971958f107f6cb97b67c50.tar.bz2
Merge topic 'genex-if'
895f7f16 Genex: Add `IF` generator expression
Diffstat (limited to 'Tests')
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt4
-rw-r--r--Tests/GeneratorExpression/check-part4.cmake5
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadIF-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadIF-stderr.txt15
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadIF.cmake5
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake1
6 files changed, 31 insertions, 0 deletions
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 3091780..adc87cd 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -247,6 +247,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")
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)