Skip to content

A template to initiate C++ projects with a clear project structure using CMake+vcpkg with a docker container 'ready to go'

License

Notifications You must be signed in to change notification settings

yonatan-ratner/CMake-vcpkg-template

Repository files navigation

CMake vcpkg project example

Disclaimer - I took this repo and removed libtcod to get a 'cleaner' template for myself.

An example on how to setup a CMake project with vcpkg and its manifest (vcpkg.json) experimental feature

Getting Started

Clone the repo with the --recurse-submodules flag

git clone --recurse-submodules https://github.com/miredirex/cmake-vcpkg-example.git

Run ./vcpkg/bootstrap-vcpkg.sh or .\vcpkg\bootstrap-vcpkg.bat

Fetch the dependencies (see vcpkg.json):
(This is optional, CMake should run vcpkg install anyway)

./vcpkg/vcpkg --feature-flags=manifests install

Build the project using your IDE/build tool of choice or manually:

cmake -B build -S .
cmake --build build

For CLion users

To avoid long file indexing, you might want to exclude the vcpkg directory:

  1. Right click on vcpkg in the Project window
  2. Mark Directory as -> Library Files or Excluded (I recommend choosing the latter)

Troubleshooting

If you're getting

Could not find a package configuration file provided by "fmt" with any of
  the following names:
 
  ...

or similar, try deleting cmake's build directory and rebuilding the project

About

A template to initiate C++ projects with a clear project structure using CMake+vcpkg with a docker container 'ready to go'

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published