From 7a4ea159b9e5582b3fcc150e22403bd2e850bc35 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Thu, 2 Jan 2020 12:58:20 +0100
Subject: Fix installation paths for cmake


diff --git a/Box2D/Box2D/CMakeLists.txt b/Box2D/Box2D/CMakeLists.txt
index 05087d3..f45b6d4 100644
--- a/Box2D/Box2D/CMakeLists.txt
+++ b/Box2D/Box2D/CMakeLists.txt
@@ -184,14 +184,14 @@ source_group(Rope FILES ${BOX2D_Rope_SRCS} ${BOX2D_Rope_HDRS})
 
 if(BOX2D_INSTALL)
 	# install headers
-	install(FILES ${BOX2D_General_HDRS} DESTINATION include/Box2D)
-	install(FILES ${BOX2D_Collision_HDRS} DESTINATION include/Box2D/Collision)
-	install(FILES ${BOX2D_Shapes_HDRS} DESTINATION include/Box2D/Collision/Shapes)
-	install(FILES ${BOX2D_Common_HDRS} DESTINATION include/Box2D/Common)
-	install(FILES ${BOX2D_Dynamics_HDRS} DESTINATION include/Box2D/Dynamics)
-	install(FILES ${BOX2D_Contacts_HDRS} DESTINATION include/Box2D/Dynamics/Contacts)
-	install(FILES ${BOX2D_Joints_HDRS} DESTINATION include/Box2D/Dynamics/Joints)
-	install(FILES ${BOX2D_Rope_HDRS} DESTINATION include/Box2D/Rope)
+	install(FILES ${BOX2D_General_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/Box2D)
+	install(FILES ${BOX2D_Collision_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/Box2D/Collision)
+	install(FILES ${BOX2D_Shapes_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/Box2D/Collision/Shapes)
+	install(FILES ${BOX2D_Common_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/Box2D/Common)
+	install(FILES ${BOX2D_Dynamics_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/Box2D/Dynamics)
+	install(FILES ${BOX2D_Contacts_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/Box2D/Dynamics/Contacts)
+	install(FILES ${BOX2D_Joints_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/Box2D/Dynamics/Joints)
+	install(FILES ${BOX2D_Rope_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/Box2D/Rope)
 
 	# install libraries
 	if(BOX2D_BUILD_SHARED)
@@ -207,7 +207,7 @@ if(BOX2D_INSTALL)
 	# install build system hooks for third-party apps
 	install(EXPORT Box2D-targets DESTINATION ${LIB_INSTALL_DIR}/Box2D)
 
-        set (BOX2D_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include)
+        set (BOX2D_INCLUDE_DIR ${INCLUDE_INSTALL_DIR})
         set (BOX2D_INCLUDE_DIRS ${BOX2D_INCLUDE_DIR} )
         set (BOX2D_LIBRARY_DIRS ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR})
         set (BOX2D_LIBRARY Box2D)
diff --git a/Box2D/CMakeLists.txt b/Box2D/CMakeLists.txt
index a290f15..8ba6f91 100644
--- a/Box2D/CMakeLists.txt
+++ b/Box2D/CMakeLists.txt
@@ -15,7 +15,9 @@ option(BOX2D_BUILD_STATIC "Build Box2D static libraries" ON)
 option(BOX2D_BUILD_EXAMPLES "Build Box2D examples" ON)
 
 set(BOX2D_VERSION 2.3.0)
-set(LIB_INSTALL_DIR lib${LIB_SUFFIX})
+set(LIB_INSTALL_DIR lib${LIB_SUFFIX} CACHE PATH "lib installation path")
+set(DOC_INSTALL_DIR share/doc/Box2D CACHE PATH "doc installation path")
+set(INCLUDE_INSTALL_DIR include CACHE PATH "header installation path")
 
 # The Box2D library.
 add_subdirectory(Box2D)
@@ -32,5 +34,5 @@ if(BOX2D_BUILD_EXAMPLES)
 endif(BOX2D_BUILD_EXAMPLES)
 
 if(BOX2D_INSTALL_DOC)
-  install(DIRECTORY Documentation DESTINATION share/doc/Box2D PATTERN ".svn" EXCLUDE)
+  install(DIRECTORY Documentation DESTINATION ${DOC_INSTALL_DIR} PATTERN ".svn" EXCLUDE)
 endif(BOX2D_INSTALL_DOC)
-- 
2.24.1

