Author: Andreas Beckmann <anbe@debian.org>
Description: install *.cmake to CMAKE_INSTALL_DATADIR
Bug: https://github.com/NVIDIA/thrust/issues/1838

--- a/cmake/ThrustInstallRules.cmake
+++ b/cmake/ThrustInstallRules.cmake
@@ -1,4 +1,4 @@
-# Bring in CMAKE_INSTALL_LIBDIR
+# Bring in CMAKE_INSTALL_DATADIR
 include(GNUInstallDirs)
 
 # Thrust is a header library; no need to build anything before installing:
@@ -12,12 +12,12 @@ install(DIRECTORY "${Thrust_SOURCE_DIR}/
 )
 
 install(DIRECTORY "${Thrust_SOURCE_DIR}/thrust/cmake/"
-  DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/thrust"
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/thrust"
   PATTERN *.cmake.in EXCLUDE
 )
 # Need to configure a file to store the infix specified in
 # CMAKE_INSTALL_INCLUDEDIR since it can be defined by the user
-set(install_location "${CMAKE_INSTALL_LIBDIR}/cmake/thrust")
+set(install_location "${CMAKE_INSTALL_DATADIR}/cmake/thrust")
 configure_file("${Thrust_SOURCE_DIR}/thrust/cmake/thrust-header-search.cmake.in"
   "${Thrust_BINARY_DIR}/thrust/cmake/thrust-header-search.cmake"
   @ONLY)
@@ -38,10 +38,10 @@ if (THRUST_INSTALL_CUB_HEADERS)
 
   # Need to configure a file to store THRUST_INSTALL_HEADER_INFIX
   install(DIRECTORY "${Thrust_SOURCE_DIR}/dependencies/cub/cub/cmake/"
-    DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cub"
-    PATTERN cub-header-search EXCLUDE
+    DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/cub"
+    PATTERN *.cmake.in EXCLUDE
   )
-  set(install_location "${CMAKE_INSTALL_LIBDIR}/cmake/cub")
+  set(install_location "${CMAKE_INSTALL_DATADIR}/cmake/cub")
   configure_file("${Thrust_SOURCE_DIR}/dependencies/cub/cub/cmake/cub-header-search.cmake.in"
     "${Thrust_BINARY_DIR}/dependencies/cub/cub/cmake/cub-header-search.cmake"
     @ONLY)
