Home

CMAKECACHEMAJORVERSION

CMAKE_CACHE_MAJOR_VERSION, more commonly seen as CMAKE_CACHE_MAJOR_VERSION in CMakeCache.txt, is an internal cache metadata variable used by CMake to identify the major version of the cache format. It is generated automatically and stored in the build directory's CMakeCache.txt when a project is configured.

The major version works in concert with CMAKE_CACHE_MINOR_VERSION to indicate cache format compatibility. CMake compares the

The variable is not designed to be manually edited by users. It appears in the cache file

Handling cache incompatibility usually involves removing or regenerating the cache. If upgrading or downgrading CMake across

In summary, CMAKE_CACHE_MAJOR_VERSION is an internal mechanism that helps ensure cache compatibility across CMake major-version boundaries,

cache’s
major
version
with
the
major
version
of
the
running
CMake
executable;
if
they
do
not
match,
the
existing
cache
is
considered
incompatible.
In
that
scenario,
CMake
will
typically
regenerate
the
build
system
rather
than
attempt
to
reuse
an
incompatible
cache.
as
a
simple
string
value
(for
example,
CMAKE_CACHE_MAJOR_VERSION:STRING=3).
The
exact
numbers
reflect
changes
in
the
cache
format
used
by
CMake
between
releases
and
are
not
intended
to
convey
the
version
of
the
CMake
software
itself.
major
versions,
the
recommended
action
is
to
delete
the
CMakeCache.txt
file
(and
often
the
CMakeFiles
directory)
or
run
a
fresh
configure
to
produce
a
compatible
cache.
preventing
misinterpretation
of
cached
variables
and
reducing
the
risk
of
incorrect
builds.