diff --git a/cmake/modules/DunePythonInstallPackage.cmake b/cmake/modules/DunePythonInstallPackage.cmake
index 6f42cab7051a325acb37415ac6449e1833693109..724decacdec01412cb9c84781aacb068b3a81c9b 100644
--- a/cmake/modules/DunePythonInstallPackage.cmake
+++ b/cmake/modules/DunePythonInstallPackage.cmake
@@ -396,7 +396,8 @@ function(dune_link_dune_py)
     # don't need an 'install' target for the metadata since we can use the build version
     # but we need to make sure that skbuild correctly installs the
     # existing metadata file into the site-package
-    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LINKDUNEPY_CMAKE_METADATA_FILE} DESTINATION python/dune/data)
+    get_filename_component(LINKDUNEPY_CMAKE_METADATA_FILE_DIR ${LINKDUNEPY_CMAKE_METADATA_FILE} DIRECTORY )
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LINKDUNEPY_CMAKE_METADATA_FILE} DESTINATION python/${LINKDUNEPY_CMAKE_METADATA_FILE_DIR})
   else()
     # this is the build version - keep in mind there is an install version further down
     message(STATUS "Generating the CMake metadata file at ${LINKDUNEPY_CMAKE_METADATA_FILE}")