gencpp: Setup python script path during runtime via find_program

The python script path for gen_cpp.py is hard coded in the CMake
file and doesn't work during cross compile. Setup it via find_program
during runtime.

This closes #91 with the following error:
*** No rule to make target `/usr/lib/gencpp/gen_cpp.py', needed by
`devel/include/roscpp/Logger.h'.  Stop

Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
This commit is contained in:
Stefan Herbrechtsmeier 2013-06-04 18:37:03 +02:00
parent 5592bfe881
commit 5fe077c822
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From 93cb4ebe5c4063d3ed5c0baf0b696476a90306cb Mon Sep 17 00:00:00 2001
From: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Date: Tue, 4 Jun 2013 17:53:08 +0200
Subject: [PATCH] gencpp-extras.cmake.em: Use find_program for GENCPP_BIN
Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
---
cmake/gencpp-extras.cmake.em | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/cmake/gencpp-extras.cmake.em b/cmake/gencpp-extras.cmake.em
index a77a5f1..1d4bf10 100644
--- a/cmake/gencpp-extras.cmake.em
+++ b/cmake/gencpp-extras.cmake.em
@@ -1,13 +1,17 @@
@[if DEVELSPACE]@
# bin and template dir variables in develspace
-set(GENCPP_BIN @(CMAKE_CURRENT_SOURCE_DIR)/scripts/gen_cpp.py)
+set(GENCPP_BIN_DIR @(CMAKE_CURRENT_SOURCE_DIR)/scripts)
set(GENCPP_TEMPLATE_DIR @(CMAKE_CURRENT_SOURCE_DIR)/scripts)
+set(CATKIN_FIND_ROOT_PATH_MODE NO_CMAKE_FIND_ROOT_PATH)
@[else]@
# bin and template dir variables in installspace
-set(GENCPP_BIN @(CMAKE_INSTALL_PREFIX)/@(CATKIN_PACKAGE_BIN_DESTINATION)/gen_cpp.py)
-set(GENCPP_TEMPLATE_DIR @(CMAKE_INSTALL_PREFIX)/@(CATKIN_PACKAGE_SHARE_DESTINATION))
+set(GENCPP_BIN_DIR @(CMAKE_INSTALL_PREFIX)/@(CATKIN_PACKAGE_BIN_DESTINATION))
+set(GENCPP_TEMPLATE_DIR "${CMAKE_CURRENT_LIST_DIR}/..")
+set(CATKIN_FIND_ROOT_PATH_MODE "")
@[end if]@
+find_program(GENCPP_BIN gen_cpp.py PATHS ${GENCPP_BIN_DIR} NO_DEFAULT_PATH ${CATKIN_FIND_ROOT_PATH_MODE})
+
# Generate .msg->.h for cpp
# The generated .h files should be added ALL_GEN_OUTPUT_FILES_cpp
macro(_generate_msg_cpp ARG_PKG ARG_MSG ARG_IFLAGS ARG_MSG_DEPS ARG_GEN_OUTPUT_DIR)
--
1.7.0.4

View File

@ -5,7 +5,10 @@ LIC_FILES_CHKSUM = "file://package.xml;beginline=7;endline=7;md5=d566ef916e9dedc
DEPENDS = "genmsg-native"
SRC_URI = "https://github.com/ros/${BPN}/archive/${PV}.tar.gz;downloadfilename=${BP}.tar.gz"
PR = "r1"
SRC_URI = "https://github.com/ros/${BPN}/archive/${PV}.tar.gz;downloadfilename=${BP}.tar.gz \
file://0001-gencpp-extras.cmake.em-Use-find_program-for-GENCPP_B.patch"
SRC_URI[md5sum] = "be0b3986e98f3370fef4c1fffe3a69f4"
SRC_URI[sha256sum] = "c68b4518dbc5d65fd19d43724e5c9b0e66c769ef6066e3d511a6ffce2623f3c7"