diff --git a/dune/fem-dg/CMakeLists.txt b/dune/fem-dg/CMakeLists.txt
index 70aa390ab5a0d41f1c553bd458f02610346adef0..77941fe4ebcf0b7d11b55444e4b2b592a59d7650 100644
--- a/dune/fem-dg/CMakeLists.txt
+++ b/dune/fem-dg/CMakeLists.txt
@@ -1,13 +1 @@
-set(SUBDIRS  assemble main misc models operator pass solver stepper test)
-# include not needed for CMake
-# include $(top_srcdir)/am/global-rules
-set(femdgdir  ${CMAKE_INSTALL_INCLUDEDIR}/dune/fem-dg)
-set(femdg_HEADERS  femdgtest.hh)
-install(FILES ${femdg_HEADERS} DESTINATION ${femdgdir})
-foreach(i ${SUBDIRS})
-  if(${i} STREQUAL "test")
-    set(opt EXCLUDE_FROM_ALL)
-  endif(${i} STREQUAL "test")
-  add_subdirectory(${i} ${opt})
-  unset(opt)
-endforeach(i ${SUBDIRS})
+dune_add_subdirs( assemble main misc models operator pass solver stepper test)
diff --git a/dune/fem-dg/assemble/CMakeLists.txt b/dune/fem-dg/assemble/CMakeLists.txt
index 55532a5a58ef22b307195638eb257156a46621aa..d618ac9dfaa01414e88f383f5b797c2a2d74fa65 100644
--- a/dune/fem-dg/assemble/CMakeLists.txt
+++ b/dune/fem-dg/assemble/CMakeLists.txt
@@ -1,5 +1 @@
-set(assembledir  ${CMAKE_INSTALL_INCLUDEDIR}/dune/fem-dg/assemble)
-set(assemble_HEADERS  primalmatrix.hh)
-# include not needed for CMake
-# include $(top_srcdir)/am/global-rules
-install(FILES ${assemble_HEADERS} DESTINATION ${assembledir})
\ No newline at end of file
+dune_install( primalmatrix.hh)
diff --git a/dune/fem-dg/main/CMakeLists.txt b/dune/fem-dg/main/CMakeLists.txt
index 8f84666042bc5eefd6f0f782571302b237625ffb..c3013f2405a644f330ead02c299f294451e3081f 100644
--- a/dune/fem-dg/main/CMakeLists.txt
+++ b/dune/fem-dg/main/CMakeLists.txt
@@ -1,7 +1 @@
-set(maindir  ${top_srcdir}/dune/fem-dg/main)
-set(main_HEADERS  main.hh codegen.hh  codegen2.hh caching.hh caching2.hh
-  vectorialbasefunctionset.hh default.hh
-  main_0.cc main_1.cc  main_2.cc  main_3.cc  main_4.cc  main.cc main_pol.cc)
-# include not needed for CMake
-# include $(top_srcdir)/am/global-rules
-install(FILES ${main_HEADERS} DESTINATION ${maindir})
\ No newline at end of file
+dune_install( main.hh codegen.hh  codegen2.hh caching.hh caching2.hh vectorialbasefunctionset.hh default.hh main_0.cc main_1.cc  main_2.cc  main_3.cc  main_4.cc  main.cc main_pol.cc )
diff --git a/dune/fem-dg/misc/CMakeLists.txt b/dune/fem-dg/misc/CMakeLists.txt
index 93bc602defc9771bd95a0397d437e5ffeecf7335..2986ab1771ae80eba8abaab4bd9f6106d5aebf41 100644
--- a/dune/fem-dg/misc/CMakeLists.txt
+++ b/dune/fem-dg/misc/CMakeLists.txt
@@ -1,5 +1 @@
-set(miscdir  ${CMAKE_INSTALL_INCLUDEDIR}/dune/fem-dg/misc)
-set(misc_HEADERS  diagnostics.hh cons2prim.hh crs.hh streams.hh)
-# include not needed for CMake
-# include $(top_srcdir)/am/global-rules
-install(FILES ${misc_HEADERS} DESTINATION ${miscdir})
\ No newline at end of file
+dune_install( diagnostics.hh cons2prim.hh crs.hh streams.hh)
diff --git a/dune/fem-dg/models/CMakeLists.txt b/dune/fem-dg/models/CMakeLists.txt
index 9e65648a3c9a536c834b6a718ecc7305f5ee57e6..29ded51c1cc73a5f61be2a9cb9ac94744ad31824 100644
--- a/dune/fem-dg/models/CMakeLists.txt
+++ b/dune/fem-dg/models/CMakeLists.txt
@@ -1,5 +1 @@
-set(modelsdir  ${CMAKE_INSTALL_INCLUDEDIR}/dune/fem-dg/models)
-set(models_HEADERS  defaultmodel.hh defaultprobleminterfaces.hh)
-# include not needed for CMake
-# include $(top_srcdir)/am/global-rules
-install(FILES ${models_HEADERS} DESTINATION ${modelsdir})
\ No newline at end of file
+dune_install( defaultmodel.hh defaultprobleminterfaces.hh )
diff --git a/dune/fem-dg/operator/CMakeLists.txt b/dune/fem-dg/operator/CMakeLists.txt
index 7f888deedea7a1c5600f14a0f2de1b73b1fb220e..f7e0d0d4d2aac2ac4ce50edb0eaf79b03eadf3f0 100644
--- a/dune/fem-dg/operator/CMakeLists.txt
+++ b/dune/fem-dg/operator/CMakeLists.txt
@@ -1,10 +1 @@
-set(SUBDIRS  adaptation limiter dg fluxes)
-# include not needed for CMake
-# include $(top_srcdir)/am/global-rules
-foreach(i ${SUBDIRS})
-  if(${i} STREQUAL "test")
-    set(opt EXCLUDE_FROM_ALL)
-  endif(${i} STREQUAL "test")
-  add_subdirectory(${i} ${opt})
-  unset(opt)
-endforeach(i ${SUBDIRS})
+dune_add_subdirs( adaptation limiter dg fluxes)
diff --git a/dune/fem-dg/operator/adaptation/CMakeLists.txt b/dune/fem-dg/operator/adaptation/CMakeLists.txt
index bf5bbed1f8cfd6c1b72771f96e84aa4448a6a8e3..6409415163cdea6b7682cb057f431dfb271ba222 100644
--- a/dune/fem-dg/operator/adaptation/CMakeLists.txt
+++ b/dune/fem-dg/operator/adaptation/CMakeLists.txt
@@ -1,6 +1 @@
-set(adaptationdir  ${CMAKE_INSTALL_INCLUDEDIR}/dune/fem-dg/operator/adaptation)
-set(adaptation_HEADERS  adaptation.cc  adaptation.hh
-                                                                                 estimatorbase.hh estimator.hh utility.hh)
-# include not needed for CMake
-# include $(top_srcdir)/am/global-rules
-install(FILES ${adaptation_HEADERS} DESTINATION ${adaptationdir})
\ No newline at end of file
+dune_install( adaptation.cc  adaptation.hh estimatorbase.hh estimator.hh utility.hh)
diff --git a/dune/fem-dg/operator/dg/CMakeLists.txt b/dune/fem-dg/operator/dg/CMakeLists.txt
index ab8f46b6f38f6a42f9cace32d0b3032476b38394..0ae1f542de17f684efefc6d4466b8c1f110fad8e 100644
--- a/dune/fem-dg/operator/dg/CMakeLists.txt
+++ b/dune/fem-dg/operator/dg/CMakeLists.txt
@@ -1,7 +1 @@
-set(dgdir  ${CMAKE_INSTALL_INCLUDEDIR}/dune/fem-dg/operator/dg)
-set(dg_HEADERS  discretemodelcommon.hh  fluxoperator.hh  primaldiscretemodel.hh
-dgoperatorchoice.hh  fluxdiscretemodel.hh    operatorbase.hh  primaloperator.hh
-passtraits.hh)
-# include not needed for CMake
-# include $(top_srcdir)/am/global-rules
-install(FILES ${dg_HEADERS} DESTINATION ${dgdir})
\ No newline at end of file
+dune_install( discretemodelcommon.hh fluxoperator.hh primaldiscretemodel.hh dgoperatorchoice.hh fluxdiscretemodel.hh operatorbase.hh primaloperator.hh passtraits.hh)
diff --git a/dune/fem-dg/operator/fluxes/CMakeLists.txt b/dune/fem-dg/operator/fluxes/CMakeLists.txt
index bd880091e83ccbbde1ef4047be076f96496d1c2a..53cd25289e86f727bb97f775a01d7d87ffb37cac 100644
--- a/dune/fem-dg/operator/fluxes/CMakeLists.txt
+++ b/dune/fem-dg/operator/fluxes/CMakeLists.txt
@@ -1,7 +1 @@
-set(fluxesdir  ${CMAKE_INSTALL_INCLUDEDIR}/dune/fem-dg/operator/fluxes)
-set(fluxes_HEADERS  averageflux.hh  diffusionflux.hh  ldgflux.hh
-mhd_fluxes.hh  rotator.hh dgprimalfluxes.hh  eulerfluxes.hh
-mhd_eqns.hh  mhdfluxes.hh  mhd_eqns.cc  mhd_fluxes.cc)
-# include not needed for CMake
-# include $(top_srcdir)/am/global-rules
-install(FILES ${fluxes_HEADERS} DESTINATION ${fluxesdir})
\ No newline at end of file
+dune_install( averageflux.hh  diffusionflux.hh  ldgflux.hh mhd_fluxes.hh  rotator.hh dgprimalfluxes.hh  eulerfluxes.hh mhd_eqns.hh  mhdfluxes.hh  mhd_eqns.cc  mhd_fluxes.cc)
diff --git a/dune/fem-dg/operator/limiter/CMakeLists.txt b/dune/fem-dg/operator/limiter/CMakeLists.txt
index 50aa7e7245c7dcd52732e373f2d09baddc735f48..b0bdbf340c57d88eaf9b1bb39ebad8aa4b35a34f 100644
--- a/dune/fem-dg/operator/limiter/CMakeLists.txt
+++ b/dune/fem-dg/operator/limiter/CMakeLists.txt
@@ -1,5 +1 @@
-set(operatordir  ${CMAKE_INSTALL_INCLUDEDIR}/dune/fem-dg/operator/limiter)
-set(operator_HEADERS  limiter.hh limitpass.hh limiterdiscretemodel.hh)
-# include not needed for CMake
-# include $(top_srcdir)/am/global-rules
-install(FILES ${operator_HEADERS} DESTINATION ${operatordir})
\ No newline at end of file
+dune_install(limiter.hh limitpass.hh limiterdiscretemodel.hh)
diff --git a/dune/fem-dg/pass/CMakeLists.txt b/dune/fem-dg/pass/CMakeLists.txt
index 843ab5b49a27d6c09d2244e0586e6f1e841bd030..0c30350aa3770e81c6f7eabc38f858a7b9a55204 100644
--- a/dune/fem-dg/pass/CMakeLists.txt
+++ b/dune/fem-dg/pass/CMakeLists.txt
@@ -1,6 +1 @@
-set(passdir  ${CMAKE_INSTALL_INCLUDEDIR}/dune/fem-dg/pass)
-set(pass_HEADERS  assembleddiffusionpass.hh  dgmodelcaller.hh  dgmasspass.hh
-               dgpass.hh  ellipticmodelcaller.hh  threadhandle.hh  threadpass.hh)
-# include not needed for CMake
-# include $(top_srcdir)/am/global-rules
-install(FILES ${pass_HEADERS} DESTINATION ${passdir})
\ No newline at end of file
+dune_install( assembleddiffusionpass.hh  dgmodelcaller.hh  dgmasspass.hh dgpass.hh  ellipticmodelcaller.hh  threadhandle.hh  threadpass.hh)
diff --git a/dune/fem-dg/solver/CMakeLists.txt b/dune/fem-dg/solver/CMakeLists.txt
index a030cf7011526b51f739e342de473849b85a4ed7..f97a59860aac9b9ef85a61cad02e446e0f63c957 100644
--- a/dune/fem-dg/solver/CMakeLists.txt
+++ b/dune/fem-dg/solver/CMakeLists.txt
@@ -1,5 +1 @@
-set(solverdir  ${CMAKE_INSTALL_INCLUDEDIR}/dune/fem-dg/solver)
-set(solver_HEADERS  smartodesolver.hh  rungekuttasolver.hh)
-# include not needed for CMake
-# include $(top_srcdir)/am/global-rules
-install(FILES ${solver_HEADERS} DESTINATION ${solverdir})
\ No newline at end of file
+dune_install( smartodesolver.hh  rungekuttasolver.hh)
diff --git a/dune/fem-dg/stepper/CMakeLists.txt b/dune/fem-dg/stepper/CMakeLists.txt
index f181f1aba29a9c729bd68d231cb1d052be5f4ac9..3964170b99aa553d5c120c4a3216559a068b4716 100644
--- a/dune/fem-dg/stepper/CMakeLists.txt
+++ b/dune/fem-dg/stepper/CMakeLists.txt
@@ -1,12 +1 @@
-set(stepperdir  ${top_srcdir}/dune/fem-dg/stepper/)
-set(stepper_HEADERS  advectiondiffusionstepper.hh
-                  advectionstepper.hh
-                  baseevolution.hh
-                  base.hh
-                  ellipt.hh
-                  stepperbase.hh
-                  stepper.hh
-                  steppertraits.hh)
-# include not needed for CMake
-# include $(top_srcdir)/am/global-rules
-install(FILES ${stepper_HEADERS} DESTINATION ${stepperdir})
\ No newline at end of file
+dune_install( advectiondiffusionstepper.hh advectionstepper.hh baseevolution.hh base.hh ellipt.hh stepperbase.hh stepper.hh steppertraits.hh)
diff --git a/dune/fem-dg/test/CMakeLists.txt b/dune/fem-dg/test/CMakeLists.txt
index 50ce226bca13234584a5f2eec53187f0dae1269f..b7b479ecb5c17fbe15fd7c3f881f52432bf5d00a 100644
--- a/dune/fem-dg/test/CMakeLists.txt
+++ b/dune/fem-dg/test/CMakeLists.txt
@@ -1,13 +1 @@
-set(SUBDIRS  dataio advdiff euler navierstokes poisson)
-# include not needed for CMake
-# include $(top_srcdir)/am/global-rules
-set(testdir  ${CMAKE_INSTALL_INCLUDEDIR}/dune/fem-dg/test)
-set(test_HEADERS  )
-install(FILES ${test_HEADERS} DESTINATION ${testdir})
-foreach(i ${SUBDIRS})
-  if(${i} STREQUAL "test")
-    set(opt EXCLUDE_FROM_ALL)
-  endif(${i} STREQUAL "test")
-  add_subdirectory(${i} ${opt})
-  unset(opt)
-endforeach(i ${SUBDIRS})
+dune_add_subdirs( dataio advdiff euler navierstokes poisson)
diff --git a/dune/fem-dg/test/advdiff/CMakeLists.txt b/dune/fem-dg/test/advdiff/CMakeLists.txt
index cc1c15702203314402dd93483555d5102585fd72..80453bfa94e48404d4826bc9bf3ecbaaae261491 100644
--- a/dune/fem-dg/test/advdiff/CMakeLists.txt
+++ b/dune/fem-dg/test/advdiff/CMakeLists.txt
@@ -1,8 +1,4 @@
-# install these headers
-set(advdiffdir ${CMAKE_INSTALL_INCLUDEDIR}/test/advdiff)
-set(advdiff_HEADERS  models.hh  
-                     problemcreator.hh 
-                     steppertraits.hh)
+dune_install( models.hh problemcreator.hh steppertraits.hh)
                                       
 set(GRIDTYPE  YASPGRID)
 set(POLORDER  2)
