Getting Started with CMake
Console output
C:\GitRepositories\NeedfulSoftware\CMakeTutorials\HelloWorld\build>cmake .. -G " Visual Studio 14 2015 Win64" -- The C compiler identification is MSVC 19.0.24213.1 -- The CXX compiler identification is MSVC 19.0.24213.1 -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studi o 14.0/VC/bin/x86_amd64/cl.exe -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studi o 14.0/VC/bin/x86_amd64/cl.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: C:/GitRepositories/NeedfulSoftware/CMakeTut orials/HelloWorld/build C:\GitRepositories\NeedfulSoftware\CMakeTutorials\HelloWorld\build>
![]() | Specifying the wrong generator may fail with a rather confusing error message. For instance here is the output if I try to use Visual Studio 2017 which is not installed on my computer. |
Console output
C:\GitRepositories\NeedfulSoftware\CMakeTutorials\HelloWorld\build>cmake .. -G " Visual Studio 15 2017 Win64" -- The C compiler identification is unknown -- The CXX compiler identification is unknown CMake Error at CMakeLists.txt:2 (project): No CMAKE_C_COMPILER could be found. CMake Error at CMakeLists.txt:2 (project): No CMAKE_CXX_COMPILER could be found. -- Configuring incomplete, errors occurred! See also "C:/GitRepositories/NeedfulSoftware/CMakeTutorials/HelloWorld/build/CMa keFiles/CMakeOutput.log". See also "C:/GitRepositories/NeedfulSoftware/CMakeTutorials/HelloWorld/build/CMa keFiles/CMakeError.log". C:\GitRepositories\NeedfulSoftware\CMakeTutorials\HelloWorld\build>
![]() |
Figure 1: The HelloWorld project opened with Visual Studio |
Creating a Visual Studio Project with the GUI
![]() |
Figure 2: |
![]() |
Figure 3: |
![]() |
Figure 4: |