Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yaml-cpp includes / libraries #24

Closed
peter-lehner opened this issue Sep 8, 2014 · 2 comments
Closed

yaml-cpp includes / libraries #24

peter-lehner opened this issue Sep 8, 2014 · 2 comments

Comments

@peter-lehner
Copy link

I would like to know how cmake is expected to find the yaml-cpp headers and library for the camera_calibration_parsers package. On my system the compilation of the camera_calibration_parsers package fails due to missing yaml-cpp include files.
In https://github.com/ros-perception/image_common/blob/hydro-devel/camera_calibration_parsers/CMakeLists.txt#L14-L18 the cmake script is querying for the yaml-cpp library but only to receive version information. Usually I would expect for an CMake script to use the following statements after finding a requested package with pkgconfig:
include_directories(${YAML_CPP_INCLUDE_DIRS})
link_directories(${YAML_CPP_LIBRARY_DIRS})
target_link_libraries(... ${YAML_CPP_LIBRARIES})
Additionally does any of the information need to be passed to the CATKIN_PKG macro?

@vrabaud
Copy link
Contributor

vrabaud commented Sep 8, 2014

you're right.
In the condition block you mention, can you please try:

include_directories(${NEW_YAMLCPP_INCLUDE_DIRS})

Does that fix it for you ?

@peter-lehner
Copy link
Author

This resolves the include issue, nevertheless then its missing the library during linking. I got it to work by changing the code to:

find_package(PkgConfig)
pkg_check_modules(YAML_CPP yaml-cpp)
if(${YAML_CPP_VERSION} VERSION_GREATER 0.5)
  add_definitions(-DHAVE_NEW_YAMLCPP)
endif()
include_directories(${YAML_CPP_INCLUDE_DIRS})
link_directories(${YAML_CPP_LIBRARY_DIRS})

# define the library
add_library(${PROJECT_NAME}
  src/parse.cpp
  src/parse_ini.cpp
  src/parse_yml.cpp
)
target_link_libraries(${PROJECT_NAME} ${YAML_CPP_LIBRARIES} ${catkin_LIBRARIES})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants