Read project version from cache

See the following interaction:

alex@Alex-Desktop:~/Development/Halide-build$ grep VERSION CMakeCache.txt
CMAKE_PROJECT_VERSION:STATIC=12.0.0
CMAKE_PROJECT_VERSION_MAJOR:STATIC=12
CMAKE_PROJECT_VERSION_MINOR:STATIC=0
CMAKE_PROJECT_VERSION_PATCH:STATIC=0
CMAKE_PROJECT_VERSION_TWEAK:STATIC=
PYBIND11_PYTHON_VERSION:STRING=
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
CMAKE_CACHE_MINOR_VERSION:INTERNAL=18
CMAKE_CACHE_PATCH_VERSION:INTERNAL=2
alex@Alex-Desktop:~/Development/Halide-build$ cmake -N -LA . | grep VERSION
PYBIND11_PYTHON_VERSION:STRING=

Why does cmake -N -LA . not show CMAKE_PROJECT_VERSION? Is there some way to get the version easily from the command line?

I suspect it has to do with the STATIC and INTERNAL types of those variables. I don’t think you can change them with -D which would indicate that they won’t be shown with -LA. I believe grep might be the way to go here.

grep it is, then. Thanks.