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

--- a/libcudacxx/cmake/libcudacxxInstallRules.cmake
+++ b/libcudacxx/cmake/libcudacxxInstallRules.cmake
@@ -6,7 +6,7 @@ if (NOT libcudacxx_ENABLE_INSTALL_RULES)
   return()
 endif()
 
-# Bring in CMAKE_INSTALL_LIBDIR
+# Bring in CMAKE_INSTALL_DATADIR
 include(GNUInstallDirs)
 
 # Libcudacxx headers
@@ -21,14 +21,14 @@ install(DIRECTORY "${libcudacxx_SOURCE_D
 
 # Libcudacxx cmake package
 install(DIRECTORY "${libcudacxx_SOURCE_DIR}/lib/cmake/libcudacxx"
-  DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake"
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake"
   REGEX .*header-search.cmake.* EXCLUDE
 )
 
 # Need to configure a file to store CMAKE_INSTALL_INCLUDEDIR
 # since it can be defined by the user. This is common to work around collisions
 # with the CTK installed headers.
-set(install_location "${CMAKE_INSTALL_LIBDIR}/cmake/libcudacxx")
+set(install_location "${CMAKE_INSTALL_DATADIR}/cmake/libcudacxx")
 # Transform to a list of directories, replace each directory with "../"
 # and convert back to a string
 string(REGEX REPLACE "/" ";" from_install_prefix "${install_location}")
--- a/libcudacxx/cmake/test/CMakeLists.txt
+++ b/libcudacxx/cmake/test/CMakeLists.txt
@@ -51,7 +51,7 @@ libcudacxx_add_compile_test(test_name
 libcudacxx_add_compile_test(test_name
   test_export
   install_tree
-  -D "libcudacxx_DIR=${tmp_install_prefix}/lib/cmake/libcudacxx/"
+  -D "libcudacxx_DIR=${tmp_install_prefix}/share/cmake/libcudacxx/"
   -D TEST_TYPE=INSTALL_TREE
 )
 set_tests_properties(${test_name} PROPERTIES FIXTURES_REQUIRED install_tree)
