summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/cmake_parse_arguments
diff options
context:
space:
mode:
authorMatthias Maennich <matthias@maennich.net>2015-12-05 18:02:19 (GMT)
committerBrad King <brad.king@kitware.com>2015-12-17 15:45:19 (GMT)
commitab8a280857da5cf8545bd2a6f69b7378f53449a5 (patch)
tree10f014de571d24188cce4d16ef31b2b31186445d /Tests/RunCMake/cmake_parse_arguments
parente8b148318f1fab26b2289cadc2d0c5e12201169d (diff)
downloadCMake-ab8a280857da5cf8545bd2a6f69b7378f53449a5.zip
CMake-ab8a280857da5cf8545bd2a6f69b7378f53449a5.tar.gz
CMake-ab8a280857da5cf8545bd2a6f69b7378f53449a5.tar.bz2
cmake_parse_arguments: consider duplicate keyword as warning
The behaviour of double specified keywords is rather undefined or at least not clearly documented. This change introduces a strict check and emits a warning in case a keyword has been specified more than once.
Diffstat (limited to 'Tests/RunCMake/cmake_parse_arguments')
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt36
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/Errors.cmake10
2 files changed, 43 insertions, 3 deletions
diff --git a/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt b/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt
index 5394eaf..f2ba9b8 100644
--- a/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt
+++ b/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt
@@ -1,14 +1,44 @@
-CMake Error at Errors\.cmake:1 \(cmake_parse_arguments\):
+CMake Error at Errors\.cmake:2 \(cmake_parse_arguments\):
cmake_parse_arguments must be called with at least 4 arguments\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)
+
-CMake Error at Errors\.cmake:2 \(cmake_parse_arguments\):
+CMake Error at Errors\.cmake:3 \(cmake_parse_arguments\):
cmake_parse_arguments must be called with at least 4 arguments\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)
+
-CMake Error at Errors\.cmake:3 \(cmake_parse_arguments\):
+CMake Error at Errors\.cmake:4 \(cmake_parse_arguments\):
cmake_parse_arguments must be called with at least 4 arguments\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)
++
+CMake Warning at Errors\.cmake:8 \(cmake_parse_arguments\):
+ keyword defined more than once: OPT
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:3 \(include\)
++
+CMake Warning at Errors\.cmake:9 \(cmake_parse_arguments\):
+ keyword defined more than once: OPT
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:3 \(include\)
++
+CMake Warning at Errors\.cmake:10 \(cmake_parse_arguments\):
+ keyword defined more than once: OPT
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:3 \(include\)
++
+CMake Warning at Errors\.cmake:12 \(cmake_parse_arguments\):
+ keyword defined more than once: OPT
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:3 \(include\)
++
+CMake Warning at Errors\.cmake:13 \(cmake_parse_arguments\):
+ keyword defined more than once: OPT
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:3 \(include\)
++
+CMake Warning at Errors\.cmake:14 \(cmake_parse_arguments\):
+ keyword defined more than once: OPT
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:3 \(include\)
diff --git a/Tests/RunCMake/cmake_parse_arguments/Errors.cmake b/Tests/RunCMake/cmake_parse_arguments/Errors.cmake
index 98e22e9..6a38081 100644
--- a/Tests/RunCMake/cmake_parse_arguments/Errors.cmake
+++ b/Tests/RunCMake/cmake_parse_arguments/Errors.cmake
@@ -1,4 +1,14 @@
+# wrong argument count
cmake_parse_arguments()
cmake_parse_arguments(prefix OPT)
cmake_parse_arguments(prefix OPT SINGLE)
cmake_parse_arguments(prefix OPT SINGLE MULTI) # not an error
+
+# duplicate keywords
+cmake_parse_arguments(prefix "OPT;OPT" "" "")
+cmake_parse_arguments(prefix "" "OPT;OPT" "")
+cmake_parse_arguments(prefix "" "" "OPT;OPT")
+
+cmake_parse_arguments(prefix "OPT" "OPT" "")
+cmake_parse_arguments(prefix "" "OPT" "OPT")
+cmake_parse_arguments(prefix "OPT" "" "OPT")