From 92941b603650e1ce95fc671cfedbde1a1507f3f6 Mon Sep 17 00:00:00 2001
From: Anthony Mallet <anthony.mallet@laas.fr>
Date: Tue, 9 Oct 2012 18:55:21 +0200
Subject: [PATCH] [wip/ros-genmsg] Add a small patch needed for actionlib
 generated .msg

actionlib generated messages are in "build" directory. Without the patch, the
cmake rules for message generation would install those generated .msg under a
wrong path.

Simply add an optional parameter to add_message_file() and add_service_file()
that allows to specify both the source and destination dir of input files,
instead of considering they are the same. This is only used by actionlib and
has no side effect on other packages.
---
 ros-genmsg/distinfo         |  1 +
 ros-genmsg/patches/patch-aa | 58 +++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 ros-genmsg/patches/patch-aa

diff --git a/ros-genmsg/distinfo b/ros-genmsg/distinfo
index 93c20747..ff1d568c 100644
--- a/ros-genmsg/distinfo
+++ b/ros-genmsg/distinfo
@@ -1,3 +1,4 @@
 SHA1 (ros-fuerte-genmsg_0.3.10.orig.tar.gz) = 5a94a60e2aebc16bc938d0ec7792fb25e0ce2568
 RMD160 (ros-fuerte-genmsg_0.3.10.orig.tar.gz) = 63d7f7eebfb92498dc1ee84f1acca0d610ae2f17
 Size (ros-fuerte-genmsg_0.3.10.orig.tar.gz) = 55400 bytes
+SHA1 (patch-aa) = dd193db60273203221cec84a8d87b14126e39d59
diff --git a/ros-genmsg/patches/patch-aa b/ros-genmsg/patches/patch-aa
new file mode 100644
index 00000000..f3af442e
--- /dev/null
+++ b/ros-genmsg/patches/patch-aa
@@ -0,0 +1,58 @@
+Add an extrac DST argument to add_{message,service}_files, for actionlib
+generated messages, otherwise actionlib message are installed with the full
+source path of the build directory under CMAKE_INSTALL_PREFIX.
+
+--- cmake/genmsg-extras.cmake.in~	2012-06-04 23:47:14.000000000 +0200
++++ cmake/genmsg-extras.cmake.in	2012-10-09 18:17:22.081648856 +0200
+@@ -26,13 +26,17 @@
+ endmacro()
+ 
+ macro(add_message_files)
+-  parse_arguments(ARG "PACKAGE;FILES;DIRECTORY" "NOINSTALL;PRIVATE" ${ARGN})
++  parse_arguments(ARG "PACKAGE;FILES;DIRECTORY;DST" "NOINSTALL;PRIVATE" ${ARGN})
+   check_unused_arguments("add_message_files" "${ARG_DEFAULT_ARGS}")
+ 
+   if(NOT ARG_PACKAGE)
+     set(ARG_PACKAGE ${PROJECT_NAME})
+   endif()
+ 
++  if(NOT ARG_DST)
++    set(ARG_DST ${ARG_DIRECTORY})
++  endif()
++
+   string(REGEX MATCH "^/.*" IS_FULL_PATH ${ARG_DIRECTORY})
+ 
+   if(IS_FULL_PATH)
+@@ -52,18 +56,21 @@
+   list(APPEND ${PROJECT_NAME}_MESSAGE_FILES_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/${ARG_DIRECTORY})
+ 
+   if(NOT ARG_NOINSTALL)
+-    install(FILES ${FILES_W_PATH} DESTINATION share/${PROJECT_NAME}/${ARG_DIRECTORY})
++    install(FILES ${FILES_W_PATH} DESTINATION share/${PROJECT_NAME}/${ARG_DST})
+   endif()
+ endmacro()
+ 
+ macro(add_service_files)
+-  parse_arguments(ARG "PACKAGE;FILES;DIRECTORY" "NOINSTALL" ${ARGN})
++  parse_arguments(ARG "PACKAGE;FILES;DIRECTORY;DST" "NOINSTALL" ${ARGN})
+   check_unused_arguments("add_service_files" "${ARG_DEFAULT_ARGS}")
+ 
+   if(NOT ARG_PACKAGE)
+     set(ARG_PACKAGE ${PROJECT_NAME})
+   endif()
+ 
++  if(NOT ARG_DST)
++    set(ARG_DST ${ARG_DIRECTORY})
++  endif()
+ 
+   string(REGEX MATCH "^/.*" IS_FULL_PATH ${ARG_DIRECTORY})
+ 
+@@ -78,7 +85,7 @@
+   list(APPEND ${PROJECT_NAME}_SERVICE_FILES ${FILES_W_PATH})
+ 
+   if(NOT ARG_NOINSTALL)
+-    install(FILES ${FILES_W_PATH} DESTINATION share/${PROJECT_NAME}/${ARG_DIRECTORY})
++    install(FILES ${FILES_W_PATH} DESTINATION share/${PROJECT_NAME}/${ARG_DST})
+   endif()
+ endmacro()
+ 
-- 
GitLab