Variables(CMake)

Variables(CMake)

Content #

Three category:

  • normal (use ${})
  • cache (use ${} or $CACHE{})
  • environment (use $ENV{})

Key facts #

  1. Variable names are case-sensitive.
  2. All variables are stored internally as strings.
  3. The basic variable manipulation commands are set() and unset(), but there are other commands that can affect variables, such as string() and list()

Manipulate environment variables #

set(ENV{CXX} "clang++")
unset(ENV(VERBOSE))

Cache variables(CMake) #

CMAKE_BUILD_TYPE