From 30c96c983e6d585094f564d5812bf87d8f72bc60 Mon Sep 17 00:00:00 2001
From: fherrero <fherrero@iri.upc.edu>
Date: Tue, 5 Mar 2019 11:42:53 +0100
Subject: [PATCH] Install to subfolder. Add plural cmake variables. Add
 gitignore Modified the necessary files to save the headers, the library and
 all the related files on the subdirectory iri/<package_name> Add plural
 _INCLUDE_DIRS and _LIBRARIES find cmake variables. Add .gitignore file to
 ignore bin, build and lib directories

---
 .gitignore                     | 3 +++
 Finddynamixel_motor_cont.cmake | 7 +++++--
 src/CMakeLists.txt             | 6 +++---
 3 files changed, 11 insertions(+), 5 deletions(-)
 create mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..638c8d2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+bin
+build
+lib
diff --git a/Finddynamixel_motor_cont.cmake b/Finddynamixel_motor_cont.cmake
index 727f72c..1345ff3 100644
--- a/Finddynamixel_motor_cont.cmake
+++ b/Finddynamixel_motor_cont.cmake
@@ -1,9 +1,12 @@
 #edit the following line to add the librarie's header files
-FIND_PATH(dynamixel_motor_cont_INCLUDE_DIR dynamixel.h /usr/include/iridrivers /usr/local/include/iridrivers)
+FIND_PATH(dynamixel_motor_cont_INCLUDE_DIR dynamixel.h /usr/include/iri/dynamixel_motor_cont /usr/local/include/iri/dynamixel_motor_cont)
 
 FIND_LIBRARY(dynamixel_motor_cont_LIBRARY
     NAMES dynamixel_motor_cont
-    PATHS /usr/lib /usr/local/lib /usr/local/lib/iridrivers) 
+    PATHS /usr/lib /usr/local/lib /usr/local/lib/iri/dynamixel_motor_cont)
+    
+SET(dynamixel_motor_cont_INCLUDE_DIRS ${dynamixel_motor_cont_INCLUDE_DIR})
+SET(dynamixel_motor_cont_LIBRARIES    ${dynamixel_motor_cont_LIBRARY})
 
 IF (dynamixel_motor_cont_INCLUDE_DIR AND dynamixel_motor_cont_LIBRARY)
    SET(dynamixel_motor_cont_FOUND TRUE)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b6a1c2f..1e8d99d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -27,11 +27,11 @@ ADD_DEPENDENCIES(dynamixel_motor_cont xsd_files_gen)
 
 INSTALL(TARGETS dynamixel_motor_cont
   RUNTIME DESTINATION bin
-  LIBRARY DESTINATION lib/iridrivers
-  ARCHIVE DESTINATION lib/iridrivers
+  LIBRARY DESTINATION lib/iri/${PROJECT_NAME}
+  ARCHIVE DESTINATION lib/iri/${PROJECT_NAME}
 )
 
-INSTALL(FILES ${headers} DESTINATION include/iridrivers)
+INSTALL(FILES ${headers} DESTINATION include/iri/${PROJECT_NAME})
 
 INSTALL(FILES ../Finddynamixel_motor_cont.cmake DESTINATION ${CMAKE_ROOT}/Modules/)
 
-- 
GitLab