如何知道使用VCPKG安装的库的名称?

发布于 2025-01-19 06:15:09 字数 2469 浏览 1 评论 0原文

在我使用 cmake 构建的简单应用程序中,我使用 opencv,它是随 vcpkg 安装的。

CMakeLists.txt 上,我必须 find_package(OpenCV REQUIRED),用 opencv 替换 OpenCV 将使构建失败。

vcpkg list 我看到 opencv 已安装。

那么我应该从哪里获得正确的拼写OpenCV

再次执行安装包的命令对 opencv 没有帮助

./vcpkg install opencv        
Computing installation plan...
The following packages are already installed:
    opencv[core,default-features]:x64-osx -> 4.5.5
Package opencv:x64-osx is already installed
Restored 0 packages from /Users/user/.cache/vcpkg/archives in 2.309 us. Use --debug to see more details.

Total elapsed time: 4.752 ms

user@users-MacBook-Pro vcpkg % ./vcpkg install opencv --debug
[DEBUG] Feature flag 'binarycaching' unset
[DEBUG] Feature flag 'manifests' unset
[DEBUG] Feature flag 'compilertracking' unset
[DEBUG] Feature flag 'registries' unset
[DEBUG] Feature flag 'versions' unset
[DEBUG] Failed to open: /Users/user/vcpkg/vcpkg-bundle.json
[DEBUG] Bundle config: readonly=0, usegitregistry=0, embeddedsha=nullopt
[DEBUG] Using builtin-ports: /Users/user/vcpkg/ports
[DEBUG] Using installed-root: /Users/user/vcpkg/installed
[DEBUG] Using buildtrees-root: /Users/user/vcpkg/buildtrees
[DEBUG] Using packages-root: /Users/user/vcpkg/packages
[DEBUG] Using scripts-root: /Users/user/vcpkg/scripts
[DEBUG] Using vcpkg-root: /Users/user/vcpkg
[DEBUG] Using scripts-root: /Users/user/vcpkg/scripts
[DEBUG] Using builtin-registry: /Users/user/vcpkg/versions
[DEBUG] Using downloads-root: /Users/user/vcpkg/downloads
[DEBUG] Default binary cache path is: /Users/user/.cache/vcpkg/archives
Computing installation plan...
The following packages are already installed:
    opencv[core,default-features]:x64-osx -> 4.5.5
Package opencv:x64-osx is already installed
Restored 0 packages from /Users/user/.cache/vcpkg/archives in 2.227 us. Use --debug to see more details.

Total elapsed time: 5.909 ms

[DEBUG] /Users/runner/work/1/s/src/vcpkg/install.cpp(1229): 
[DEBUG] Time in subprocesses: 3284 us
[DEBUG] Time in parsing JSON: 1094 us
[DEBUG] Time in JSON reader: 577 us
[DEBUG] Time in filesystem: 903 us
[DEBUG] Time in loading ports: 2630 us
[DEBUG] Exiting after 9.574 ms (5984 us)

它只是每次都提到opencv,而不是OpenCV

In my simple app which I build with cmake I use opencv, which is installed with vcpkg.

On CMakeLists.txt I have to find_package(OpenCV REQUIRED), replacing OpenCV by opencv will fail the build.

From vcpkg list I see opencv is installed.

So from where should I get the correct spelling, OpenCV?

Executing the command to install the package again does not help for opencv.

./vcpkg install opencv        
Computing installation plan...
The following packages are already installed:
    opencv[core,default-features]:x64-osx -> 4.5.5
Package opencv:x64-osx is already installed
Restored 0 packages from /Users/user/.cache/vcpkg/archives in 2.309 us. Use --debug to see more details.

Total elapsed time: 4.752 ms

user@users-MacBook-Pro vcpkg % ./vcpkg install opencv --debug
[DEBUG] Feature flag 'binarycaching' unset
[DEBUG] Feature flag 'manifests' unset
[DEBUG] Feature flag 'compilertracking' unset
[DEBUG] Feature flag 'registries' unset
[DEBUG] Feature flag 'versions' unset
[DEBUG] Failed to open: /Users/user/vcpkg/vcpkg-bundle.json
[DEBUG] Bundle config: readonly=0, usegitregistry=0, embeddedsha=nullopt
[DEBUG] Using builtin-ports: /Users/user/vcpkg/ports
[DEBUG] Using installed-root: /Users/user/vcpkg/installed
[DEBUG] Using buildtrees-root: /Users/user/vcpkg/buildtrees
[DEBUG] Using packages-root: /Users/user/vcpkg/packages
[DEBUG] Using scripts-root: /Users/user/vcpkg/scripts
[DEBUG] Using vcpkg-root: /Users/user/vcpkg
[DEBUG] Using scripts-root: /Users/user/vcpkg/scripts
[DEBUG] Using builtin-registry: /Users/user/vcpkg/versions
[DEBUG] Using downloads-root: /Users/user/vcpkg/downloads
[DEBUG] Default binary cache path is: /Users/user/.cache/vcpkg/archives
Computing installation plan...
The following packages are already installed:
    opencv[core,default-features]:x64-osx -> 4.5.5
Package opencv:x64-osx is already installed
Restored 0 packages from /Users/user/.cache/vcpkg/archives in 2.227 us. Use --debug to see more details.

Total elapsed time: 5.909 ms

[DEBUG] /Users/runner/work/1/s/src/vcpkg/install.cpp(1229): 
[DEBUG] Time in subprocesses: 3284 us
[DEBUG] Time in parsing JSON: 1094 us
[DEBUG] Time in JSON reader: 577 us
[DEBUG] Time in filesystem: 903 us
[DEBUG] Time in loading ports: 2630 us
[DEBUG] Exiting after 9.574 ms (5984 us)

It just mentions opencv every time, not OpenCV.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱&纷飞 2025-01-26 06:15:09
  1. CMAKE模块/配置名称不等于VCPKG端口名称
  2. 启动。
  3. VCPKG可能会打印用法消息(如果您的VCPKG已经足够新并且启发式 文档如何工作方式:

在此模式下,cmake搜索一个称为< lowerCasepackageName> -config.cmake< packagename> config.cmake

- >因此,我推断出OPENCV安装一个名为OpenCvConfig.cmake.cmake的配置文件,该文件由VCPKG文件列表备份:

opencv4:x64-windows:/share/opencv/OpenCVConfig-version.cmake
opencv4:x64-windows:/share/opencv/OpenCVConfig.cmake
  1. CMake module/config name is not equivalent to the vcpkg port name
  2. vcpkg might print a usage message (if your vcpkg is new enough and the heuristics kick in.)
  3. find_package is not always case insensitive as stated in the docs how the CONFIG lookup works:

In this mode, CMake searches for a file called <lowercasePackageName>-config.cmake or <PackageName>Config.cmake.

-> As such I deduce that OpenCV installs a config file which is named OpenCVConfig.cmake which is backed up by the vcpkg file list:

opencv4:x64-windows:/share/opencv/OpenCVConfig-version.cmake
opencv4:x64-windows:/share/opencv/OpenCVConfig.cmake
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文