# Is this really a better style to use generator expressions every time?

**URL:** <https://discourse.cmake.org/t/is-this-really-a-better-style-to-use-generator-expressions-every-time/2753>\
**Category:** Usage\
**Created:** [February 12, 2021, 12:47pm UTC](https://discourse.cmake.org/t/is-this-really-a-better-style-to-use-generator-expressions-every-time/2753 "2021-02-12T12:47:26Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [February 12, 2021, 12:55pm UTC](https://discourse.cmake.org/t/is-this-really-a-better-style-to-use-generator-expressions-every-time/2753/2 "2021-02-12T12:55:37Z")

</div>

These two options are 100% equivalent, because `${MSVC}` in the genex will be evaluated immediately (i.e. at configure time). So it comes down fully to code style preference, which is subjective (but I find the `if`-based form more readable).

For a case where configure-time vs. generate-time can be different, see a [recent question of mine](https://discourse.cmake.org/t/use-variables-or-genexes-with-usage-requirements/2679).

---

_[View the full topic](https://discourse.cmake.org/t/is-this-really-a-better-style-to-use-generator-expressions-every-time/2753)._
