# Changes do not apply when changing an option variable

**URL:** https://discourse.cmake.org/t/changes-do-not-apply-when-changing-an-option-variable/9871
**Category:** Usage
**Created:** [January 17, 2024, 5:31pm UTC](https://discourse.cmake.org/t/changes-do-not-apply-when-changing-an-option-variable/9871 "2024-01-17T17:31:28Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [January 17, 2024, 6:31pm UTC](https://discourse.cmake.org/t/changes-do-not-apply-when-changing-an-option-variable/9871/2 "2024-01-17T18:31:45Z")

</div>

How are you changing them? If it is:

```cmake
option(varname "docs" ON)
# ^^ here

```

This is the _default_ for the option. If the cache variable already exists, it is not updated. CMake has no mechanism to know “user set it to `OFF`” versus “the old default was `OFF`” when seeing this code.

See this post: [Project variants? - #5 by ben.boeckel](https://discourse.cmake.org/t/project-variants/205/5)

---

_[View the full topic](https://discourse.cmake.org/t/changes-do-not-apply-when-changing-an-option-variable/9871)._
