Safety of changing values of variables by editing CMakeCache.txt Vs supplying them through the command line


I’m working on a project involving LLVM and keep shifting between the Debug and Release build by assigning different values to CMAKE_BUILD_TYPE in <llvm_build>/CMakeCache.txt and then building it.

I wanted to know if this was a safe alternative to re-configuring the build after removing <llvm_build>/CMakeFiles/ and <llvm_build>/CMakeCache.txt.


Have two build directories which each point to the the same source folder.

$ (mkdir release && cd release && cmake path/to/source

$ (mkdir debug && cd debug && cmake path/to/source -DCMAKE_BUILD_TYPE=Debug)


Thanks for your response Michael !

I would have to maintain a symlink which points to either directory then. Is that recommended ?