Skip to content

Commit 9b2a520

Browse files
committed
tested for system dependencies
1 parent 5aa587d commit 9b2a520

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

robotis_controller/CMakeLists.txt

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,23 @@ find_package(catkin REQUIRED COMPONENTS
2222
cmake_modules
2323
)
2424

25-
find_package(yaml-cpp REQUIRED)
25+
# Resolve system dependency on yaml-cpp, which apparently does not
26+
# provide a CMake find_package() module.
27+
find_package(PkgConfig REQUIRED)
28+
pkg_check_modules(YAML_CPP REQUIRED yaml-cpp)
29+
find_path(YAML_CPP_INCLUDE_DIR
30+
NAMES yaml_cpp.h
31+
PATHS ${YAML_CPP_INCLUDE_DIRS}
32+
)
33+
find_library(YAML_CPP_LIBRARY
34+
NAMES YAML_CPP
35+
PATHS ${YAML_CPP_LIBRARY_DIRS}
36+
)
37+
link_directories(${YAML_CPP_LIBRARY_DIRS})
2638

27-
# find_package(PkgConfig REQUIRED)
28-
# pkg_check_modules(YAML_CPP REQUIRED yaml-cpp)
29-
# pkg_check_modules(yaml_cpp yaml-cpp REQUIRED)
39+
if(NOT ${YAML_CPP_VERSION} VERSION_LESS "0.5")
40+
add_definitions(-DHAVE_NEW_YAMLCPP)
41+
endif(NOT ${YAML_CPP_VERSION} VERSION_LESS "0.5")
3042

3143
################################################################################
3244
# Setup for python modules and scripts
@@ -47,7 +59,6 @@ catkin_package(
4759
INCLUDE_DIRS include
4860
LIBRARIES robotis_controller
4961
CATKIN_DEPENDS roscpp roslib std_msgs sensor_msgs robotis_controller_msgs dynamixel_sdk robotis_device robotis_framework_common cmake_modules
50-
DEPENDS YAML_CPP
5162
)
5263

5364
################################################################################
@@ -56,12 +67,12 @@ catkin_package(
5667
include_directories(
5768
include
5869
${catkin_INCLUDE_DIRS}
59-
${yaml_cpp_INCLUDE_DIRS}
70+
${YAML_CPP_INCLUDE_DIRS}
6071
)
6172

6273
add_library(robotis_controller src/robotis_controller/robotis_controller.cpp)
6374
add_dependencies(robotis_controller ${catkin_EXPORTED_TARGETS})
64-
target_link_libraries(robotis_controller ${yaml_cpp_LIBRARIES} ${catkin_LIBRARIES})
75+
target_link_libraries(robotis_controller ${catkin_LIBRARIES} ${YAML_CPP_LIBRARIES})
6576

6677
################################################################################
6778
# Install

0 commit comments

Comments
 (0)