summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/GeneratorExpression
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-06-23 13:18:02 (GMT)
committerBrad King <brad.king@kitware.com>2020-06-24 12:38:28 (GMT)
commiteae15dce6a3fdb9b02c86891553e5cf408401672 (patch)
tree64cf6df050ff8eb423b86d2744bb6a0c80043fca /Tests/RunCMake/GeneratorExpression
parentc4cc21d20b79d682a99cc28957cf973ebf1993ff (diff)
downloadCMake-eae15dce6a3fdb9b02c86891553e5cf408401672.zip
CMake-eae15dce6a3fdb9b02c86891553e5cf408401672.tar.gz
CMake-eae15dce6a3fdb9b02c86891553e5cf408401672.tar.bz2
Genex: $<CONFIG:> now supports multiple configurations
Instead of having to do $<OR:$<CONFIG:Release>,$<CONFIG:MinSizeRel>> you can do $<CONFIG:Release,MinSizeRel>
Diffstat (limited to 'Tests/RunCMake/GeneratorExpression')
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt9
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake1
-rw-r--r--Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries-check.cmake6
-rw-r--r--Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries.cmake9
-rw-r--r--Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries-check.cmake6
-rw-r--r--Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries.cmake8
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake14
7 files changed, 43 insertions, 10 deletions
diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt
index 42dd0ce..130de2b 100644
--- a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt
+++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt
@@ -10,15 +10,6 @@ Call Stack \(most recent call first\):
CMake Error at BadCONFIG.cmake:1 \(add_custom_target\):
Error evaluating generator expression:
- \$<CONFIG:Foo,Bar>
-
- \$<CONFIG> expression requires one or zero parameters.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-+
-CMake Error at BadCONFIG.cmake:1 \(add_custom_target\):
- Error evaluating generator expression:
-
\$<CONFIG:Foo-Bar>
Expression syntax not recognized.
diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake
index 5c22aaa..1735ab7 100644
--- a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake
+++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake
@@ -1,6 +1,5 @@
add_custom_target(check ALL COMMAND check
$<CONFIG:.>
- $<CONFIG:Foo,Bar>
$<CONFIG:Foo-Bar>
$<$<CONFIG:Foo-Nested>:foo>
VERBATIM)
diff --git a/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries-check.cmake b/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries-check.cmake
new file mode 100644
index 0000000..b43256b
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries-check.cmake
@@ -0,0 +1,6 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/CONFIG-empty-entries-generated.txt" content)
+
+set(expected "1234")
+if(NOT content STREQUAL expected)
+ set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]")
+endif()
diff --git a/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries.cmake b/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries.cmake
new file mode 100644
index 0000000..a4d53f9
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/CONFIG-empty-entries.cmake
@@ -0,0 +1,9 @@
+cmake_policy(SET CMP0070 NEW)
+
+set(text)
+string(APPEND text "$<$<CONFIG:>:1>")
+string(APPEND text "$<$<CONFIG:Release,>:2>")
+string(APPEND text "$<$<CONFIG:,Release>:3>")
+string(APPEND text "$<$<CONFIG:Release,,Debug>:4>")
+string(APPEND text "$<$<CONFIG:Release,Debug>:5>")
+file(GENERATE OUTPUT CONFIG-empty-entries-generated.txt CONTENT ${text})
diff --git a/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries-check.cmake b/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries-check.cmake
new file mode 100644
index 0000000..66f42c7
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries-check.cmake
@@ -0,0 +1,6 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/CONFIG-multiple-entries-generated.txt" content)
+
+set(expected "14")
+if(NOT content STREQUAL expected)
+ set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]")
+endif()
diff --git a/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries.cmake b/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries.cmake
new file mode 100644
index 0000000..6829282
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/CONFIG-multiple-entries.cmake
@@ -0,0 +1,8 @@
+cmake_policy(SET CMP0070 NEW)
+
+set(text)
+string(APPEND text "$<$<CONFIG:CustomConfig>:1>")
+string(APPEND text "$<$<CONFIG:Release>:2>")
+string(APPEND text "$<$<CONFIG:Debug,Release>:3>")
+string(APPEND text "$<$<CONFIG:Release,CustomConfig,Debug>:4>")
+file(GENERATE OUTPUT CONFIG-multiple-entries-generated.txt CONTENT "${text}")
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index 0278cf6..6349112 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -12,6 +12,7 @@ run_cmake(BadTargetTypeInterface)
run_cmake(BadTargetTypeObject)
run_cmake(BadInstallPrefix)
run_cmake(BadSHELL_PATH)
+run_cmake(BadCONFIG)
run_cmake(CMP0044-WARN)
run_cmake(NonValidTarget-C_COMPILER_ID)
run_cmake(NonValidTarget-CXX_COMPILER_ID)
@@ -44,6 +45,19 @@ run_cmake(FILTER-InvalidOperator)
run_cmake(FILTER-Exclude)
run_cmake(FILTER-Include)
+if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(RunCMake_TEST_OPTIONS [==[-DCMAKE_CONFIGURATION_TYPES=CustomConfig]==])
+else()
+ set(RunCMake_TEST_OPTIONS [==[-DCMAKE_BUILD_TYPE=CustomConfig]==])
+endif()
+run_cmake(CONFIG-multiple-entries)
+if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(RunCMake_TEST_OPTIONS [==[-DCMAKE_CONFIGURATION_TYPES=]==])
+else()
+ set(RunCMake_TEST_OPTIONS [==[-DCMAKE_BUILD_TYPE=]==])
+endif()
+run_cmake(CONFIG-empty-entries)
+
set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0085:STRING=OLD)
run_cmake(CMP0085-OLD)
unset(RunCMake_TEST_OPTIONS)