summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/GeneratorExpression
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-07-12 15:35:39 (GMT)
committerBrad King <brad.king@kitware.com>2023-07-12 15:49:21 (GMT)
commit861dd60ecf2e2bbe133708ea5bc55018931ee050 (patch)
tree95226c3004a23d2c48bd55f39ba8b11fdc72f00e /Tests/RunCMake/GeneratorExpression
parentfbe5f49d63fe058277b41991cb025631093b25a2 (diff)
downloadCMake-861dd60ecf2e2bbe133708ea5bc55018931ee050.zip
CMake-861dd60ecf2e2bbe133708ea5bc55018931ee050.tar.gz
CMake-861dd60ecf2e2bbe133708ea5bc55018931ee050.tar.bz2
Genex: Restore REMOVE_DUPLICATES preservation of empty elements
Refactoring in commit 72d116ee68 (GenEx: list oriented genexes use cmList class, 2023-03-29, v3.27.0-rc1~205^2) accidentally caused empty elements to be dropped by the `REMOVE_DUPLICATES` genex. Fix it and add a test case. Fixes: #25080
Diffstat (limited to 'Tests/RunCMake/GeneratorExpression')
-rw-r--r--Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element-check.cmake6
-rw-r--r--Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element.cmake3
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake1
3 files changed, 10 insertions, 0 deletions
diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element-check.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element-check.cmake
new file mode 100644
index 0000000..a996e53
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element-check.cmake
@@ -0,0 +1,6 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/REMOVE_DUPLICATES-generated.txt" content)
+
+set(expected "1;;2;3")
+if(NOT content STREQUAL expected)
+ set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]")
+endif()
diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element.cmake
new file mode 100644
index 0000000..9d5944f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element.cmake
@@ -0,0 +1,3 @@
+cmake_policy(VERSION 3.11)
+
+file(GENERATE OUTPUT "REMOVE_DUPLICATES-generated.txt" CONTENT "$<REMOVE_DUPLICATES:1$<SEMICOLON>$<SEMICOLON>2$<SEMICOLON>$<SEMICOLON>3>")
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index 3fd9947..2a0c893 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -36,6 +36,7 @@ run_cmake(TARGET_NAME_IF_EXISTS-alias-target)
run_cmake(TARGET_NAME_IF_EXISTS-imported-target)
run_cmake(TARGET_NAME_IF_EXISTS-imported-global-target)
run_cmake(REMOVE_DUPLICATES-empty)
+run_cmake(REMOVE_DUPLICATES-empty-element)
run_cmake(REMOVE_DUPLICATES-1)
run_cmake(REMOVE_DUPLICATES-2)
run_cmake(REMOVE_DUPLICATES-3)