Reputation: 2095
I'm modifying a project which uses CMake to include a library which is managed by vcpkg
.
It looks like in order for vcpkg
's packages to be found, CMAKE_TOOLCHAIN_FILE
has to be defined... somewhere.
I'm confused because everything suggests that the value of CMAKE_TOOLCHAIN_FILE
should contain the install location of vcpkg
on the user's system, but I don't know how to reliably obtain that or get that information into the build system of the project. It certainly seems untenable to require each user to modify their copy of the project CMake files to point to their chosen install location. Requiring the developer / build system to set an env variable also seems pretty fragile and is not very well encapsulated (I'd hope that setup + build could be a single command).
I am pretty new to CMake and completely new to vcpkg
. What is the idiomatic way to configure a project to use vcpkg
?
Upvotes: 5
Views: 2434
Reputation: 1141
Possible answer: cmake -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake
Upvotes: 3