Skip to content
/ cmake-template Public template

GitHub repository template for C++ projects, based on CMake, vcpkg, and VSCode

Notifications You must be signed in to change notification settings

dgellow/cmake-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Template: C++, CMake, and vcpkg

Based on this blog post where I describe how to setup a modern and cross-platform C++ environment.

Features:

  • CMake config for library, executable, and test.
  • Depends on Catch2 and fmt installed from vcpkg.
  • VSCode setup (config and extension recommendations)

Note (from the author): Some of my personal settings are hardcoded.

Build

First configure via cmake (where DCMAKE_TOOLCHAIN_FILE matches your vcpkg path):

$ cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=C:/Users/Sam/Development/vcpkg/scripts/buildsystems/vcpkg.cmake

If that was successful, build via cmake --build:

$ cmake --build build
$ ./build/Debug/main.exe
Greetings stranger. Or should I say: Hello world!

Run tests via ctest:

$ cd build
$ ctest --output-on-failure

Releases

No releases published

Packages

No packages published