Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

opencv - CMake Error at CMakeLists.txt CMAKE_PREFIX_PATH

I have downloaded the source code of the face-analysis SDK from http://face.ci2cv.net/. Now I am trying to get it running. I downloaded all the necessary software and followed the installation instructions. When I try to execute cmake [options] .. I get an error.

CMake Error at CMakeLists.txt:21(find_package):
Could not find a package configuration file provided by "OpenCV" with any of the following names:
OpenCVConfig.cmake
opencv-comfig.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set "OpenCV_DIR" to a directory 
containing one of the above files. If OpenCV provides a separate development package or SDK, 
be sure it has been installed. 

The CMakeLists.txt looks like this

# -*-cmake-*-
PROJECT(CSIRO-FaceAnalysis-SDK)

cmake_minimum_required(VERSION 2.8)

#set(CMAKE_VERBOSE_MAKEFILE true)

# Default values for options
if(NOT DEFINED OpenCV_PREFIX)
  set(OpenCV_PREFIX ${CMAKE_INSTALL_PREFIX})
endif()


  set(OpenCV_PREFIX C:/Program Files/Development/opencv/build)
endif(
# Configurable options
OPTION(WITH_GUI "Build the GUI" OFF)

# Third party libraries
find_package(OpenCV REQUIRED core highgui imgproc objdetect
  PATHS ${OpenCV_PREFIX}/lib/cmake/
        ${OpenCV_PREFIX}/share/OpenCV/
  NO_DEFAULT_PATH) # For some reason CMake uses its defaults before the above paths.

Please help me, I have no idea what to do.

Thanks, B

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  1. Check that OpenCV is installed on your system. Note the folder where it is installed. For example: C:OpenCV
  2. Execute CMake with a command line similar to

cmake -DCMAKE_PREFIX_PATH="C:OpenCV" ..

OR

find the folder containing OpenCVConfig.cmake (for example C:OpenCVuildx86vc10lib) and pass it to CMake via the variable OpenCV_DIR

cmake -DOpenCV_DIR="C:OpenCVuildx86vc10lib" ..

In both cases, I think the provider of the code you try to compile commited an error by putting NO_DEFAULT_PATH in the find_package(OpenCV ...). If nothing work, re-try after removing this flag.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...