【问题标题】:How to retrieve cmake target names from vcpkg?如何从 vcpkg 中检索 cmake 目标名称?
【发布时间】:2020-10-20 22:11:31
【问题描述】:

安装软件包后,vcppkg 非常有帮助地显示相关的 CMake 目标...

包 libwebp:x64-windows 提供 CMake 目标:

find_package(WebP CONFIG REQUIRED)
target_link_libraries(main PRIVATE WebP::webp WebP::webpdemux WebP::libwebpmux WebP::webpdecoder)

但如果你不复制它们,那么你可能再也见不到它们了。至少我找不到他们。有谁知道如何检索已安装软件包的此信息?

【问题讨论】:

  • 再次运行 vcpkg install 。它会告诉你。当然它不会安装它,因为它存在。所以它很快
  • @stardust 它似乎不再提供 cmake 目标名称(在 macOS 中,vcpkg 提交 cd7f976
  • 没关系,它没有为特定的包(antlr4)提供它们

标签: cmake vcpkg target-link-libraries


【解决方案1】:

如果您通过以下方式安装了libwebp

$ ./vcpkg install libwebp

然后只需再次运行它就会显示使用信息:

$ ./vcpkg install libwebp
Computing installation plan...
The following packages are already installed:
    libwebp[core,nearlossless,simd]:x64-linux -> 1.1.0#3
Package libwebp:x64-linux is already installed

Total elapsed time: 12.88 us

The package libwebp:x64-linux provides CMake targets:

    find_package(WebP CONFIG REQUIRED)
    target_link_libraries(main PRIVATE WebP::webp WebP::webpdemux WebP::libwebpmux WebP::webpdecoder)

这适用于所有首先显示使用信息的包。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-12
    • 1970-01-01
    相关资源
    最近更新 更多