ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
catkin_package(DEPENDS foo)
only works if foo
follows the recommendation to name its variables foo_INCLUDE_DIRS
, foo_LIBRARIES
etc.
OpenCV
does not follow that recommendation. While the variable for include directories exists the variable containing the libraries is named OpenCV_LIBS
.
You must therefore pass all individual variable manually since catkin can not infer them:
catkin_package(
INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS}
LIBRARIES ${OpenCV_LIBS}
)
2 | No.2 Revision |
catkin_package(DEPENDS foo)
only works if foo
follows the recommendation to name its variables foo_INCLUDE_DIRS
, foo_LIBRARIES
etc.
OpenCV
does not follow that recommendation. While the variable for include directories exists the variable containing the libraries is named OpenCV_LIBS
.
You must therefore pass all individual variable manually since catkin can not infer them:
catkin_package(
INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS}
LIBRARIES ${OpenCV_LIBS}
)
Update:
You should not use OpenCV_INSTALL_PATH
to prefix your libraries but OpenCV_LIB_DIR
since the former one is not available on Windows (please read the OpenCV-config.cmake for reference).
Furthermore if you only need a specific subset of OpenCV components you should only find them (rather than implicitly all). That is also one reason why creating a ROS package to only wrap the third-party dependency which already has a decent CMake config file might not make sense...
Anyway you should also avoid listing all libraries explicitly.
Instead you can loop over all found libraries in OpenCV_LIBS
and use find_library
with the hint to search in OpenCV_LIB_DIR
to actually resolve the exact library file.