Ask Your Question
0

cmake windows openCV found but ... no compatible

asked 2017-10-24 13:35:41 -0600

carton99 gravatar image

Hi, ok here my configuration/installation:

  • I am on windows 7

  • Visual studio 2015 vc14 + command line tool c++ vc14

  • cmake windows

  • Last build for windows 3.3.1

Here my cmake:

cmake_minimum_required(VERSION 3.2)
project( projet)
find_package( OpenCV REQUIRED )
add_executable( 
    projetC
    Main.cpp
 )
target_link_libraries( projetC ${OpenCV_LIBS} )

Here my path to openCV_dir

echo %OPENCV_DIR%
C:\OpenCV\build\x64\vc14

When I do cmake . I have this error 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:10 (find_package)


CMake Error at CMakeLists.txt:10 (find_package):
  Found package configuration file:

  C:/Users/qqch/Desktop/opencv/build/openCVConfig.cmake !!!!!!!!!! WTF is not the good path

  but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
  NOT FOUND.

Obviously I tested Billion of others methods

edit retag flag offensive close merge delete

Comments

i vaguely remember something like:

SET(OpenCV_DIR, "path/to/your/opencv/install/folder")

((which (on win) is: opencv/build, for the prebuild libs, but opencv/build/install for self-build))

(put that on line 2)

berak gravatar imageberak ( 2017-10-24 13:43:11 -0600 )edit

also, be consistent with the project name !

it must be:

project( projetC )

in your case. (since the other 2 occurrences are like that)

berak gravatar imageberak ( 2017-10-24 13:56:43 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2017-10-25 00:49:06 -0600

carton99 gravatar image

updated 2017-10-25 00:52:30 -0600

Ok finaly it's work.

  • FIRT - Use classic command line and not vc14_cmd line (Else path setx don't work)
  • SECOND - Use GUI cmake and not cmd cmake and force the vc14x64 with the gui
  • THIRD - Update PATH to opencv.../bin as cmake said in warning message

Finally launch your program with your currently cmd line with the update of path else it doesn't work and you have openCVxxx.ddll missing

edit flag offensive delete link more

Comments

maybe you could also add your final cmakelists.txt ?

berak gravatar imageberak ( 2017-10-25 00:54:00 -0600 )edit
1

I just add update with the small error in the name of project:

cmake_minimum_required(VERSION 3.2)
project( projetC)
find_package( OpenCV REQUIRED )
add_executable( 
    projetC
    Main.cpp
 )
target_link_libraries( projetC ${OpenCV_LIBS} )
carton99 gravatar imagecarton99 ( 2017-10-25 00:57:44 -0600 )edit

"SECOND - Use GUI cmake and not cmd cmake and force the vc14x64 with the gui" Thta's not true you can cmake gui or cmd. I haven't try with powershell

LBerger gravatar imageLBerger ( 2017-10-25 06:37:47 -0600 )edit

Yes I agree with you, I think you may force cmake cmd line with vc14x64 but I don't tested. I my case, the problem is with cmd line cmake print error message "don't find compatible openCV", but it don't print that the problem can be solve with a x64 option.

That's why I propose a easy method based on cmake gui.

carton99 gravatar imagecarton99 ( 2017-10-25 06:54:56 -0600 )edit
1

cmake -G"Visual Studio 14 2015 Win64" ....... All generators available are listed with cmake -G

LBerger gravatar imageLBerger ( 2017-10-25 07:17:26 -0600 )edit

oki here my full cmd line compilation method. (you must update PATH and OpenCV_DIR before)

mkdir build
cd build
cmake -G "Visual Studio 14 2015 Win64" ..
cmake --build .
.\debug\projetC.exe
carton99 gravatar imagecarton99 ( 2017-10-25 07:42:34 -0600 )edit
0

answered 2020-07-02 06:06:23 -0600

If you compiled OpenCV as a static library, before find_package( OpenCV REQUIRED ) add set(OpenCV_STATIC ON):

set(OpenCV_STATIC ON)
find_package( OpenCV REQUIRED )
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-10-24 13:35:41 -0600

Seen: 10,562 times

Last updated: Oct 25 '17