From 7dd865864f5b31c2aa2757b3c4ae28ff3ca1d55d Mon Sep 17 00:00:00 2001
From: Michael Lotz <mmlr@mlotz.ch>
Date: Fri, 21 Jun 2019 10:28:34 +0200
Subject: Add LIB_INSTALL_DIR and INCLUDE_INSTALL_DIR in build
 system.


diff --git a/CMakeLists.txt b/CMakeLists.txt
index 18b6fb0..ee64789 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,6 +16,8 @@ SET(PATCH_VERSION 5)
 SET(FIFECHAN_VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION})
 
 SET(LIB_SUFFIX "" CACHE STRING "Suffix to append to the system lib folder")
+SET(LIB_INSTALL_DIR lib CACHE STRING "Library install directory")
+SET(INCLUDE_INSTALL_DIR include CACHE STRING "Include install directory")
 
 #------------------------------------------------------------------------------
 #                                 Options                                          
@@ -186,16 +188,16 @@ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
   COMPILE_DEFINITIONS     "FIFECHAN_BUILD"
 )
 
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib${LIB_SUFFIX} PERMISSIONS
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}${LIB_SUFFIX} PERMISSIONS
   OWNER_READ OWNER_WRITE OWNER_EXECUTE
   GROUP_READ GROUP_EXECUTE
   WORLD_READ WORLD_EXECUTE
 )
 
