From: Juhani Numminen <juhaninumminen0@gmail.com>
Date: Fri, 17 Jan 2020 17:45:45 +0200
Subject: Avoid-buildpath-in-installed-files

Workaround to avoid build paths in exported cmake targets.
---
 dynamicEDT3D/src/CMakeLists.txt | 4 ++--
 octovis/CMakeLists.txt          | 2 ++
 octovis/CMakeLists_src.txt      | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dynamicEDT3D/src/CMakeLists.txt b/dynamicEDT3D/src/CMakeLists.txt
index 0b9357c..d158305 100644
--- a/dynamicEDT3D/src/CMakeLists.txt
+++ b/dynamicEDT3D/src/CMakeLists.txt
@@ -7,10 +7,10 @@ set_target_properties(dynamicedt3d PROPERTIES
   VERSION ${DYNAMICEDT3D_VERSION}
   SOVERSION ${DYNAMICEDT3D_SOVERSION}
 )
-target_link_libraries(dynamicedt3d ${OCTOMAP_LIBRARIES})
+target_link_libraries(dynamicedt3d -loctomap -loctomath)
 
 add_library(dynamicedt3d-static STATIC ${dynamicEDT3D_SRCS})
-target_link_libraries(dynamicedt3d-static ${OCTOMAP_LIBRARIES})
+target_link_libraries(dynamicedt3d-static -loctomap -loctomath)
 
 SET_TARGET_PROPERTIES(dynamicedt3d-static PROPERTIES OUTPUT_NAME "dynamicedt3d") 
 
diff --git a/octovis/CMakeLists.txt b/octovis/CMakeLists.txt
index 974fbab..4aed63a 100644
--- a/octovis/CMakeLists.txt
+++ b/octovis/CMakeLists.txt
@@ -51,6 +51,8 @@ MESSAGE(STATUS "Found octomap version: " ${octomap_VERSION})
 
 INCLUDE_DIRECTORIES(BEFORE SYSTEM ${OCTOMAP_INCLUDE_DIRS})
 
+LINK_DIRECTORIES(${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
+
 # Export the package for use from the build-tree
 # (this registers the build-tree with a global CMake-registry)
 export(PACKAGE octovis)
diff --git a/octovis/CMakeLists_src.txt b/octovis/CMakeLists_src.txt
index 4ce0903..012fde6 100644
--- a/octovis/CMakeLists_src.txt
+++ b/octovis/CMakeLists_src.txt
@@ -107,7 +107,7 @@ add_library(octovis-shared SHARED ${viewerlib_SRCS})
 target_link_libraries(octovis-shared 
   ${OPENGL_gl_LIBRARY} 
   ${OPENGL_glu_LIBRARY} 
-  ${OCTOMAP_LIBRARIES}
+  -loctomap -loctomath
   ${QGLViewer_LIBRARIES}
 )
 set_target_properties(octovis-shared PROPERTIES
