Changing current cmake generator

For those seeking the CMake GUI answer.

Using the GUI menu
Go to File->Delete Cache and then click Configure again.


A scenario where changing the generator is needed is that you are keeping the CMake GUI open and reusing the same directory (source and CMakeList.txt) to do simple examples or tutorials and deleting the build files before starting again, e.g. with out-of-source build it would be the entire build directory. This is not the standard use case for CMake but one that would be common among beginners.


You cannot reliably change the generator used for an output (= binary) directory once generation has already happened there once. You should start in a fresh output directory.

Once there, simply use CMake's -G command-line option:

cmake -G "Visual Studio 12 2013 Win64"

Tags:

C++

Cmake