From 9711929ac72ec3a798d4230a6ae83aa5d7d571c8 Mon Sep 17 00:00:00 2001
From: fherrero <fherrero@iri.upc.edu>
Date: Tue, 5 Mar 2019 12:35:01 +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             |  5 +++++
 Findsegway_head.cmake  | 15 +++++++++------
 src/CMakeLists.txt     |  6 +++---
 src/xml/CMakeLists.txt |  4 ++--
 4 files changed, 19 insertions(+), 11 deletions(-)
 create mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..10f6424
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+bin
+build
+lib
+src/xml/*.hxx
+src/xml/*.cxx
diff --git a/Findsegway_head.cmake b/Findsegway_head.cmake
index e25190c..52452c9 100644
--- a/Findsegway_head.cmake
+++ b/Findsegway_head.cmake
@@ -1,17 +1,20 @@
 #edit the following line to add the librarie's header files
-FIND_PATH(segway_head_INCLUDE_DIR segway_head.h /usr/include/iridrivers /usr/local/include/iridrivers)
+FIND_PATH(segway_head_INCLUDE_DIRS segway_head.h /usr/include/iri/segway_head /usr/local/include/iri/segway_head)
 
-FIND_LIBRARY(segway_head_LIBRARY
+FIND_LIBRARY(segway_head_LIBRARIES
     NAMES segway_head
-    PATHS /usr/lib /usr/local/lib /usr/local/lib/iridrivers) 
+    PATHS /usr/lib /usr/local/lib /usr/local/lib/iri/segway_head)
 
-IF (segway_head_INCLUDE_DIR AND segway_head_LIBRARY)
+SET(segway_head_INCLUDE_DIR ${segway_head_INCLUDE_DIRS})
+SET(segway_head_LIBRARY     ${segway_head_LIBRARIES})
+
+IF (segway_head_INCLUDE_DIRS AND segway_head_LIBRARIES)
    SET(segway_head_FOUND TRUE)
-ENDIF (segway_head_INCLUDE_DIR AND segway_head_LIBRARY)
+ENDIF (segway_head_INCLUDE_DIRS AND segway_head_LIBRARIES)
 
 IF (segway_head_FOUND)
    IF (NOT segway_head_FIND_QUIETLY)
-      MESSAGE(STATUS "Found segway_head: ${segway_head_LIBRARY}")
+      MESSAGE(STATUS "Found segway_head: ${segway_head_LIBRARIES}")
    ENDIF (NOT segway_head_FIND_QUIETLY)
 ELSE (segway_head_FOUND)
    IF (segway_head_FIND_REQUIRED)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1fd882d..7ff8f40 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -26,11 +26,11 @@ ADD_DEPENDENCIES(segway_head xsd_files_gen)
 
 INSTALL(TARGETS segway_head
   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 ../Findsegway_head.cmake DESTINATION ${CMAKE_ROOT}/Modules/)
 
diff --git a/src/xml/CMakeLists.txt b/src/xml/CMakeLists.txt
index d944ccb..acb0d12 100755
--- a/src/xml/CMakeLists.txt
+++ b/src/xml/CMakeLists.txt
@@ -39,7 +39,7 @@ IF(XSD_FOUND)
          DEPENDS ${XSD_PATH_FILES}
          COMMENT "Parsing the xml template file ${XSD_FILES}")
 
-      INSTALL(FILES ${XSD_PATH_FILES} DESTINATION include/iridrivers/xml)
-      INSTALL(FILES ${XSD_HEADERS_INT} DESTINATION include/iridrivers/xml)
+      INSTALL(FILES ${XSD_PATH_FILES} DESTINATION include/iri/${PROJECT_NAME}/xml)
+      INSTALL(FILES ${XSD_HEADERS_INT} DESTINATION include/iri/${PROJECT_NAME}/xml)
    ENDIF(XSD_FILES)
 ENDIF(XSD_FOUND)
-- 
GitLab