Roby
Roby

Reputation: 144

How CMake find a different version lib?

I have installed Opencv 3.2 in system dir (/usr/local)... CMAKE could find opencv3.2 automatically well. But I have to use opencv 2.4 in my project,so I install opencv 2.4 in my ~/otherlibs folder.

Cmakefile:

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "~/otherlibs")
find_package(OpenCV 2.4 REQUIRED)

but CMAKE always have a error like this:

CMake Error at CMakeLists.txt:15(find_package):
    Could not find a configuration file for package "OpenCV" that is compatible
    with requested version "2.4"

    The following configuration files were considered but not accepted:
    /usr/local/share/OpenCV/OpenCVConfig.cmake, verison 3.2.0

it seems cmake always find system dir and after find Opencv.cmake it will stop to find my specified dir ~/otherlibs

Upvotes: 2

Views: 2053

Answers (1)

sansuiso
sansuiso

Reputation: 9379

Did you try to use -DCMAKE_PREFIX_PATH=/home/myaccount/otherlibs? This will change cmake's rules for searching configuration files and may help you here.

Upvotes: 1

Related Questions