MIssing cmake files

Bug #1167014 reported by Jacek Nykis
36
This bug affects 6 people
Affects Status Importance Assigned to Milestone
opencv (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

This two files are part of libopencv-core-dev package in 12.04:
/usr/share/OpenCV/OpenCVConfig.cmake
/usr/share/OpenCV/OpenCVConfig-version.cmake

But they disappeared in 12.10 and 13.04.
This is causing problems when compiling projects using cmake and opencv.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in opencv (Ubuntu):
status: New → Confirmed
Revision history for this message
aguadopd (aguadopd) wrote :

 I had installed ***opencv from ubuntu 12.10 repository (libopencv-*)*** and had the same problem. Couldn't solve it with `export OpenCV_DIR=/usr/share/OpenCV/` (since my OpenCVConfig.cmake whas there). It was solved when I 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.

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

no longer affects: opencv
Revision history for this message
linas (linasvepstas) wrote :

Hitting this in xenial, too.

Revision history for this message
linas (linasvepstas) wrote :

It appears that one can be downloaded from here: http://code.opencv.org/attachments/196/FindOpenCV.cmake

Revision history for this message
linas (linasvepstas) wrote :

... except that I am unable to find any version of FindOpenCV.cmake that actually works with the OpenCV that is provided in trusty or xenial (14.04 or 16.04) -- one of many problems is that the way that the opencv version numbers are specified is not compatible with how version numbers used to be specified(!) After fixing this, additional bugs appear.

Revision history for this message
linas (linasvepstas) wrote :

... except that /usr/share/OpenCV/ already contains the required files! So, in principle, find_package(OpenCV REQUIRED) should just plain work. So why doesn't it? ??

Revision history for this message
linas (linasvepstas) wrote :

Recommend closing this bug... Here's why.

TL;DR: libopencv-dev provides /usr/share/OpenCV/OpenCVConfig.cmake etc

I experienced a bizarre bug, though:

On xenial (16.04), having a CMakeLists.txt with a find_package(OpenCV REQUIRED) gave me an error:

CMake Error at CMakeLists.txt:9 (find_package):
  By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "OpenCV", but
  CMake did not find one.

This error leads to a fruitless hunt for FindOpenCV.cmake which leads to this bug report. However, the above error should never have happened, because xenial libopencv-dev does provide the needed files in /usr/share/OpenCV/ The error went away, for me, after running cmake --trace and after that, the error goes away, and becomes unreproducible(!) (despite being highly reproducible for hours...) I'm befuddled. However

TL;DR: libopencv-dev provides /usr/share/OpenCV/OpenCVConfig.cmake etc.

Revision history for this message
Arnaud Jeansen (ajeans) wrote :

I agree this bug should be closed.
I encountered this issue when building https://github.com/andrewssobral/bgslibrary on Xenial

However, this was due to the absence of the devel package (I only had the standard OpenCV package installed).

Installing libopencv-dev fixed this issue as it brings the necessary cmake files, and I could build BGS.
See http://packages.ubuntu.com/xenial/amd64/libopencv-dev/filelist for where they are located.

Changed in opencv (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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