CMake/Help/command/UNSET_NOTE.txt
Brad King 512f64289a Help: Clarify that set(VAR) unsets VAR
Also call out possible exposure of an existing cache entry of the same
name, as we have for the `unset` command since commit 1a0f1a25a4 (Help:
Clarify the unset command, 2018-08-17, v3.13.0-rc1~199^2).

Issue: #24633
2023-03-24 14:44:45 -04:00

10 lines
514 B
Plaintext

.. note::
When evaluating :ref:`Variable References` of the form ``${VAR}``, CMake
first searches for a normal variable with that name. If no such normal
variable exists, CMake will then search for a cache entry with that name.
Because of this, **unsetting a normal variable can expose a cache variable
that was previously hidden**. To force a variable reference of the form
``${VAR}`` to return an empty string, use ``set(<variable> "")``, which
clears the normal variable but leaves it defined.