Description: Add user customizable install paths.
Author: Bas Couwenberg <sebastic@debian.org>
Forwarded: https://github.com/libkml/libkml/pull/197

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,6 +28,28 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMA
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
 
+if(NOT DEFINED BIN_INSTALL_DIR)
+    set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
+endif(NOT DEFINED BIN_INSTALL_DIR)
+if(NOT DEFINED LIB_INSTALL_DIR)
+    set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib")
+endif(NOT DEFINED LIB_INSTALL_DIR)
+if(NOT DEFINED DATA_INSTALL_DIR)
+    set(DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share")
+endif(NOT DEFINED DATA_INSTALL_DIR)
+if(NOT DEFINED INCLUDE_INSTALL_DIR)
+    set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/kml")
+endif(NOT DEFINED INCLUDE_INSTALL_DIR)
+if(NOT DEFINED MAN_INSTALL_DIR)
+    set(MAN_INSTALL_DIR "${DATA_INSTALL_DIR}/man")
+endif(NOT DEFINED MAN_INSTALL_DIR)
+if(NOT DEFINED RESOURCE_INSTALL_DIR)
+    set(RESOURCE_INSTALL_DIR "${DATA_INSTALL_DIR}/libkml${VERSION_MAJOR}/resource/")
+endif(NOT DEFINED RESOURCE_INSTALL_DIR)
+if(NOT DEFINED LOCALE_INSTALL_DIR)
+    set(LOCALE_INSTALL_DIR "${DATA_INSTALL_DIR}/locale/")
+endif(NOT DEFINED LOCALE_INSTALL_DIR)
+
 set(HAVE_SYSTEM_ZLIB CACHE INTERNAL FALSE)
 set(HAVE_SYSTEM_MINIZIP CACHE INTERNAL FALSE)
 set(HAVE_SYSTEM_EXPAT CACHE INTERNAL FALSE)
--- a/cmake/LibKMLHelper.cmake
+++ b/cmake/LibKMLHelper.cmake
@@ -21,7 +21,7 @@ macro(build_target)
   string(SUBSTRING ${LIB_NAME} 3 ${${LIB_NAME}_END} ${LIB_NAME}_INCLUDE_DIR)
   install(
     FILES ${LIB_INCS}
-    DESTINATION include/${${LIB_NAME}_INCLUDE_DIR})
+    DESTINATION ${INCLUDE_INSTALL_DIR})
 
   install_target(${LIB_NAME})
 
@@ -29,9 +29,9 @@ endmacro(build_target)
 
 macro(install_target _target)
   install(TARGETS ${_target}
-    RUNTIME DESTINATION bin
-    LIBRARY DESTINATION lib
-    ARCHIVE DESTINATION lib)
+    RUNTIME DESTINATION ${BIN_INSTALL_DIR}
+    LIBRARY DESTINATION ${LIB_INSTALL_DIR}
+    ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
 endmacro(install_target)
 
 function(build_test)
--- a/src/kml/CMakeLists.txt
+++ b/src/kml/CMakeLists.txt
@@ -7,5 +7,5 @@ add_subdirectory(regionator)
 
 
 install(  FILES dom.h engine.h
-          DESTINATION include/kml
+          DESTINATION ${INCLUDE_INSTALL_DIR}
           COMPONENT Development)
