summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-08-13 14:00:32 (GMT)
committerBrad King <brad.king@kitware.com>2012-08-15 15:44:49 (GMT)
commit9d9f616792ee07a460af9f0a6dc036d81b852e66 (patch)
tree5057d83f7d6a4cdc52472f1b144ac6aad473789a /Tests
parentebf05abda15967f8f50dcf132f7bf84472ca6337 (diff)
downloadCMake-9d9f616792ee07a460af9f0a6dc036d81b852e66.zip
CMake-9d9f616792ee07a460af9f0a6dc036d81b852e66.tar.gz
CMake-9d9f616792ee07a460af9f0a6dc036d81b852e66.tar.bz2
Add $<CONFIG:...> boolean query generator expression
This expression evaluates to '1' or '0' to indicate whether the build configuration for which the expression is evaluated matches tha named configuration. In combination with the "$<0:...>" and "$<1:...>" expressions this allows per-configuration content to be generated.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt2
-rw-r--r--Tests/GeneratorExpression/check.cmake2
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadCONFIG-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt8
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake3
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake1
6 files changed, 17 insertions, 0 deletions
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 8d7d87d..2b135dc 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -12,6 +12,8 @@ add_custom_target(check ALL
-Dtest_and_1=$<AND:1>
-Dtest_and_1_0=$<AND:1,0>
-Dtest_and_1_1=$<AND:1,1>
+ -Dtest_config_0=$<CONFIG:$<CONFIGURATION>x>
+ -Dtest_config_1=$<CONFIG:$<CONFIGURATION>>
-Dtest_not_0=$<NOT:0>
-Dtest_not_1=$<NOT:1>
-Dtest_or_0=$<OR:0>
diff --git a/Tests/GeneratorExpression/check.cmake b/Tests/GeneratorExpression/check.cmake
index c40b847..e243d85 100644
--- a/Tests/GeneratorExpression/check.cmake
+++ b/Tests/GeneratorExpression/check.cmake
@@ -13,6 +13,8 @@ check(test_and_0_1 "0")
check(test_and_1 "1")
check(test_and_1_0 "0")
check(test_and_1_1 "1")
+check(test_config_0 "0")
+check(test_config_1 "1")
check(test_not_0 "1")
check(test_not_1 "0")
check(test_or_0 "0")
diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-result.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt
new file mode 100644
index 0000000..7c86b25
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at BadCONFIG.cmake:1 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<CONFIG:.>
+
+ Expression syntax not recognized.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake
new file mode 100644
index 0000000..0c13f89
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake
@@ -0,0 +1,3 @@
+add_custom_target(check ALL COMMAND check
+ $<CONFIG:.>
+ VERBATIM)
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index 95b16b3..ed18f25 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -1,5 +1,6 @@
include(RunCMake)
+run_cmake(BadCONFIG)
run_cmake(BadOR)
run_cmake(BadAND)
run_cmake(BadNOT)