2.5.1. GUI: Visual Studio

Open CMake GUI:

../../_images/01-open-cmake-gui.png

Click Browse Source... and find directory with CMakeLists.txt and foo.cpp:

../../_images/02-click-browse-source.png

Now we need to choose directory where to put all temporary files. Let’s create separate directory so we can keep our original directory clean. Click Browse Build..:

../../_images/03-click-browse-build.png

Find directory with CMakeLists.txt and click Make New Folder to create _builds directory:

../../_images/04-create-new-folder.png

Check the resulted layout:

../../_images/05-layout.png

Click on Configure to process CMakeLists.txt:

../../_images/06-configure.png

CMake will ask for the generator you want to use. Pick Visual Studio you have installed and add Win64 to have x64 target:

../../_images/07-generator.png

After you click Finish CMake will run internal tests on build tool to check that everything works correctly. You can see Configuring done message when finished:

../../_images/08-configuring-done.png

For now there was no native build tool files generated, on this step user is able to do additional tuning of project. We don’t want such tuning now so will run Generate:

../../_images/09-generate.png

Now if you take a look at _builds folder you can find generated Visual Studio solution file:

../../_images/10-open-solution.png

Open foo.sln and run executable.