Have you tried specifying the version?

FIND_PACKAGE(OpenCV 2.2.0 EXACT REQUIRED)

FIND_PACKAGE(OpenCV 2.4.0 EXACT REQUIRED)

Not sure if the FindOpenCV script can handle the version argument.

Andreas

On 14.02.2013 11:42, Bart Vandewoestyne wrote:
Hello list,

To compile and link my code with the OpenCV library, I use

find_package( OpenCV REQUIRED )
...
add_executable(framecountertest framecountertest.cpp)
target_link_libraries(framecountertest ${OpenCV_LIBS})

and this works just fine: the OpenCV library that got installed using my 
package management system
on Ubuntu 12.10 is being used.

However, under the directory /tmp/opencv_install I have another manual 
installation of a more recent
OpenCV library, and I would like to use that one instead of the default on my 
system, or easily
switch between the two versions.  How should I specify that in my 
CMakeLists.txt file?  I have tried

set(OpenCV_FOUND "1")
set(OpenCV_INCLUDE_DIR "/home/bart/Git/Research/fat/inc/TraficonOpenCv/opencv")
set(OpenCV_LIBS
"opencv_gpu;opencv_contrib;opencv_legacy;opencv_objdetect;opencv_calib3d;opencv_features2d;opencv_video;opencv_highgui;opencv_ml;opencv_imgproc;opencv_flann;opencv_core")

include_directories(${OpenCV_INCLUDE_DIR})
...
add_executable(framecountertest framecountertest.cpp)
target_link_libraries(framecountertest ${OpenCV_LIBS})

but even with these commands, still the default libs on my system are being 
used...

What is the correct way to specify that I want to build with the install under 
/tmp/opencv_install
?  And how can I easily switch between versions without needing to remove one 
or the other version?

Thanks!
Bart
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to