问题
I'm working on c++ project on a linux machine and it uses several boost libraries. I've installed them on my system using vcpkg and build it using the toolchain provided by vcpkg. My question is: How do I define the dependencies so that they automatically install on a different system, if they were to build it? Conan has a way of doing it by defining the dependencies in conanfile.txt. How do I do the same with vcpkg?
Edit1: I've found autovcpkg which does the job I'm looking to do but can the same be done natively inside cmakelists.txt or by vcpkg itself?
回答1:
I've found autovcpkg which does the job I'm looking to do but can the same be done natively inside cmakelists.txt or by vcpkg itself?
You can write a vcpkg port for your library or executable by providing a CONTROL
and portfile.cmake
file. In the CONTROL file you define all the dependencies and possible features while the portfile contains the build instruction. You can use vcpkg create <myport> <url> <filename>
to create the CONTROL
and portfile.cmake
from a template which can be customized to your needs.
Together with a port-overlay this port can also be used by others without being merged into vcpkg/master
来源:https://stackoverflow.com/questions/61016978/cmake-question-how-do-i-use-vcpkg-to-install-dependencies-automatically