-INSTALL(FILES ${FIFECHAN_HEADER}                  DESTINATION include/)
-INSTALL(FILES ${FIFECHAN_HEADERS}                 DESTINATION include/fifechan/)
-INSTALL(FILES ${FIFECHAN_WIDGET_HEADERS}          DESTINATION include/fifechan/widgets/)
-INSTALL(FILES ${FIFECHAN_UTIL_HEADERS}            DESTINATION include/fifechan/util/)
+INSTALL(FILES ${FIFECHAN_HEADER} DESTINATION ${INCLUDE_INSTALL_DIR})
+INSTALL(FILES ${FIFECHAN_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/fifechan/)
+INSTALL(FILES ${FIFECHAN_WIDGET_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/fifechan/widgets/)
+INSTALL(FILES ${FIFECHAN_UTIL_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/fifechan/util/)
 
 #REMOVE_DEFINITIONS("-DFIFECHAN_BUILD")
 #ADD_DEFINITIONS("-DFIFECHAN_EXTENSION_BUILD")
@@ -246,15 +248,15 @@ IF(ENABLE_ALLEGRO AND ALLEGRO_FOUND)
     COMPILE_DEFINITIONS       "FIFECHAN_EXTENSION_BUILD"
   )
 
-  INSTALL(TARGETS ${PROJECT_NAME}_allegro DESTINATION lib${LIB_SUFFIX} PERMISSIONS
+  INSTALL(TARGETS ${PROJECT_NAME}_allegro DESTINATION ${LIB_INSTALL_DIR}${LIB_SUFFIX} PERMISSIONS
     OWNER_READ OWNER_WRITE OWNER_EXECUTE
     GROUP_READ GROUP_EXECUTE
     WORLD_READ WORLD_EXECUTE
   )
 
-  INSTALL(FILES ${FIFECHAN_ALLEGRO_HEADER}            DESTINATION include/fifechan/)
-  INSTALL(FILES ${FIFECHAN_ALLEGRO_HEADERS}           DESTINATION include/fifechan/allegro/)
-  INSTALL(FILES ${FIFECHAN_ALLEGRO_CONTRIB_HEADERS}   DESTINATION include/fifechan/contrib/allegro/)  
+  INSTALL(FILES ${FIFECHAN_ALLEGRO_HEADER} DESTINATION ${INCLUDE_INSTALL_DIR}/fifechan/)
+  INSTALL(FILES ${FIFECHAN_ALLEGRO_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/fifechan/allegro/)
+  INSTALL(FILES ${FIFECHAN_ALLEGRO_CONTRIB_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/fifechan/contrib/allegro/)
 
 ENDIF(ENABLE_ALLEGRO AND ALLEGRO_FOUND)
 
@@ -300,14 +302,14 @@ IF(ENABLE_IRRLICHT AND IRRLICHT_FOUND)
     COMPILE_DEFINITIONS      "FIFECHAN_EXTENSION_BUILD"
   )
 
-  INSTALL(TARGETS ${PROJECT_NAME}_irrlicht DESTINATION lib${LIB_SUFFIX} PERMISSIONS
+  INSTALL(TARGETS ${PROJECT_NAME}_irrlicht DESTINATION ${LIB_INSTALL_DIR}${LIB_SUFFIX} PERMISSIONS
     OWNER_READ OWNER_WRITE OWNER_EXECUTE
     GROUP_READ GROUP_EXECUTE
     WORLD_READ WORLD_EXECUTE
   )
 
-  INSTALL(FILES ${FIFECHAN_IRRLICHT_HEADER}    DESTINATION include/fifechan/)
-  INSTALL(FILES ${FIFECHAN_IRRLICHT_HEADERS}   DESTINATION include/fifechan/irrlicht/)
+  INSTALL(FILES ${FIFECHAN_IRRLICHT_HEADER} DESTINATION ${INCLUDE_INSTALL_DIR}/fifechan/)
+  INSTALL(FILES ${FIFECHAN_IRRLICHT_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/fifechan/irrlicht/)
 
 ENDIF(ENABLE_IRRLICHT AND IRRLICHT_FOUND)
 
@@ -380,15 +382,15 @@ IF(ENABLE_OPENGL AND OPENGL_FOUND)
     COMPILE_DEFINITIONS     "FIFECHAN_EXTENSION_BUILD"
   )
 
-  INSTALL(TARGETS ${PROJECT_NAME}_opengl DESTINATION lib${LIB_SUFFIX} PERMISSIONS
+  INSTALL(TARGETS ${PROJECT_NAME}_opengl DESTINATION ${LIB_INSTALL_DIR}${LIB_SUFFIX} PERMISSIONS
     OWNER_READ OWNER_WRITE OWNER_EXECUTE
     GROUP_READ GROUP_EXECUTE
     WORLD_READ WORLD_EXECUTE
   )
 
-  INSTALL(FILES ${FIFECHAN_OPENGL_HEADER}           DESTINATION include/fifechan/)
-  INSTALL(FILES ${FIFECHAN_OPENGL_HEADERS}          DESTINATION include/fifechan/opengl/)
-  INSTALL(FILES ${FIFECHAN_OPENGL_CONTRIB_HEADERS}  DESTINATION include/fifechan/contrib/opengl/) 
+ INSTALL(FILES ${FIFECHAN_OPENGL_HEADER} DESTINATION ${INCLUDE_INSTALL_DIR}/fifechan/)
+ INSTALL(FILES ${FIFECHAN_OPENGL_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/fifechan/opengl/)
+ INSTALL(FILES ${FIFECHAN_OPENGL_CONTRIB_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/fifechan/contrib/opengl/)
 
 ENDIF(ENABLE_OPENGL AND OPENGL_FOUND)
 
@@ -466,15 +468,15 @@ IF(ENABLE_SDL AND SDL2_FOUND AND SDL2_IMAGE_FOUND)
     COMPILE_DEFINITIONS     "FIFECHAN_EXTENSION_BUILD"
   )
 
-  INSTALL(TARGETS ${PROJECT_NAME}_sdl DESTINATION lib${LIB_SUFFIX} PERMISSIONS
+  INSTALL(TARGETS ${PROJECT_NAME}_sdl DESTINATION ${LIB_INSTALL_DIR}${LIB_SUFFIX} PERMISSIONS
     OWNER_READ OWNER_WRITE OWNER_EXECUTE
     GROUP_READ GROUP_EXECUTE
     WORLD_READ WORLD_EXECUTE
   )
 
-  INSTALL(FILES ${FIFECHAN_SDL_HEADER}            DESTINATION include/fifechan/)
-  INSTALL(FILES ${FIFECHAN_SDL_HEADERS}           DESTINATION include/fifechan/sdl/)
-  INSTALL(FILES ${FIFECHAN_SDL_CONTRIB_HEADERS}   DESTINATION include/fifechan/contrib/sdl/)   
+  INSTALL(FILES ${FIFECHAN_SDL_HEADER} DESTINATION ${INCLUDE_INSTALL_DIR}/fifechan/)
+  INSTALL(FILES ${FIFECHAN_SDL_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/fifechan/sdl/)
+  INSTALL(FILES ${FIFECHAN_SDL_CONTRIB_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/fifechan/contrib/sdl/)
 
 ENDIF(ENABLE_SDL AND SDL2_FOUND AND SDL2_IMAGE_FOUND)
 
-- 
2.21.0

