From e230277bcb7a35991885a11cee2c930a59d4daf3 Mon Sep 17 00:00:00 2001
From: Lukas Bulwahn <lukas.bulwahn@oss.bmw-carit.de>
Date: Wed, 24 Jul 2013 06:54:58 +0200
Subject: [PATCH] roscpp: removing roscpp's own routine to find pthread
 (resolves #125)

When updating from 1.9.41 to 1.9.47, the commit
https://github.com/ros/ros_comm/commit/c5dfa6305e883f76dc2aa52d27d2977e3d66ea2e
adds a routine in the CMakeLists.txt to find the pthread library.
This routine is not suitable for the use with our tool chain, i.e.,
it reports an error (cf. #125) when using roscpp-native.

This commit adds a patch that reverts that change in roscpp's
CMakeLists.txt.
---
 ...t-try-to-find-pthread-by-own-methods.patch | 42 +++++++++++++++++++
 recipes-ros/ros-comm/roscpp_1.9.47.bb         |  2 +
 2 files changed, 44 insertions(+)
 create mode 100644 recipes-ros/ros-comm/roscpp/0001-roscpp-do-not-try-to-find-pthread-by-own-methods.patch

diff --git a/recipes-ros/ros-comm/roscpp/0001-roscpp-do-not-try-to-find-pthread-by-own-methods.patch b/recipes-ros/ros-comm/roscpp/0001-roscpp-do-not-try-to-find-pthread-by-own-methods.patch
new file mode 100644
index 0000000..29be494
--- /dev/null
+++ b/recipes-ros/ros-comm/roscpp/0001-roscpp-do-not-try-to-find-pthread-by-own-methods.patch
@@ -0,0 +1,42 @@
+From a392a5e614883c18bf64568b1ebffe95d7efcf15 Mon Sep 17 00:00:00 2001
+From: Lukas Bulwahn <lukas.bulwahn@oss.bmw-carit.de>
+Date: Tue, 23 Jul 2013 15:18:07 +0200
+Subject: [PATCH] roscpp: do not try to find pthread by own methods
+
+This commit partially reverts c5dfa6305e883f76dc2aa52d27d2977e3d66ea2e
+in the ros/ros_comm repository.
+---
+ clients/roscpp/CMakeLists.txt |   15 +--------------
+ 1 file changed, 1 insertion(+), 14 deletions(-)
+
+diff --git a/clients/roscpp/CMakeLists.txt b/clients/roscpp/CMakeLists.txt
+index 4545073..872f3f6 100644
+--- a/clients/roscpp/CMakeLists.txt
++++ b/clients/roscpp/CMakeLists.txt
+@@ -34,22 +34,9 @@ add_service_files(
+ 
+ generate_messages()
+ 
+-set(PTHREAD_LIB "")
+-find_package(Threads)
+-if(CMAKE_THREAD_LIBS_INIT)
+-  string(LENGTH ${CMAKE_THREAD_LIBS_INIT} _length)
+-  if(_length GREATER 2)
+-    string(SUBSTRING ${CMAKE_THREAD_LIBS_INIT} 0 2 _prefix)
+-    if(${_prefix} STREQUAL "-l")
+-      math(EXPR _rest_len "${_length} - 2")
+-      string(SUBSTRING ${CMAKE_THREAD_LIBS_INIT} 2 ${_rest_len} PTHREAD_LIB)
+-    endif()
+-  endif()
+-endif()
+-
+ catkin_package(
+   INCLUDE_DIRS include ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_INCLUDE_DESTINATION}/ros
+-  LIBRARIES roscpp ${PTHREAD_LIB}
++  LIBRARIES roscpp
+   CATKIN_DEPENDS cpp_common message_runtime rosconsole roscpp_serialization roscpp_traits rosgraph_msgs rostime std_msgs xmlrpcpp
+   DEPENDS Boost
+ )
+-- 
+1.7.9.5
+
diff --git a/recipes-ros/ros-comm/roscpp_1.9.47.bb b/recipes-ros/ros-comm/roscpp_1.9.47.bb
index b82669c..9033388 100644
--- a/recipes-ros/ros-comm/roscpp_1.9.47.bb
+++ b/recipes-ros/ros-comm/roscpp_1.9.47.bb
@@ -13,6 +13,8 @@ DEPENDS = "\
 
 require ros-comm.inc
 
+SRC_URI += "file://0001-roscpp-do-not-try-to-find-pthread-by-own-methods.patch;striplevel=3"
+
 S = "${WORKDIR}/ros_comm-${PV}/clients/${BPN}"
 
 CXXFLAGS_append = " -I${OECMAKE_BUILDPATH}/devel/include"
-- 
GitLab