Maintaining backwards compatibility (opencv2 problem)
Hi.
I have a bunch of packages that were developed on ROS CTurtle but now I'm trying to upgrade them to compile on Fuerte.
Most of it just works, but I am having problems with one of my packages that link against OpenCV.
Very briefly, I found out that in Fuerte I need to put the following in my CMakeLists.txt:
find_package(OpenCV REQUIRED)
rosbuild_add_executable(foo src/foo.cpp)
target_link_libraries(foo ${OpenCV_LIBRARIES})
This works fine for Fuerte, but unfortunately, when I try to build now on CTurtle I get an error stating that the FindOpenCV.cmake file could not be found.
To fix that, I added the following above the find_package line:
set(OpenCV_DIR /opt/ros/cturtle/stacks/vision_opencv/opencv2/opencv/share/opencv/)
Now, my stuff compiles on CTurtle, but since the cturtle path is now hard-coded into the CMakeLists.txt file, it fails on Fuerte!
So my question (finally) is, is there a way to maintain "backwards compatibility" so I can build my packages on top of both CTurtle and Fuerte? Am I maybe doing something wrong (having to specify the OpenCV_DIR variable doesn't look like it should have to be done)? Is there a way to selectively define the variable only if I'm doing it on CTurtle?
Kind regards, Stefan Freyr
One would think that this should be something that is documented somewhere... It might very well be that backwards compatibility between certain versions is not possible at all, and CTurtle and Fuerte are quite different, but backwards incompatible changes should be documented right?