# Multi-value keywords in cmake\_parse\_arguments()

**URL:** <https://discourse.cmake.org/t/multi-value-keywords-in-cmake-parse-arguments/13337>\
**Category:** Code\
**Created:** [January 6, 2025, 11:44pm UTC](https://discourse.cmake.org/t/multi-value-keywords-in-cmake-parse-arguments/13337 "2025-01-06T23:44:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![petk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/petk/32/4555_2.png) [@petk](https://discourse.cmake.org/u/petk)\
**Post date:** [January 6, 2025, 11:44pm UTC](https://discourse.cmake.org/t/multi-value-keywords-in-cmake-parse-arguments/13337/1 "2025-01-06T23:44:10Z")

</div>

Hello,

can someone perhaps confirm if this is a feature or a side effect that should be avoided:

```cmake
function(foo)
  cmake_parse_arguments(
    PARSE_ARGV
    0
    PARSED_ARGS # prefix
    "" # options
    "" # one-value keywords
    "OPTIONS" # multi-value keywords
  )
  message(STATUS "${PARSED_ARGS_OPTIONS}")
endfunction()

foo(OPTIONS --foo --bar --baz)
# outputs: --foo;--bar;--baz

foo(OPTIONS --foo --bar OPTIONS --baz)
# outputs: --foo;--bar;--baz

```

The multi-value keywords could be used multiple times in a function call?

---

<div class="post-metadata">

**Author:** ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)\
**Post date:** [January 7, 2025, 4:33pm UTC](https://discourse.cmake.org/t/multi-value-keywords-in-cmake-parse-arguments/13337/2 "2025-01-07T16:33:44Z")

</div>

I think this is an unexpected side effect.  
In fact, all options can be specified multiple time. For `one-value`, the last option specified wins. And for `multi-value`, all arguments are aggregated.

Please create an issue for this problem. We have two options here:

1. Keep the current behavior, but the doc must be updated
2. Raise an error if options are not uniquely specified, but require a policy.
