After installing packages with vcpkg, help text is shown, eg...
The package fmt:x64-windows provides CMake targets:
find_package(fmt CONFIG REQUIRED)
target_link_libraries(main PRIVATE fmt::fmt fmt::fmt-header-only)
... for the varying instructions needed for using them with CMake. Where do you get this information from if you want to recall it in the future and didn't write it down? Some libraries have more involved instructions than the above.
The best way to use installed libraries with cmake is via the toolchain file scripts\buildsystems\vcpkg. cmake . To use this file, you simply need to add it onto your CMake command line as: -DCMAKE_TOOLCHAIN_FILE=D:\src\vcpkg\scripts\buildsystems\vcpkg.
If installing globally, we recommend a short install path like: C:\src\vcpkg or C:\dev\vcpkg, since otherwise you may run into path issues for some port build systems. Make sure you are in the directory you want the tool installed to before doing this.
You can find the help text in files called 'usage'.
You can locate them in either in ports
directory or if you are interested only for your packages, then they are in installed
. You can search for them with the following command:
# VCPKG_ROOT denotes where is vcpkg installed
$ find $VCPKG_ROOT . -name usage
installed/x64-linux/share/openssl/usage
installed/x64-linux/share/gtest/usage
However some packages, including fmt
, are not providing this information in a specific file, they are providing only targets. They are stored in $VCPKG_ROOT/installed/<YOUR_ARCHITECTURE>/share/fmt/fmt-targets.cmake
.
vcpkg
is then printing a list of targets after the installation. I don't know if there exists a better solution then finding the <package>-targets.cmake
files and checks the content.
$ find $VCPKG_ROOT/installed -name *-targets.cmake
installed/x64-linux/share/cxxopts/cxxopts-targets.cmake
installed/x64-linux/share/fmt/fmt-targets.cmake
So if you combine these two techniques, you should be able to find all the information that vcpkg
is printing after installation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With