From: Ole Streicher <ole@aip.de>
Date: Wed, 27 May 2020 10:43:15 +0200
Subject: Install files in standard Debian paths

---
 CMakeLists.txt                   | 6 +++---
 GFTL.mk.in                       | 4 ++--
 GFTLConfig.cmake.in              | 4 +---
 include/CMakeLists.txt           | 8 ++++----
 include/templates/CMakeLists.txt | 2 +-
 include/types/CMakeLists.txt     | 2 +-
 6 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4b4772b..17ebdcf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,10 +46,10 @@ endif ()
 configure_file(GFTLConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/GFTLConfig.cmake @ONLY)
 configure_file(GFTLConfig-version.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/GFTLConfig-version.cmake @ONLY)
 
-set (top_dir "GFTL-${GFTL_VERSION_MAJOR}.${GFTL_VERSION_MINOR}")
+set (top_dir "gftl")
 install (
   FILES ${CMAKE_CURRENT_BINARY_DIR}/GFTLConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/GFTLConfig-version.cmake
-  DESTINATION "${top_dir}/cmake"
+  DESTINATION "share/cmake/gftl"
   )
 
 # The following is needed for external projects using *nix make when
@@ -58,5 +58,5 @@ set (GFTL_TOP_DIR "${CMAKE_INSTALL_PREFIX}/${top_dir}" CACHE PATH "")
 configure_file(GFTL.mk.in ${CMAKE_CURRENT_BINARY_DIR}/GFTL.mk @ONLY)
 install (
   FILES ${CMAKE_CURRENT_BINARY_DIR}/GFTL.mk 
-  DESTINATION "${top_dir}/include"
+  DESTINATION "share/gftl"
   )
diff --git a/GFTL.mk.in b/GFTL.mk.in
index f3a53af..626f84c 100644
--- a/GFTL.mk.in
+++ b/GFTL.mk.in
@@ -3,7 +3,7 @@
 
 GFTL_INSTALL_PREFIX := @CMAKE_INSTALL_PREFIX@
 GFTL_VERSION := @GFTL_VERSION_MAJOR@.@GFTL_VERSION_MINOR@
-GFTL_TOP_DIR = $(GFTL_INSTALL_PREFIX)/GFTL-$(GFTL_VERSION)
-GFTL_INCLUDE_DIR := $(GFTL_TOP_DIR)/include
+GFTL_TOP_DIR = $(GFTL_INSTALL_PREFIX)
+GFTL_INCLUDE_DIR := $(GFTL_TOP_DIR)/include/gftl
 GFTL_LIBRARIES := # none
 
diff --git a/GFTLConfig.cmake.in b/GFTLConfig.cmake.in
index dbfc4cc..548349f 100644
--- a/GFTLConfig.cmake.in
+++ b/GFTLConfig.cmake.in
@@ -1,6 +1,4 @@
 # Package configuration file
 
 get_filename_component (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
-set (PREFIX ${SELF_DIR}/../..)
-set (GFTL_TOP_DIR ${PREFIX}/GFTL-@GFTL_VERSION_MAJOR@.@GFTL_VERSION_MINOR@ CACHE PATH "")
-include ("${GFTL_TOP_DIR}/cmake/GFTL.cmake")
+include ("${SELF_DIR}/GFTL.cmake")
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index a935e41..14e4c53 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -1,8 +1,8 @@
 add_library (gftl INTERFACE)
-set (dest "GFTL-${GFTL_VERSION_MAJOR}.${GFTL_VERSION_MINOR}")
+set (dest "gftl")
 target_include_directories (gftl INTERFACE
   $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> # for headers when building
-  $<INSTALL_INTERFACE:${dest}/include> # for client in install mode
+  $<INSTALL_INTERFACE:include/${dest}> # for client in install mode
 )
 
 add_subdirectory (templates)
@@ -19,7 +19,7 @@ add_custom_command(
 add_custom_target (force-generation-of-includes ALL)
 add_dependencies (force-generation-of-includes gftl)
 
-install (TARGETS gftl EXPORT GFTL DESTINATION "${dest}/include")
-install (EXPORT GFTL DESTINATION "${dest}/cmake")
+install (TARGETS gftl EXPORT GFTL DESTINATION "include/${dest}")
+install (EXPORT GFTL DESTINATION "share/cmake/${dest}")
 
 
diff --git a/include/templates/CMakeLists.txt b/include/templates/CMakeLists.txt
index b7e861b..b977704 100644
--- a/include/templates/CMakeLists.txt
+++ b/include/templates/CMakeLists.txt
@@ -46,7 +46,7 @@ set_source_files_properties (${generated_incs} PROPERTIES GENERATED TRUE)
 
 file (COPY DIRECTORY . DESTINATION . FILES_MATCHING PATTERN "*.inc")
 
-install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ DESTINATION "${dest}/include/templates"
+install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ DESTINATION "include/${dest}/templates"
   FILES_MATCHING PATTERN "*.inc"
   PATTERN CMakeFiles EXCLUDE
   )
diff --git a/include/types/CMakeLists.txt b/include/types/CMakeLists.txt
index 0b9eb79..ba12316 100644
--- a/include/types/CMakeLists.txt
+++ b/include/types/CMakeLists.txt
@@ -63,7 +63,7 @@ add_dependencies (gftl generate-type-incs)
 
 set_source_files_properties (${generated_incs} PROPERTIES GENERATED TRUE)
 
-install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ DESTINATION "${dest}/include/types"
+install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ DESTINATION "include/${dest}/types"
   FILES_MATCHING PATTERN "*.inc"
   PATTERN CMakeFiles EXCLUDE
   PATTERN "*Foo*" EXCLUDE
