在 VS 2017 中使用Cmake 管理项目, 使用 opencv 库, 在find package的时候出现能找到 OpenCVConfig.cmake的文件,但是设置 OpenCV_Found 为 false。

CMake Warning at E:/dependence/opencv/OpenCVConfig.cmake:156 (message):
  Found OpenCV Windows Pack but it has no binaries compatible with your
  configuration.
  You should manually point CMake variable OpenCV_DIR to your build of OpenCV
  library.
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)
CMake Error at CMakeLists.txt:15 (find_package):
  Found package configuration file:
    E:/dependence/opencv/OpenCVConfig.cmake
  but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
  NOT FOUND.

解决办法

我的 opencv 链接库路径为 E:\dependence\opencv\x64\vc15; 显然这是 x64平台的库,所以生成器也要设置为 Win64平台下。

在 CMakeSettings.json 中;把 "generator":"Visual Studio 15 2017" 改为
"Visual Studio 15 2017 Win64"

Ref:
https://stackoverflow.com/questions/31931397/error-configuring-opencv-project-with-cmake-on-windows

相关文章:

  • 2021-07-14
  • 2021-05-30
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2021-11-05
  • 2022-12-23
  • 2021-11-26
猜你喜欢
  • 2022-12-23
  • 2021-11-26
  • 2021-11-24
  • 2021-04-05
  • 2021-11-14
  • 2022-12-23
  • 2021-07-02
相关资源
相似解决方案