summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/cmake_parse_arguments/Mix.cmake
diff options
context:
space:
mode:
authorMatthias Maennich <matthias@maennich.net>2015-12-05 17:57:41 (GMT)
committerBrad King <brad.king@kitware.com>2015-12-17 15:31:04 (GMT)
commitcbbdfc2b6120e192b4248ce89af93cf34ea8a254 (patch)
tree829f794e178bddc918bdac8f887745be9a60a4dc /Tests/RunCMake/cmake_parse_arguments/Mix.cmake
parent2913876c58daec60fec24c6b47c16c3d13b28405 (diff)
downloadCMake-cbbdfc2b6120e192b4248ce89af93cf34ea8a254.zip
CMake-cbbdfc2b6120e192b4248ce89af93cf34ea8a254.tar.gz
CMake-cbbdfc2b6120e192b4248ce89af93cf34ea8a254.tar.bz2
CMakeParseArguments: add a RunCMake test suite
Diffstat (limited to 'Tests/RunCMake/cmake_parse_arguments/Mix.cmake')
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/Mix.cmake25
1 files changed, 25 insertions, 0 deletions
diff --git a/Tests/RunCMake/cmake_parse_arguments/Mix.cmake b/Tests/RunCMake/cmake_parse_arguments/Mix.cmake
new file mode 100644
index 0000000..c14fdfd
--- /dev/null
+++ b/Tests/RunCMake/cmake_parse_arguments/Mix.cmake
@@ -0,0 +1,25 @@
+include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake)
+include(CMakeParseArguments)
+
+# specify two keywords for each category and set the first keyword of each
+# within ARGN
+cmake_parse_arguments(pref "OPT1;OPT2" "SINGLE1;SINGLE2" "MULTI1;MULTI2"
+ OPT1 SINGLE1 foo MULTI1 bar foo bar)
+TEST(pref_OPT1 TRUE)
+TEST(pref_OPT2 FALSE)
+TEST(pref_SINGLE1 foo)
+TEST(pref_SINGLE2 UNDEFINED)
+TEST(pref_MULTI1 bar foo bar)
+TEST(pref_MULTI2 UNDEFINED)
+TEST(pref_UNPARSED_ARGUMENTS UNDEFINED)
+
+# same as above but reversed ARGN
+cmake_parse_arguments(pref "OPT1;OPT2" "SINGLE1;SINGLE2" "MULTI1;MULTI2"
+ MULTI1 bar foo bar SINGLE1 foo OPT1)
+TEST(pref_OPT1 TRUE)
+TEST(pref_OPT2 FALSE)
+TEST(pref_SINGLE1 foo)
+TEST(pref_SINGLE2 UNDEFINED)
+TEST(pref_MULTI1 bar foo bar)
+TEST(pref_MULTI2 UNDEFINED)
+TEST(pref_UNPARSED_ARGUMENTS UNDEFINED)