
Modern CMake for C++
By :

Variables in CMake are a surprisingly complex subject. Not only are there three categories of variables – normal, cache, and environment – but they also reside in different variable scopes, with specific rules on how one scope affects the other. Very often, a poor understanding of these rules becomes a source of bugs and headaches. I recommend you study this section with care and make sure you understand all of the concepts before moving on.
Let’s start with some key facts about variables in CMake:
The basic variable manipulation commands are set()
and unset()
, but there are other commands that can alter variable values, such as string()
and list()
.
To declare a normal variable, we simply call set()
, providing...