@@ -10,9 +6,6 @@ set(GRIDDIM  2)
 set(DIMRANGE  1)
 set(FLUX 1) #2
 
-set(TESTS advdiff
-          advdiffall) 
-
 add_definitions( "-D${GRIDTYPE}" )
 add_definitions( "-DGRIDDIM=${GRIDDIM}" )
 add_definitions( "-DDIMRANGE=${DIMRANGE}" )
@@ -29,12 +22,5 @@ add_executable( advdiff ${SOURCEONE})
 dune_target_link_libraries(advdiff ${DUNE_LIBS})
 set_property(TARGET advdiff APPEND PROPERTY 
              COMPILE_DEFINITIONS "ONLY_ONE_P;POLORDER=${POLORDER}")
-
-# We do not want want to build the tests during make all
-# but just build them on demand
-install(FILES ${advdiff_HEADERS} DESTINATION ${advdiffdir})
-foreach(i ${TESTS})
-  add_test(${i} ${i})
-endforeach(i ${TESTS})
-add_directory_test_target(_test_target)
-add_dependencies(${_test_target} ${TESTS} ${COMPILE_XFAIL_TESTS})
+           
+dune_add_test( advdiff advdiffall )
diff --git a/dune/fem-dg/test/euler/CMakeLists.txt b/dune/fem-dg/test/euler/CMakeLists.txt
index 3cb0e8cf898382551ff1305d3aec0c2ba990553f..45a6a83ff852448904a10c5ac8678d3d555c877e 100644
--- a/dune/fem-dg/test/euler/CMakeLists.txt
+++ b/dune/fem-dg/test/euler/CMakeLists.txt
@@ -1,11 +1,4 @@
-# install these headers
-set(eulerdir ${CMAKE_INSTALL_INCLUDEDIR}/dune/fem-dg/test/euler)
-set(euler_HEADERS  eulermodel.hh  
-                   problems.hh 
-                   problemcreator.hh
-                   chorjo.hh 
-                   chorjo.cc 
-                   passtraits.hh)
+dune_install( eulermodel.hh problems.hh problemcreator.hh chorjo.hh chorjo.cc passtraits.hh)
 
 set(GRIDTYPE YASPGRID)
 set(GRIDDIM  2)
