# Bracket arguments feature broken?

**URL:** <https://discourse.cmake.org/t/bracket-arguments-feature-broken/15250>\
**Category:** Code\
**Created:** [October 16, 2025, 9:10am UTC](https://discourse.cmake.org/t/bracket-arguments-feature-broken/15250 "2025-10-16T09:10:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Renek](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/3be4f8/32.png) [@Renek](https://discourse.cmake.org/u/Renek)\
**Post date:** [October 16, 2025, 9:10am UTC](https://discourse.cmake.org/t/bracket-arguments-feature-broken/15250/1 "2025-10-16T09:10:33Z")

</div>

I’m reading the documentation and came across the bracket argument example [here](https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#bracket-argument).

However, the example does not even work and I’m getting an error:

```auto
CMake Error at RGFramework/CMakeLists.txt:10:
Parse error. Expected a command name, got unquoted argument with text “.”.

```

I also get an error with this simple usage:

```auto
message([[
Hello
]])

```

According to the documentation it’s should be valid.

> An opening bracket is written `[` followed by zero or more `=` followed by `[` .

Do I miss something here?

---

<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:** [October 16, 2025, 9:37am UTC](https://discourse.cmake.org/t/bracket-arguments-feature-broken/15250/2 "2025-10-16T09:37:14Z")

</div>

Which CMake version are you using? What is the exact error you’re getting on the `message` example?

---

<div class="post-metadata">

**Author:** ![Renek](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/3be4f8/32.png) [@Renek](https://discourse.cmake.org/u/Renek)\
**Post date:** [October 16, 2025, 10:30am UTC](https://discourse.cmake.org/t/bracket-arguments-feature-broken/15250/3 "2025-10-16T10:30:37Z")

</div>

I using CMake 4.1.1

```auto
cmake version 4.1.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

```

The exact error I get with the simple message is this one:

```auto
CMake Error at RGFramework/CMakeLists.txt:772:
  Parse error. Expected a command name, got right paren with text ")".

```

Interestingly both samples worked when I placed them in a simple top-level CMakeLists.txt  
However, when I put them in my project; deep down some nested CMakeLists.txt and nested if()/else() branches and it fails.

I’ll try to create a very simple reproducible project and come back.

---

<div class="post-metadata">

**Author:** ![Renek](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/3be4f8/32.png) [@Renek](https://discourse.cmake.org/u/Renek)\
**Post date:** [October 16, 2025, 10:39am UTC](https://discourse.cmake.org/t/bracket-arguments-feature-broken/15250/4 "2025-10-16T10:39:58Z")

</div>

Nevermind!

I got the error when I placed the message in a multi-line comment:

```auto
#[[		
	message([[
		Hello
	]])
#]]

```

So the token `#[[` conflicts with the first `]]` found. I would expect it to not care until the next #]] though.

---

<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:** [October 16, 2025, 11:54am UTC](https://discourse.cmake.org/t/bracket-arguments-feature-broken/15250/5 "2025-10-16T11:54:28Z")

</div>

If you look at the [Bracket Comment definition](https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#bracket-comment) closely enough, you will see that it opens by `#[[` and closes by `]]` (optionally with same number of `=` signs between the brackets). So in your case, the comment was closed by the `]])` line, hence `)` being reported as an error. There is no indication that `#]]` should close the comment.

If you want to comment out a block of code like this, use a unique number of `=` signs. This would have worked:

```auto
#[=[		
	message([[
		Hello
	]])
]=]

```

---

<div class="post-metadata">

**Author:** ![Renek](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/3be4f8/32.png) [@Renek](https://discourse.cmake.org/u/Renek)\
**Post date:** [October 16, 2025, 11:58am UTC](https://discourse.cmake.org/t/bracket-arguments-feature-broken/15250/6 "2025-10-16T11:58:22Z")

</div>

Indeed. I completely missed this.

Thank you for the support and the explanation!

---

<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:** [October 16, 2025, 12:00pm UTC](https://discourse.cmake.org/t/bracket-arguments-feature-broken/15250/7 "2025-10-16T12:00:09Z")

</div>

Happy to help.
