From 797ee08c5b8f9ad9e48cdffcc1b0a99ed7708e0e Mon Sep 17 00:00:00 2001 From: Damon Kohler Date: Fri, 18 Nov 2016 09:33:52 +0100 Subject: [PATCH] Fixes Catkin CMake for building libraries. (#177) --- cartographer_ros/CMakeLists.txt | 31 ++++++++++++++++++++++++------- cartographer_rviz/CMakeLists.txt | 2 +- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/cartographer_ros/CMakeLists.txt b/cartographer_ros/CMakeLists.txt index 39e4fc6..f56b1cc 100644 --- a/cartographer_ros/CMakeLists.txt +++ b/cartographer_ros/CMakeLists.txt @@ -43,13 +43,6 @@ find_package(catkin REQUIRED COMPONENTS ${PACKAGE_DEPENDENCIES}) include(FindPkgConfig) PKG_SEARCH_MODULE(YAMLCPP REQUIRED yaml-cpp>=0.5.1) -catkin_package( - CATKIN_DEPENDS - message_runtime - ${PACKAGE_DEPENDENCIES} - INCLUDE_DIRS ${PROJECT_NAME} -) - find_package(PCL REQUIRED COMPONENTS common io) find_package(Eigen3 REQUIRED) find_package(Boost REQUIRED COMPONENTS system iostreams) @@ -61,8 +54,26 @@ if(DEFINED urdfdom_headers_VERSION) endif() endif() +catkin_package( + CATKIN_DEPENDS + message_runtime + ${PACKAGE_DEPENDENCIES} + DEPENDS + PCL + Eigen3 + Boost + INCLUDE_DIRS "." + LIBRARIES ${PROJECT_NAME} +) + +SET(ALL_LIBRARIES "" CACHE INTERNAL "ALL_LIBRARIES") + add_subdirectory("cartographer_ros") +google_combined_library(${PROJECT_NAME} + SRCS "${ALL_LIBRARIES}" +) + install(DIRECTORY launch urdf configuration_files DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} ) @@ -70,3 +81,9 @@ install(DIRECTORY launch urdf configuration_files install(PROGRAMS scripts/tf_remove_frames.py DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} ) + +install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} +) diff --git a/cartographer_rviz/CMakeLists.txt b/cartographer_rviz/CMakeLists.txt index 4e8f530..060550e 100644 --- a/cartographer_rviz/CMakeLists.txt +++ b/cartographer_rviz/CMakeLists.txt @@ -34,7 +34,7 @@ catkin_package( CATKIN_DEPENDS message_runtime ${PACKAGE_DEPENDENCIES} - INCLUDE_DIRS ${PROJECT_NAME} + INCLUDE_DIRS "." ) set(CMAKE_AUTOMOC ON)