@@ -13,9 +6,6 @@ set(POLORDER 2)
 set(FLUX 1)
 set(DIFFFLUXTYPE PRIMALDG)
 
-set(TESTS euler
-          eulerall)
-
 add_definitions( "-D${GRIDTYPE}" )
 add_definitions( "-DGRIDDIM=${GRIDDIM}" )
 add_definitions( "-DFLUX=${FLUX}" )
@@ -34,12 +24,4 @@ dune_target_link_libraries(euler ${DUNE_LIBS})
 set_property(TARGET euler APPEND PROPERTY 
              COMPILE_DEFINITIONS "ONLY_ONE_P;POLORDER=${POLORDER}")
 
-# We do not want want to build the tests during make all
-# but just build them on demand
-install(FILES ${euler_HEADERS} DESTINATION ${eulerdir})
-foreach(i ${TESTS})
-  add_dune_alugrid_flags(${i})
-  add_test(${i} ${i})
-endforeach(i ${TESTS})
-add_directory_test_target(_test_target)
-add_dependencies(${_test_target} ${TESTS} ${COMPILE_XFAIL_TESTS})
+dune_add_test( euler eulerall )
diff --git a/dune/fem-dg/test/navierstokes/CMakeLists.txt b/dune/fem-dg/test/navierstokes/CMakeLists.txt
index 3790391fbe66c9a68be19f539971c2648943cc94..a2eaa3b735d7fdebd054d7513da41ba901277907 100644
--- a/dune/fem-dg/test/navierstokes/CMakeLists.txt
+++ b/dune/fem-dg/test/navierstokes/CMakeLists.txt
@@ -1,12 +1,4 @@
-# install these headers
-set(nseqdir ${CMAKE_INSTALL_INCLUDEDIR}/dune/fem-dg/test/navierstokes)
-set(nseq_HEADERS  ns_model.hh 
-                  problemcreator.hh 
-                  nswaves.hh
-                  ns_model_spec.hh 
-                  nssmooth.hh 
-                  thermodynamics.hh 
-                  passtraits.hh)
+dune_install( ns_model.hh problemcreator.hh nswaves.hh ns_model_spec.hh nssmooth.hh thermodynamics.hh passtraits.hh)
 
 set(GRIDTYPE YASPGRID)
 set(GRIDDIM  3)
