Hi,
I am following this page from OpenCV Docs to use cmake with OpenCV.
This is my file structure,
- displayopencv\
-- CMakeLists.txt
-- DisplayImage.cpp
CMakeLists.txt contains,
cmake_minimum_required(VERSION 2.8)
set(OpenCV_DIR C:/OpenCV34/opencv/build)
project( DisplayImage )
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )
I run cmake . in this directory inside command prompt and get the following error,
-- Selecting Windows SDK version 10.0.16299.0 to target Windows 10.0.17134.
-- OpenCV ARCH: x86
-- OpenCV RUNTIME: vc14
-- OpenCV STATIC: OFF
CMake Warning at C:/OpenCV34/opencv/build/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:4 (find_package)
CMake Error at CMakeLists.txt:4 (find_package):
  Found package configuration file:
    C:/OpenCV34/opencv/build/OpenCVConfig.cmake
  but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
  NOT FOUND.
-- Configuring incomplete, errors occurred!
See also "E:/Code/cmake/displayopencv/CMakeFiles/CMakeOutput.log".
I cannot figure out what's wrong, it selected the OpenCV arch incorrect too. I have 64-bit OpenCV installed at that location,
C:\OpenCV34\opencv\build>dir
 Volume in drive C has no label.
 Volume Serial Number is E8D4-7C0B
 Directory of C:\OpenCV34\opencv\build
01-09-2018  11:47    <DIR>          .
01-09-2018  11:47    <DIR>          ..
01-09-2018  11:49    <DIR>          bin
01-09-2018  11:47    <DIR>          etc
01-09-2018  11:47    <DIR>          include
01-09-2018  11:47    <DIR>          java
11-04-2018  07:48             2,275 LICENSE
29-08-2018  16:05               433 OpenCVConfig-version.cmake
29-08-2018  16:05             5,728 OpenCVConfig.cmake
01-09-2018  11:47    <DIR>          python
01-09-2018  11:47    <DIR>          x64
               3 File(s)          8,436 bytes
               8 Dir(s)  93,118,218,240 bytes free
C:\OpenCV34\opencv\build>dir x64
 Volume in drive C has no label.
 Volume Serial Number is E8D4-7C0B
 Directory of C:\OpenCV34\opencv\build\x64
01-09-2018  11:47    <DIR>          .
01-09-2018  11:47    <DIR>          ..
01-09-2018  11:47    <DIR>          vc14
01-09-2018  11:47    <DIR>          vc15
               0 File(s)              0 bytes
               4 Dir(s)  93,118,218,240 bytes free
How do I fix this issue and use cmake with OpenCV on Windows 10 computer?
 
  
 