Reference tutorial: https://www.youtube.com/watch?v=4gl2szb6d4Q
CMake Tools official documentation: https://github.com/microsoft/vscode-cmake-tools
- Install MSYS2 and mingw-w64 GCC
- Instructions here: https://www.msys2.org/
- Install CMake
- Execute this in cmd:
winget install cmake
- Execute this in cmd:
- Install Microsoft Visual Studio Code and add these extensions:
- C/C++ (Microsoft)
- CMake Tools (Microsoft)
- CMake (twxs) [optional]
- Create an empty folder for your project.
- Open VSCode in that folder.
- View -> Command Palette.
- Type "cmake", all cmake commands will appear:
- "CMake: Quick Start" will set up your project, create a CMakeLists.txt file, a build folder, ecc...
- "CMake: Configure" will execute cmake, it will create/update the build folder. This is auto-executed also when you save CMakeLists.txt
- "CMake: Build" will build your project.
- "CMake: Debug" will start the debugger.
cmake_minimum_required (VERSION 3.27)
project (YourProjectNameHere)
file (
GLOB sourcefiles
"src/*.h"
"src/*.c"
)
add_executable(${PROJECT_NAME} ${sourcefiles})