@@ -15,16 +7,12 @@ set(PROBLEM 2)
 set(FLUX 1)
 set(DIFFFLUX PRIMALDG)
 
-set(TESTS navierstokes
-          navierstokesall)
-
 add_definitions( "-D${GRIDTYPE}" )
 add_definitions( "-DGRIDDIM=${GRIDDIM}" )
 add_definitions( "-DFLUX=${FLUX}" )
 add_definitions( "-D${DIFFFLUX}" )
 add_definitions( "-DPROBLEM=${PROBLEM}" )
 
-
 include_directories("${CMAKE_SOURCE_DIR}/dune/fem-dg/test/navierstokes")
 
 add_executable( navierstokes ${SOURCEONE})
@@ -32,17 +20,9 @@ dune_target_link_libraries(navierstokes ${DUNE_LIBS})
 set_property(TARGET navierstokes APPEND PROPERTY 
              COMPILE_DEFINITIONS "ONLY_ONE_P;POLORDER=${POLORDER}")
 
-           add_executable( navierstokesall ${SOURCEALL})
+add_executable( navierstokesall ${SOURCEALL})
 dune_target_link_libraries(navierstokes ${DUNE_LIBS})
 set_property(TARGET navierstokesall APPEND PROPERTY 
   COMPILE_DEFINITIONS "LIMITER")
 
