# Feature Request: Support for deprecating variables

**URL:** https://discourse.cmake.org/t/feature-request-support-for-deprecating-variables/15529
**Category:** Code
**Created:** [February 24, 2026, 10:07pm UTC](https://discourse.cmake.org/t/feature-request-support-for-deprecating-variables/15529 "2026-02-24T22:07:55Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![dalg24](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dalg24/32/3389_2.png) [@dalg24](https://discourse.cmake.org/u/dalg24)
#### Post date: [February 24, 2026, 10:07pm UTC](https://discourse.cmake.org/t/feature-request-support-for-deprecating-variables/15529/1 "2026-02-24T22:07:55Z")

</div>

It would be nice if we were able to mark a variable that is set as deprecated so that the consumer of that variable is made aware he should not depend on it.

Something like

```cmake
set(Foo_OLD_AND_LAME ON DEPRECATED "Use Foo_NEW_AND_RAD instead!")

```

This came up a few times with variables we were exporting and we ended up guarding the definition of these variables

```cmake
if(Foo_ENABLE_DEPRECATED_STUFF)
  set(Foo_OLD_AND_LAME ON)
endif()

```

which works but it clearly suboptimal.

---

<div class="post-metadata">

### Author: ![leha-bot](https://discourse.cmake.org/user_avatar/discourse.cmake.org/leha-bot/32/921_2.png) [@leha-bot](https://discourse.cmake.org/u/leha-bot)
#### Post date: [July 13, 2026, 8:21am UTC](https://discourse.cmake.org/t/feature-request-support-for-deprecating-variables/15529/2 "2026-07-13T08:21:52Z")

</div>

I don’t actually remember if variable could have properties… but it could be modelled right targets
