CMake (2026-08-19 - 2026-08-20) =============================== .. topic:: Course Information * Course start: 2026-08-19 at 9:00am * Project on Codeberg: https://codeberg.org/jfasch/2026-08-19--CMake * Agenda: :doc:`agenda` .. toctree:: :hidden: agenda This is the livelog of the course once it is being held, with topics taken from :doc:`the agenda ` as we go. Course Preparation, Attendee Workstation Setup ---------------------------------------------- (This information is part of the README of the `course project `__) Install Git ........... * From https://git-scm.com/install/windows, select *standalone installer* for Windows/x64 and invoke it. * Review "Select Components". Maybe you want a Git desktop icon * "Default Editor": maybe notepad++ will be the best - you decide. Note that we will use git only to clone and update; commits are not on the radar, and likely we'll not use that editor anyway. Clone Course Project .................... .. topic:: Course Project On Codeberg https://codeberg.org/jfasch/2026-08-19--CMake.git From the DOS prompt, use Git to clone our course project. This will create a subdirectory ``2026-08-19--CMake`` of the current working directory (mine is ``C:\Users\jfasch\My-Projects``). .. code-block:: console C:\Users\jfasch\My-Projects> git clone https://codeberg.org/jfasch/2026-08-19--CMake.git Cloning into '2026-08-19--CMake'... remote: Enumerating objects: 5, done. remote: Counting objects: 100% (5/5), done. remote: Compressing objects: 100% (4/4), done. remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0) Receiving objects: 100% (5/5), done. Microsoft Compiler .................. See if the Microsoft compiler is installed, by simply invoking ``cl`` from the DOS prompt. If we see the usage message, all is well. .. code-block:: console C:\Users\jfasch\My-Projects> cl Microsoft (R) C/C++-Optimierungscompiler Version 19.50.35728 für x64 Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten. Syntax: cl [ Option... ] Dateiname... [ /link Linkeroption... ] Build Project ............. First, create a dedicated build directory, ideally far far away from the source directory. For example ``C:/Users/jfasch/My-Builds/2026-08-19--CMake-win32-native``. .. code-block:: console C:\Users\jfasch> mkdir C:\Users\jfasch\My-Builds\2026-08-19--CMake-win32-native *CMake's main task:* use ``cmake`` to generate a Visual Studio project. This is default on Windows if the Microsoft compiler is installed .. code-block:: console C:\Users\jfasch> cmake -S C:\Users\jfasch\My-Projects\2026-08-19--CMake -B C:\Users\jfasch\My-Builds\2026-08-19--CMake-win32-native -- Building for: Visual Studio 18 2026 -- Selecting Windows SDK version 10.0.26100.0 to target Windows 10.0.26200. -- The C compiler identification is MSVC 19.50.35728.0 -- The CXX compiler identification is MSVC 19.50.35728.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools/MSVC/14.50.35717/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools/MSVC/14.50.35717/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done (4.8s) -- Generating done (0.1s) -- Build files have been written to: C:/Users/jfasch/My-Builds/2026-08-19--CMake-win32-native Use CMake to build the project, invoking Microsoft's build system under the hood. This is not CMake's main task, but this way we get away without screenshots showing which button to press in Visual Studio. .. code-block:: console C:\Users\jfasch\My-Projects\2026-08-19--CMake> cmake --build C:\Users\jfasch\My-Builds\2026-08-19--CMake-win32-native MSBuild-Version 18.4.0+6e61e96ac für .NET Framework 1>Checking Build System Building Custom Rule C:/Users/jfasch/My-Projects/2026-08-19--CMake/CMakeLists.txt hello.cpp hello.vcxproj -> C:\Users\jfasch\My-Builds\2026-08-19--CMake-win32-native\Debug\hello.exe Building Custom Rule C:/Users/jfasch/My-Projects/2026-08-19--CMake/CMakeLists.txt You might just as well open the "solution" CMake has created, and use your favorite Windows workflow; you find it in the build directory.