CMAKE_CACHEFILE_DIR should not be documented for public use
First running
$ cmake --version
cmake version 3.9.6
$ ls -1
build
CMakeLists.txt
main.cpp
$ cd build
$ cmake ..
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Configuring done
...
-- Generating done
-- Build files have been written to: /home/sem/tmp/test-proj/build
Making project:
$ make
Scanning dependencies of target hello
[ 50%] Building CXX object CMakeFiles/hello.dir/main.cpp.o
[100%] Linking CXX executable hello
[100%] Built target hello
Cleaning project build dir:
$ make clean-all
Scanning dependencies of target clean-all
Removing build dir: rm -rf /bin /boot /dev /etc /home /lib /lib32 /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /sys /tmp /usr /var
Built target clean-all
Variable ${CMAKE_CACHEFILE_DIR}
is NOT expanded into '/home/sem/tmp/test-proj/build' !
ERROR! Remove entire root file system / .
Second running
$ cmake ..
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sem/tmp/test-proj/build
Cleaning project build dir:
$ make clean-all
Removing build dir: rm -rf /home/sem/tmp/test-proj/build/CMakeCache.txt /home/sem/tmp/test-proj/build/CMakeFiles /home/sem/tmp/test-proj/build/cmake_install.cmake /home/sem/tmp/test-proj/build/hello /home/sem/tmp/test-proj/build/Makefile
Built target clean-all
Everything is fine!
Variable ${CMAKE_CACHEFILE_DIR}
is expanded into '/home/sem/tmp/test-proj/build' as it should be.