# list of commands supporting generator expressions

**URL:** https://discourse.cmake.org/t/list-of-commands-supporting-generator-expressions/2743
**Category:** Usage
**Created:** [February 11, 2021, 12:58pm UTC](https://discourse.cmake.org/t/list-of-commands-supporting-generator-expressions/2743 "2021-02-11T12:58:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![woodz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/woodz/32/1199_2.png) [@woodz](https://discourse.cmake.org/u/woodz)
#### Post date: [February 11, 2021, 12:58pm UTC](https://discourse.cmake.org/t/list-of-commands-supporting-generator-expressions/2743/1 "2021-02-11T12:58:01Z")

</div>

set() supports generator expressions but this is not mentioned in the [official doc](https://cmake.org/cmake/help/latest/command/set.html?highlight=set) to this command.

I’ve been told using generator expressions in set() is agnostic.

Is there a compulsory and complete list of commands supporting generator expressions?

---

<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 11, 2021, 1:33pm UTC](https://discourse.cmake.org/t/list-of-commands-supporting-generator-expressions/2743/2 "2021-02-11T13:33:18Z")

</div>

What do you mean by “support”? `set()` won’t _expand_ generator expressions, but it can certainly store their unexpanded forms (the `$<>` syntax) as normal text.

---

<div class="post-metadata">

### Author: ![woodz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/woodz/32/1199_2.png) [@woodz](https://discourse.cmake.org/u/woodz)
#### Post date: [February 11, 2021, 2:31pm UTC](https://discourse.cmake.org/t/list-of-commands-supporting-generator-expressions/2743/3 "2021-02-11T14:31:16Z")

</div>

> support

refers to the fact of not mentioning the ability of generator expressions in the [official doc of set()](https://cmake.org/cmake/help/latest/command/set.html?highlight=set)  
while on other commands like [target\_compile\_definitions()](https://cmake.org/cmake/help/latest/command/target_compile_definitions.html?highlight=arget_compile_definitions#target-compile-definitions) the ability to use generator expressions is mentioned explicitly.

One reason not to explicitly state the ability for `set()`, I didn’t know, is your explanation.

Would be nice to clarify my second question about the list of commands able to receive generator expressions as arguments.

---

<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 11, 2021, 2:54pm UTC](https://discourse.cmake.org/t/list-of-commands-supporting-generator-expressions/2743/4 "2021-02-11T14:54:15Z")

</div>

All of them accept genexes as arguments. The difference is in what commands end up plumbing them through to a place which expands them in a useful location.

Some commands only support them in different modes, different signatures, or within specific arguments. For example `add_test(TestName)` does not support them at all while `add_test(NAME TestName)` does. And `add_custom_command` didn’t support it in `OUTPUT` argument values until 3.20.
