# Why \`ARGV\` got \`aa;"bb"\` when I call \`func("aa";"bb")\`?

**URL:** https://discourse.cmake.org/t/why-argv-got-aa-bb-when-i-call-func-aa-bb/15325
**Category:** Code
**Created:** [November 19, 2025, 8:39am UTC](https://discourse.cmake.org/t/why-argv-got-aa-bb-when-i-call-func-aa-bb/15325 "2025-11-19T08:39:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dingcurie](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dingcurie/32/5915_2.png) [@dingcurie](https://discourse.cmake.org/u/dingcurie)
#### Post date: [November 19, 2025, 8:39am UTC](https://discourse.cmake.org/t/why-argv-got-aa-bb-when-i-call-func-aa-bb/15325/1 "2025-11-19T08:39:55Z")

</div>

Why the following code outputs `aa;”bb”`, instead of `aa;bb` or `“aa”;”bb”`?

```cmake
function(func)
    message("${ARGV}")
endfunction()

func("aa";"bb")

```

> **[Compiler Explorer - CMakeScript](https://godbolt.org/z/x9EvKas1P)**
>
> function(func)
> message("${ARGV}")
> endfunction()
> 
> func("aa";"bb")

 ![image](https://discourse.cmake.org/uploads/default/original/2X/e/e59086fe468d88b83804ae23bc9329cb6b6c2f06.png)

---

<div class="post-metadata">

### Author: ![Angew](https://discourse.cmake.org/user_avatar/discourse.cmake.org/angew/32/229_2.png) [@Angew](https://discourse.cmake.org/u/Angew)
#### Post date: [November 20, 2025, 4:05pm UTC](https://discourse.cmake.org/t/why-argv-got-aa-bb-when-i-call-func-aa-bb/15325/2 "2025-11-20T16:05:16Z")

</div>

It’s for legacy reasons. Refer the CMake [grammar symbol `unquoted_argument`](https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#grammar-token-unquoted_legacy) and the note below it for details. In short, quotes should not be written this way in new CMake code.

---

<div class="post-metadata">

### Author: ![alexshpilkin](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alexshpilkin/32/5920_2.png) [@alexshpilkin](https://discourse.cmake.org/u/alexshpilkin)
#### Post date: [November 24, 2025, 6:42pm UTC](https://discourse.cmake.org/t/why-argv-got-aa-bb-when-i-call-func-aa-bb/15325/3 "2025-11-24T18:42:37Z")

</div>

What is the logic that makes it `aa;"bb"` (not expanded as a list, at that!) and not e.g. `aa";"bb` though? The `unquoted_legacy` production isn’t actually in the docs except as fairly vague prose, so it’s kind of difficult to tell what actually qualifies and how it gets interpreted. (I get that the idea is that I wouldn’t need to when doing things properly, but I do mess up on, uh, occasion, so it’d be nice to know what to expect.)

It can’t be that any argument that has quotes anywhere that’s not the start or the end (is always treated as a single argument and) has the first matching pair of quotes stripped: I tried `a="${B}"` by mistake at one point and got `a=""` for my troubles, so all the quotes that were in the original got passed through.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 19, 2026, 8:49pm UTC](https://discourse.cmake.org/t/why-argv-got-aa-bb-when-i-call-func-aa-bb/15325/4 "2026-02-19T20:49:20Z")

</div>

This is deep in CMake’s history…probably difficult to change it at this point. CMake is not Bash and does not support inner quoting. It’s unclear if the function gets it as two arguments and pastes them together because it is expanded in quotes or it comes as a single argument.