-# We do not want want to build the tests during make all
-# but just build them on demand
-install(FILES ${nseq_HEADERS} DESTINATION ${nseqdir})
-foreach(i ${TESTS})
-  add_dune_alugrid_flags(${i})
-  add_test(${i} ${i})
-endforeach(i ${TESTS})
-add_directory_test_target(_test_target)
-add_dependencies(${_test_target} ${TESTS} ${COMPILE_XFAIL_TESTS})
+dune_add_test( navierstokes navierstokesall )
diff --git a/dune/fem-dg/test/poisson/CMakeLists.txt b/dune/fem-dg/test/poisson/CMakeLists.txt
index a89a76f3503c005781dcd5d2fb8c19a7231bfc6c..6002282ef8d27292946c577143c2d88fb02a7e92 100644
--- a/dune/fem-dg/test/poisson/CMakeLists.txt
+++ b/dune/fem-dg/test/poisson/CMakeLists.txt
@@ -1,10 +1,4 @@
-# install these headers
-set(poissondir ${CMAKE_INSTALL_INCLUDEDIR}/test/poisson)
-set(poisson_HEADERS benchmarkproblems.hh
-                    models.hh
-                    passtraits.hh
-                    problemcreator.hh
-                    poissonproblem.hh )
+dune_install( benchmarkproblems.hh models.hh passtraits.hh problemcreator.hh poissonproblem.hh )
                                       
 set(GRIDTYPE  YASPGRID)
 set(POLORDER  2)
@@ -12,9 +6,6 @@ set(GRIDDIM  2)
 set(DIMRANGE  1)
 set(FLUX 1) #2
 
-set(TESTS poisson
-          poissonall) 
-
 add_definitions( "-D${GRIDTYPE}" )
 add_definitions( "-DGRIDDIM=${GRIDDIM}" )
 add_definitions( "-DDIMRANGE=${DIMRANGE}" )
@@ -32,11 +23,4 @@ dune_target_link_libraries(poisson ${DUNE_LIBS})
 set_property(TARGET poisson APPEND PROPERTY 
              COMPILE_DEFINITIONS "ONLY_ONE_P;POLORDER=${POLORDER}")
 
-# We do not want want to build the tests during make all
-# but just build them on demand
-install(FILES ${poisson_HEADERS} DESTINATION ${poissondir})
-foreach(i ${TESTS})
-  add_test(${i} ${i})
-endforeach(i ${TESTS})
-add_directory_test_target(_test_target)
-add_dependencies(${_test_target} ${TESTS} ${COMPILE_XFAIL_TESTS})
+dune_add_test( poisson poissonall )