[CMake] Using different installs/versions of the OpenCV library
Bart Vandewoestyne
Bart.Vandewoestyne at telenet.be
Thu Feb 14 05:42:07 EST 2013
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
More information about the CMake
mailing list