Skip to content

Commit

Permalink
actionlib_msgs: add_action_files takes absolute paths for DIRECTORY a…
Browse files Browse the repository at this point in the history
…rgument
  • Loading branch information
mrjogo committed Nov 3, 2016
1 parent d182173 commit 5276dce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
17 changes: 11 additions & 6 deletions actionlib_msgs/cmake/actionlib_msgs-extras.cmake.em
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,32 @@ macro(add_action_files)
set(ARG_DIRECTORY "action")
endif()

if(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARG_DIRECTORY})
message(FATAL_ERROR "add_action_files() directory not found: ${CMAKE_CURRENT_SOURCE_DIR}/${ARG_DIRECTORY}")
set(ACTION_DIR "${ARG_DIRECTORY}")
if(NOT IS_ABSOLUTE "${ACTION_DIR}")
set(ACTION_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${ACTION_DIR}")
endif()

# if FILES are not passed search action files in the given directory
# note: ARGV is not variable, so it can not be passed to list(FIND) directly
set(_argv ${ARGV})
list(FIND _argv "FILES" _index)
if(_index EQUAL -1)
file(GLOB ARG_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/${ARG_DIRECTORY}" "${CMAKE_CURRENT_SOURCE_DIR}/${ARG_DIRECTORY}/*.action")
file(GLOB ARG_FILES RELATIVE "${ACTION_DIR}" "${ACTION_DIR}/*.action")
list(SORT ARG_FILES)
endif()
_prepend_path(${CMAKE_CURRENT_SOURCE_DIR}/${ARG_DIRECTORY} "${ARG_FILES}" FILES_W_PATH)
_prepend_path(${ACTION_DIR} "${ARG_FILES}" FILES_W_PATH)

list(APPEND ${PROJECT_NAME}_ACTION_FILES ${FILES_W_PATH})
foreach(file ${FILES_W_PATH})
assert_file_exists(${file} "action file not found")
endforeach()

if(NOT ARG_NOINSTALL)
install(FILES ${FILES_W_PATH} DESTINATION share/${PROJECT_NAME}/${ARG_DIRECTORY})
# ensure that destination variables are initialized
catkin_destinations()

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

foreach(actionfile ${FILES_W_PATH})
Expand Down Expand Up @@ -73,7 +78,7 @@ macro(add_action_files)
endif()

add_message_files(
BASE_DIR ${MESSAGE_DIR}
DIRECTORY ${MESSAGE_DIR}
FILES ${OUTPUT_FILES})
endforeach()
endmacro()
1 change: 1 addition & 0 deletions actionlib_msgs/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

<buildtool_depend version_gte="0.5.78">catkin</buildtool_depend>

<build_depend version_gte="0.5.4">genmsg</build_depend>
<build_depend>message_generation</build_depend>
<build_depend>std_msgs</build_depend>

Expand Down

0 comments on commit 5276dce

Please sign in to comment.