Catkin_make doesn't recognize $(OpenCV_LIBRARIES)
In my catkin workspace and in my catkin package I have CMakeLists.txt
:
cmake_minimum_required(VERSION 2.8.3)
project(vp)
find_package(catkin REQUIRED)
find_package(OpenCV REQUIRED)
catkin_package()
include_directories(include
$(catkin_INCLUDE_DIRS)
)
add_executable(vp_node src/vp_node.cpp)
target_link_libraries(vp_node
${catkin_LIBRARIES}
${OpenCV_LIBRARIES}
)
On catkin_make
, the output is:
####
#### Running command: "make cmake_check_build_system" in "/home/andrija/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/andrija/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/andrija/catkin_ws/devel;/opt/ros/jade
-- This workspace overlays: /home/andrija/catkin_ws/devel;/opt/ros/jade
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/andrija/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.6.16
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 1 packages in topological order:
-- ~~ - vp
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'vp'
-- ==> add_subdirectory(vp)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/andrija/catkin_ws/build
####
#### Running command: "make -j2 -l2" in "/home/andrija/catkin_ws/build"
####
Scanning dependencies of target vp_node
[100%] Building CXX object vp/CMakeFiles/vp_node.dir/src/vp_node.cpp.o
Linking CXX executable /home/andrija/catkin_ws/devel/lib/vp/vp_node
c++: error: $(OpenCV_LIBRARIES): No such file or directory
make[2]: *** [/home/andrija/catkin_ws/devel/lib/vp/vp_node] Error 1
make[1]: *** [vp/CMakeFiles/vp_node.dir/all] Error 2
make: *** [all] Error 2
Invoking "make -j2 -l2" failed
If, however, I choose not to use variable OpenCV_LIBRARIES
, but instead just use the specific libraries I need for my code, like this:
target_link_libraries(vp_node
${catkin_LIBRARIES}
opencv_core opencv_highgui opencv_videoio opencv_imgcodecs
)
Then code builds and runs successfully. Where and when is this variable OpenCV_LIBRARIES being set?
I have built OpenCV from source and installed ros using apt-get.
EDIT #1
If I change my CMakeLists.txt
and transform the line:
find_package(catkin REQUIRED)
into
find_package(catkin REQUIRED cv_bridge)
then I can freely use $(OpenCV_LIBRARIES) wihtin that CMakeLists.txt
. Same thing if I use image_transport
instead of cv_bridge
.
This still doesn't fully answer my question. Where are these variables defined?