diff --git a/cmake/modules/DuneEnableAllPackages.cmake b/cmake/modules/DuneEnableAllPackages.cmake
index bd4563295974e01a0d20d127fcde72084c5afd04..469e71b0791080d6a2de96c0b699927584f5ceb8 100644
--- a/cmake/modules/DuneEnableAllPackages.cmake
+++ b/cmake/modules/DuneEnableAllPackages.cmake
@@ -221,6 +221,14 @@ Update the cmake_minimum_required() call in your main CMakeLists.txt file to get
       # ...and add it to all future targets in the module
       link_libraries(${module_lib})
     endforeach(module_lib ${DUNE_ENABLE_ALL_PACKAGES_MODULE_LIBRARIES})
+
+    # export the DUNE_ENABLE_ALL_PACKAGES_MODULE_LIBRARIES variable to the parent scope
+    # this is required to make dune_library_add_sources() work (see further down)
+    set(
+      DUNE_ENABLE_ALL_PACKAGES_MODULE_LIBRARIES
+      ${DUNE_ENABLE_ALL_PACKAGES_MODULE_LIBRARIES}
+      PARENT_SCOPE
+      )
   endif(DUNE_ENABLE_ALL_PACKAGES_MODULE_LIBRARIES)
 
   if(DUNE_ENABLE_ALL_PACKAGES_VERBOSE)