# Platform/Generator specific properties in a condition

**URL:** <https://discourse.cmake.org/t/platform-generator-specific-properties-in-a-condition/8713>\
**Category:** Code\
**Created:** [August 10, 2023, 12:41pm UTC](https://discourse.cmake.org/t/platform-generator-specific-properties-in-a-condition/8713 "2023-08-10T12:41:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rehans](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rehans/32/3707_2.png) [@rehans](https://discourse.cmake.org/u/rehans)\
**Post date:** [August 10, 2023, 12:41pm UTC](https://discourse.cmake.org/t/platform-generator-specific-properties-in-a-condition/8713/1 "2023-08-10T12:41:16Z")

</div>

Often I see cmake code like this:

```cmake
if(APPLE)
    set(CMAKE_XCODE_GENERATE_SCHEME TRUE)
else()
    set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECTlab)
endif()

```

Is it really necessary to do the if…else clause? Isn’t it clear already by the name of the property that it belongs to XCODE or VS? I would rather write:

```cmake
set(CMAKE_XCODE_GENERATE_SCHEME TRUE)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECTlab)

```

Does it have any impact to leave out the if…else clause? What’s the best practice for code like this?

---

<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:** [August 10, 2023, 12:42pm UTC](https://discourse.cmake.org/t/platform-generator-specific-properties-in-a-condition/8713/2 "2023-08-10T12:42:21Z")

</div>

Yeah, the properties are only “active” when the generator looks at them, so you can make these unconditional since the other generators will just ignore them.
