Could not find module FindOpenCV.cmake when compiling

Bug #1289094 reported by aguadopd
This bug report is a duplicate of:  Bug #1167014: MIssing cmake files. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
opencv (Ubuntu)
New
Undecided
Unassigned

Bug Description

Quoted from here: http://stackoverflow.com/questions/8711109/could-not-find-module-findopencv-cmake-error-in-configuration-process/22239942

I had installed opencv from ubuntu 12.10 repository (libopencv-)* and had this problem:

I wrote a CMakeLists.txt for a project in C++ (using ROS), which uses OpenCV libraries. When I try to create the project using cmake, I get the next configuration problem:
"
CMake Error at CMakeLists.txt:15 (find_package):
  Could not find module FindOpenCV.cmake or a configuration file for package
  OpenCV.

  Adjust CMAKE_MODULE_PATH to find FindOpenCV.cmake or set OpenCV_DIR to the
  directory containing a CMake configuration file for OpenCV. The file will
  have one of the following names:

    OpenCVConfig.cmake
    opencv-config.cmake
"

Couldn't solve it with export OpenCV_DIR=/usr/share/OpenCV/ (since my OpenCVConfig.cmake whas there). It was solved when I also changed some lines on the OpenCVConfig.cmake file:

# ======================================================
# Include directories to add to the user project:
# ======================================================

# Provide the include directories to the caller

#SET(OpenCV_INCLUDE_DIRS "${OpenCV_INSTALL_PATH}/include/opencv;${OpenCV_INSTALL_PATH}/include")

SET(OpenCV_INCLUDE_DIRS "/usr/include/opencv;/usr/include/opencv2")
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})

# ======================================================
# Link directories to add to the user project:
# ======================================================

# Provide the libs directory anyway, it may be needed in some cases.

#SET(OpenCV_LIB_DIR "${OpenCV_INSTALL_PATH}/lib")

SET(OpenCV_LIB_DIR "/usr/lib")

LINK_DIRECTORIES(${OpenCV_LIB_DIR})

And that worked on my Ubuntu 12.10. Remember to add the target_link_libraries(yourprojectname ${OpenCV_LIBS}) in your CMakeLists.txt.

Revision history for this message
aguadopd (aguadopd) wrote :
Anushree (anushrivb)
Changed in opencv (Ubuntu):
assignee: nobody → Anushree (anushrivb)
status: New → Confirmed
Anushree (anushrivb)
Changed in opencv (Ubuntu):
assignee: Anushree (anushrivb) → nobody
status: Confirmed → New
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.