changed CMakeLists.txt

This commit is contained in:
Kayman 2018-03-28 16:16:42 +09:00
parent 22d0b5b59c
commit aec0c193c5
2 changed files with 42 additions and 4 deletions

View File

@ -19,6 +19,23 @@ find_package(catkin REQUIRED COMPONENTS
message_generation
)
## Resolve system dependency on yaml-cpp, which apparently does not
## provide a CMake find_package() module.
find_package(PkgConfig REQUIRED)
pkg_check_modules(YAML_CPP REQUIRED yaml-cpp)
find_path(YAML_CPP_INCLUDE_DIR
NAMES yaml_cpp.h
PATHS ${YAML_CPP_INCLUDE_DIRS}
)
find_library(YAML_CPP_LIBRARY
NAMES YAML_CPP
PATHS ${YAML_CPP_LIBRARY_DIRS}
)
link_directories(${YAML_CPP_LIBRARY_DIRS})
if(NOT ${YAML_CPP_VERSION} VERSION_LESS "0.5")
add_definitions(-DHAVE_NEW_YAMLCPP)
endif(NOT ${YAML_CPP_VERSION} VERSION_LESS "0.5")
################################################################################
# Declare ROS messages, services and actions
################################################################################
@ -59,6 +76,7 @@ catkin_package(
include_directories(
include
${catkin_INCLUDE_DIRS}
${YAML_CPP_INCLUDE_DIRS}
)
add_executable(ball_detector_node
@ -69,7 +87,7 @@ add_dependencies(ball_detector_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin
target_link_libraries(ball_detector_node
${catkin_LIBRARIES}
yaml-cpp
${YAML_CPP_LIBRARIES}
)
################################################################################

View File

@ -19,8 +19,25 @@ find_package(catkin REQUIRED COMPONENTS
robotis_math
)
find_package(Eigen REQUIRED)
find_package(Eigen3 REQUIRED)
## Resolve system dependency on yaml-cpp, which apparently does not
## provide a CMake find_package() module.
find_package(PkgConfig REQUIRED)
pkg_check_modules(YAML_CPP REQUIRED yaml-cpp)
find_path(YAML_CPP_INCLUDE_DIR
NAMES yaml_cpp.h
PATHS ${YAML_CPP_INCLUDE_DIRS}
)
find_library(YAML_CPP_LIBRARY
NAMES YAML_CPP
PATHS ${YAML_CPP_LIBRARY_DIRS}
)
link_directories(${YAML_CPP_LIBRARY_DIRS})
if(NOT ${YAML_CPP_VERSION} VERSION_LESS "0.5")
add_definitions(-DHAVE_NEW_YAMLCPP)
endif(NOT ${YAML_CPP_VERSION} VERSION_LESS "0.5")
################################################################################
# Declare ROS messages, services and actions
@ -36,6 +53,7 @@ find_package(Eigen REQUIRED)
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS roscpp sensor_msgs
DEPENDS EIGEN3
)
################################################################################
@ -44,7 +62,8 @@ catkin_package(
include_directories(
include
${catkin_INCLUDE_DIRS}
${Eigen_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
${YAML_CPP_INCLUDE_DIRS}
)
add_executable(op_demo_node
@ -80,7 +99,8 @@ add_dependencies(self_test_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXP
target_link_libraries(self_test_node
${catkin_LIBRARIES}
yaml-cpp
${Eigen3_LIBRARIES}
${YAML_CPP_LIBRARIES}
)
################################################################################