Hello Bart,

have you tried setting OpenCV_DIR before calling find_package()? I'm basing this on http://opencv.willowgarage.com/wiki/FindOpenCV.cmake Most package <PKG>Find.cmake scripts look if <PKG>_DIR is set to a valid directory and look there first for all the libraries before checking default install paths. You would use it like this:

if(USE_TMP_OPENCV)
set(OpenCV_DIR /tmp/opencv_install)
elseif(USE_FAT_OPENCV)
set(OpenCV_DIR "/bla/bla/bla/opencv")
endif()

find_package(OpenCV REQUIRED)

Cheers,
Andreas S.

Am 14.02.2013 11:42, schrieb Bart Vandewoestyne:
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


--
Andreas Stahl, Dipl. Medien-Inf.

Technische Universität Dresden
Fakultät Informatik
Institut für Software- und Multimediatechnik
Professur Mediengestaltung
01062 Dresden
Tel.: +49 (351) 463-37928
Fax:  +49 (351) 463-39261
E-Mail: andreas.st...@tu-dresden.de



Attachment: smime.p7s
Description: S/MIME Kryptografische Unterschrift

--

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