# Equivalent of INTERFACE for set\_target\_properties

**URL:** <https://discourse.cmake.org/t/equivalent-of-interface-for-set-target-properties/15141>\
**Category:** Code\
**Created:** [September 1, 2025, 1:53pm UTC](https://discourse.cmake.org/t/equivalent-of-interface-for-set-target-properties/15141 "2025-09-01T13:53:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdong8](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rdong8/32/5381_2.png) [@rdong8](https://discourse.cmake.org/u/rdong8)\
**Post date:** [September 1, 2025, 1:53pm UTC](https://discourse.cmake.org/t/equivalent-of-interface-for-set-target-properties/15141/1 "2025-09-01T13:53:44Z")

</div>

```auto
add_library(config INTERFACE)

set_target_properties(config
        PROPERTIES
        COMPILE_WARNING_AS_ERROR ON
        LINK_WARNING_AS_ERROR ON
)

add_executable(exec PRIVATE main.cpp)
target_link_libraries(exec PRIVATE config)

```

This doesn’t work as expected because the properties on `config` are not propagated to `exec`. What would be the right way to do this?

---

<div class="post-metadata">

**Author:** ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)\
**Post date:** [September 1, 2025, 10:04pm UTC](https://discourse.cmake.org/t/equivalent-of-interface-for-set-target-properties/15141/2 "2025-09-01T22:04:41Z")

</div>

Those are not properties you can or should try to force on consumers. A consuming project may have different objectives to you and may not want to make warnings be treated as errors. Outside of a company environment where things are tightly controlled, you shouldn’t even turn these on for the project itself. It should be under the control of the developer to decide whether they want to turn warnings into errors. They might want to try building with a newer compiler that has more warnings than earlier versions, so they may need to allow warnings for a while as they work through addressing them.

CMake presets are a much better place for a project to specify turning warnings into errors. The developer can still override settings specified there, but they can be good pre-canned setups for things like CI or common developer environments.
