Add Findoctomap.cmake module
Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
This commit is contained in:
parent
9cb838527f
commit
d924c54f69
|
@ -0,0 +1,104 @@
|
|||
From 52bb65e7c64765265578109fddba5a189eaec6bf Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
|
||||
Date: Wed, 25 Jan 2017 14:15:14 +0200
|
||||
Subject: [PATCH] Add Findoctomap module
|
||||
|
||||
octomap's authors use absolute paths in the cmake module they
|
||||
ship together with the package. This makes the module unusable
|
||||
in cross-compilation environments or requires additional
|
||||
tweaking (e.g. see https://github.com/bmwcarit/meta-ros/blob/43bd17e8839f4078351895eca361804f19efb13c/recipes-ros/octomap-ros/octomap-ros_0.4.0.bb#L16)
|
||||
|
||||
This patch overrides the module in order to ease octomap's
|
||||
usage in cross-compilation environments.
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/ros/cmake_modules/pull/43]
|
||||
|
||||
Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
|
||||
---
|
||||
cmake/Modules/Findoctomap.cmake | 74 +++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 74 insertions(+)
|
||||
create mode 100644 cmake/Modules/Findoctomap.cmake
|
||||
|
||||
diff --git a/cmake/Modules/Findoctomap.cmake b/cmake/Modules/Findoctomap.cmake
|
||||
new file mode 100644
|
||||
index 0000000..1fee377
|
||||
--- /dev/null
|
||||
+++ b/cmake/Modules/Findoctomap.cmake
|
||||
@@ -0,0 +1,74 @@
|
||||
+##################################################################################################
|
||||
+#
|
||||
+# CMake script for finding Octomap.
|
||||
+#
|
||||
+# Input variables:
|
||||
+#
|
||||
+# - Octomap_ROOT_DIR (optional): When specified, header files and libraries will be searched for in
|
||||
+# ${Octomap_ROOT_DIR}/include
|
||||
+# ${Octomap_ROOT_DIR}/libs
|
||||
+# respectively, and the default CMake search order will be ignored. When unspecified, the default
|
||||
+# CMake search order is used.
|
||||
+# This variable can be specified either as a CMake or environment variable. If both are set,
|
||||
+# preference is given to the CMake variable.
|
||||
+# Use this variable for finding packages installed in a nonstandard location, or for enforcing
|
||||
+# that one of multiple package installations is picked up.
|
||||
+#
|
||||
+#
|
||||
+# Cache variables (not intended to be used in CMakeLists.txt files)
|
||||
+#
|
||||
+# - Octomap_INCLUDE_DIR: Absolute path to package headers.
|
||||
+# - Octomap_LIBRARY: Absolute path to library.
|
||||
+#
|
||||
+#
|
||||
+# Output variables:
|
||||
+#
|
||||
+# - Octomap_FOUND: Boolean that indicates if the package was found
|
||||
+# - Otomap_INCLUDE_DIRS: Paths to the necessary header files
|
||||
+# - Octomap_LIBRARIES: Package libraries
|
||||
+#
|
||||
+#
|
||||
+# Example usage:
|
||||
+#
|
||||
+# find_package(Octomap)
|
||||
+# if(NOT Octomap_FOUND)
|
||||
+# # Error handling
|
||||
+# endif()
|
||||
+# ...
|
||||
+# include_directories(${Octomap_INCLUDE_DIRS} ...)
|
||||
+# ...
|
||||
+# target_link_libraries(my_target ${Octomap_LIBRARIES})
|
||||
+#
|
||||
+##################################################################################################
|
||||
+
|
||||
+# Get package location hint from environment variable (if any)
|
||||
+if(NOT Octomap_ROOT_DIR AND DEFINED ENV{Octomap_ROOT_DIR})
|
||||
+ set(Octomap_ROOT_DIR "$ENV{Octomap_ROOT_DIR}" CACHE PATH
|
||||
+ "Octomap base directory location (optional, used for nonstandard installation paths)")
|
||||
+endif()
|
||||
+
|
||||
+# Search path for nonstandard package locations
|
||||
+if(Octomap_ROOT_DIR)
|
||||
+ set(Octomap_INCLUDE_PATH PATHS "${Octomap_ROOT_DIR}/include" NO_DEFAULT_PATH)
|
||||
+ set(Octomap_LIBRARY_PATH PATHS "${Octomap_ROOT_DIR}/lib" NO_DEFAULT_PATH)
|
||||
+endif()
|
||||
+
|
||||
+# Find headers and libraries
|
||||
+find_path(Octomap_INCLUDE_DIR NAMES octomap.h PATH_SUFFIXES "octomap" ${Octomap_INCLUDE_PATH})
|
||||
+find_library(Octomap_LIBRARY NAMES octomap PATH_SUFFIXES "octomap" ${Octomap_LIBRARY_PATH})
|
||||
+
|
||||
+mark_as_advanced(Octomap_INCLUDE_DIR
|
||||
+ Octomap_LIBRARY)
|
||||
+
|
||||
+# Output variables generation
|
||||
+include(FindPackageHandleStandardArgs)
|
||||
+find_package_handle_standard_args(octomap DEFAULT_MSG Octomap_LIBRARY
|
||||
+ Octomap_INCLUDE_DIR)
|
||||
+
|
||||
+set(Octomap_FOUND ${OCTOMAP_FOUND}) # Enforce case-correctness: Set appropriately cased variable...
|
||||
+#unset(OCTOMAP_FOUND) # ...and unset uppercase variable generated by find_package_handle_standard_args
|
||||
+
|
||||
+if(Octomap_FOUND)
|
||||
+ set(OCTOMAP_INCLUDE_DIRS ${Octomap_INCLUDE_DIR})
|
||||
+ set(OCTOMAP_LIBRARIES ${Octomap_LIBRARY})
|
||||
+endif()
|
||||
--
|
||||
2.7.4
|
||||
|
|
@ -4,7 +4,9 @@ SECTION = "devel"
|
|||
LICENSE = "BSD"
|
||||
LIC_FILES_CHKSUM = "file://package.xml;beginline=9;endline=9;md5=d566ef916e9dedc494f5f793a6690ba5"
|
||||
|
||||
SRC_URI = "https://github.com/ros/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz"
|
||||
SRC_URI = "https://github.com/ros/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz \
|
||||
file://0001-Add-Findoctomap-module.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "c3c2057e022976d89bddd857da028746"
|
||||
SRC_URI[sha256sum] = "4f9358aab07cdc5455ee0545e6791a47687b6e5f4b8fe11481c168968105b8cb"
|
||||
|
||||
|
|
Loading…
Reference in New Issue