Skip to content

Commit

Permalink
generate pkg config extra files containing variables which list all m…
Browse files Browse the repository at this point in the history
…essage and service files (fix #28)
  • Loading branch information
dirk-thomas committed Jun 13, 2013
1 parent 3b15fef commit bbb04d3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ install(
FILES
cmake/pkg-genmsg.cmake.em
cmake/pkg-genmsg.context.in
cmake/pkg-msg-extras.cmake.in
cmake/pkg-msg-paths.cmake.in
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake)

Expand Down
23 changes: 23 additions & 0 deletions cmake/genmsg-extras.cmake.em
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ macro(add_message_files)
list(APPEND ${PROJECT_NAME}_MSG_INCLUDE_DIRS_INSTALLSPACE ${ARG_DIRECTORY})
install(FILES ${FILES_W_PATH}
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${ARG_DIRECTORY})

_prepend_path("${CMAKE_INSTALL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/${ARG_DIRECTORY}" "${ARG_FILES}" FILES_W_PATH)
list(APPEND ${PROJECT_NAME}_INSTALLED_MESSAGE_FILES ${FILES_W_PATH})
endif()
endmacro()

Expand Down Expand Up @@ -150,6 +153,9 @@ macro(add_service_files)

install(FILES ${FILES_W_PATH}
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${ARG_DIRECTORY})

_prepend_path("${CMAKE_INSTALL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/${ARG_DIRECTORY}" "${ARG_FILES}" FILES_W_PATH)
list(APPEND ${PROJECT_NAME}_INSTALLED_SERVICE_FILES ${FILES_W_PATH})
endif()
endmacro()

Expand Down Expand Up @@ -205,6 +211,23 @@ macro(generate_messages)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}-msg-paths.cmake
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake)

# generate devel space pkg config extra defining variables with all processed message and service files
set(PKG_MSG_FILES "${${PROJECT_NAME}_MESSAGE_FILES}")
set(PKG_SRV_FILES "${${PROJECT_NAME}_SERVICE_FILES}")
configure_file(
${genmsg_CMAKE_DIR}/pkg-msg-extras.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/${PROJECT_NAME}-msg-extras.cmake.develspace.in
@@ONLY)
# generate install space pkg config extra defining variables with all processed and installed message and service files
set(PKG_MSG_FILES "${${PROJECT_NAME}_INSTALLED_MESSAGE_FILES}")
set(PKG_SRV_FILES "${${PROJECT_NAME}_INSTALLED_SERVICE_FILES}")
configure_file(
${genmsg_CMAKE_DIR}/pkg-msg-extras.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/${PROJECT_NAME}-msg-extras.cmake.installspace.in
@@ONLY)
# register pkg config files as cmake extra file for the project
list(APPEND ${PROJECT_NAME}_CFG_EXTRAS ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/${PROJECT_NAME}-msg-extras.cmake)

# find configuration containing include dirs for projects in all devel- and installspaces
set(workspaces ${CATKIN_WORKSPACES})
list(FIND workspaces ${CATKIN_DEVEL_PREFIX} _index)
Expand Down
2 changes: 2 additions & 0 deletions cmake/pkg-msg-extras.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set(@PROJECT_NAME@_MESSAGE_FILES "@PKG_MSG_FILES@")
set(@PROJECT_NAME@_SERVICE_FILES "@PKG_SRV_FILES@")

0 comments on commit bbb04d3

Please sign in to comment.