8

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.

PaulR
  • 706
  • 9
  • 27

2 Answers2

6

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.

borievka
  • 636
  • 5
  • 13
  • 1
    Unfortunately, I have no usage files and no targets files in my installed package folder (Windows). – Fido May 14 '20 at 07:54
2

Just run the command vcpkg install again.

 .\vcpkg.exe install fmt
Computing installation plan...
The following packages are already installed:
    fmt[core]:x64-windows -> 8.0.1
Package fmt:x64-windows is already installed
Restored 0 packages from **\AppData\Local\vcpkg\archives in 155.9 us. Use --debug to see more details.

Total elapsed time: 58.04 ms

The package fmt provides CMake targets:

    find_package(fmt CONFIG REQUIRED)
    target_link_libraries(main PRIVATE fmt::fmt)

    # Or use the header-only version
    find_package(fmt CONFIG REQUIRED)
    target_link_libraries(main PRIVATE fmt::fmt-header-only)

Jasper Li
  • 81
  • 5