Skip to content

miredirex/cmake-vcpkg-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMake vcpkg project example

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