Include Files, Devel vs. Install Space

asked 2020-04-28 06:48:17 -0500

FreitagS gravatar image

I am wondering, why my public headers (required by other packages that want to use my small library) are copied to the Install space when building with catkin config --install but not to the Devel space. Are the two spaces not supposed to be similar or even identical? For me it doesn't matter much now, but what would someone have to do, to get his headers copied (or symlinked or whatever) to devel in a ROS-best-practice-compliant way?

Details follow.

My package abc_lib_api has a public header. The folder structure follows recommendations:

.
├── CMakeLists.txt
├── include
│   └── abc_lib_api
│       │   └── Api.h
├── package.xml
├── README.md
└── src
    ├── api
    │   └── Api.cpp
    ├── Client.cpp
    ├── Client.h
    ├── Configuration.cpp
    ├── Configuration.h
    ├── Exception.cpp
    ├── Exception.h
    └── Object.cpp

My CMakeLists.txt looks like this:

cmake_minimum_required(VERSION 2.8.3)
project(abc_lib_api)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++14")

if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Debug)
endif()


find_package(catkin REQUIRED COMPONENTS roscpp)

catkin_package(INCLUDE_DIRS include
               LIBRARIES ${PROJECT_NAME})


include_directories(
  src
  include
)

add_library(
  ${PROJECT_NAME}
  src/api/Api.cpp
  src/Client.cpp
)

install(TARGETS ${PROJECT_NAME}
  ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
)

install(DIRECTORY include/${PROJECT_NAME}/
  DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
  FILES_MATCHING PATTERN "*.h"
  PATTERN ".svn" EXCLUDE
)

After doing catkin build, I find ./install/include/abc_lib_api/Api.h, but I do not find ./devel/include/abc_lib_api/Api.h or ./devel/lib/abc_lib_api/include/abc_lib_api/Api.h or Api.h anywhere else inside ./devel (the libabc_lib_api.so can be found in ./devel/lib/ ).

edit retag flag offensive close merge delete

Comments

The ROS-best-practices is to use the install space, so my recommendation would be to not use the devel space & make the question moot of copying headers over. They are not identical.

stevemacenski gravatar image stevemacenski  ( 2020-04-28 10:50:21 -0500 )edit