diff --git a/.gitignore b/.gitignore
index 3819313818f61d9121ab2ec8c244aeab43041edf..9426ffbac2a374f9b7d1deed10cfda4df45877ab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,6 @@
 *.swp
 *.swo
+example/CMakeProject/all_build/*
+example/CMakeProject/all_package/*
+example/CMakeProject/ALL_test.cpp
+example/CMakeProject/build/*
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index e0d85257c37145f63cd2cf79e53628022bff762b..d1f6f293be385c89cb5203026f356a79b9227c44 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -4,6 +4,15 @@ Changelog
 
 Version 0.9
 -----------
+
+Version 0.9.2
+*************
+
+- Feature: Example CMake and Make projects for integrating ALL into the build
+  process.
+- Bug: CMake dependencies between targets and link and include inheritance
+  corrected.
+
 Version 0.9.1
 *************
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0010fee0f0d0f9e2777c46e4ff34e2e1e4cb589c..b533ab5d04362c93a901d1de84da97e0bc3a79f3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,6 +61,13 @@ else()
     find_package(MPI REQUIRED COMPONENTS CXX)
 endif (CM_ALL_FORTRAN)
 
+# Prepare the Config.cmake.in
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/Config.cmake.in
+"@PACKAGE_INIT@\n
+\n
+include(CMakeFindDependencyMacro)\n
+find_dependency(MPI)\n"
+    )
 
 if(CM_ALL_VTK_OUTPUT)
     message("Using VTK output")
@@ -75,21 +82,25 @@ if(CM_ALL_VTK_OUTPUT)
     if(NOT VTK_FOUND)
         message(FATAL_ERROR "VTK not found, help CMake to find it by setting VTK_LIBRARY and VTK_INCLUDE_DIR")
     endif()
-    # todo(s.schulz): this can be replaced from 3.12 onwards with add_compile_definitions
-    add_compile_options("-DALL_VTK_OUTPUT")
+    file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/Config.cmake.in "find_dependency(VTK)\n")
 endif(CM_ALL_VTK_OUTPUT)
 
+file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/Config.cmake.in
+"include(\"\${CMAKE_CURRENT_LIST_DIR}/ALLTargets.cmake\")\n
+check_required_components(ALL)\n"
+    )
+
 if (CM_ALL_DEBUG)
     message("Using ALL debug information")
-    add_compile_options("-DALL_DEBUG_ENABLED")
+    add_compile_definitions("ALL_DEBUG_ENABLED")
 endif(CM_ALL_DEBUG)
 
 if(CM_ALL_FORTRAN_ERROR_ABORT)
-    add_compile_options("-DALL_FORTRAN_ERROR_ABORT")
+    add_compile_definitions("ALL_FORTRAN_ERROR_ABORT")
 endif()
 
 if(CM_ALL_USE_F08 AND MPI_Fortran_HAVE_F08_MODULE)
-    add_compile_options("-DALL_USE_F08")
+    add_compile_definitions("DALL_USE_F08")
 elseif(CM_ALL_USE_F08 AND NOT MPI_Fortran_HAVE_F08_MODULE)
     message(FATAL_ERROR "Fortran 2008 MPI chosen, but MPI installation does not support the Fortran 2008 modules")
 endif(CM_ALL_USE_F08 AND MPI_Fortran_HAVE_F08_MODULE)
@@ -97,12 +108,9 @@ endif(CM_ALL_USE_F08 AND MPI_Fortran_HAVE_F08_MODULE)
 if(CM_ALL_VORONOI)
     message(STATUS "compiling voro++ version in contrib/voro++")
     add_subdirectory(contrib/voro++)
-    set(CM_ALL_VORO_INC ${CMAKE_SOURCE_DIR}/contrib/voro++/include)
-    set(CM_ALL_VORO_LIB "-L${CMAKE_BINARY_DIR}/contrib/voro++/src -lvoro")
-    add_compile_options("-DALL_VORONOI_ACTIVE")
 endif()
 
-set(STB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/contrib/stb)
+set(STB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/contrib/stb)
 
 add_subdirectory(src)
 add_subdirectory(example)
@@ -117,4 +125,28 @@ if(CM_ALL_AUTO_DOC)
     add_subdirectory("docs")
 endif(CM_ALL_AUTO_DOC)
 
+
+# Export targets and create package
+
+install(EXPORT ALLTargets
+    NAMESPACE ALL::
+    FILE ALLTargets.cmake
+    DESTINATION lib/cmake/ALL
+    )
+
+include(CMakePackageConfigHelpers)
+configure_package_config_file(${CMAKE_CURRENT_BINARY_DIR}/Config.cmake.in
+    "${CMAKE_CURRENT_BINARY_DIR}/ALLConfig.cmake"
+    INSTALL_DESTINATION lib/cmake/ALL
+    )
+write_basic_package_version_file(
+    "${CMAKE_CURRENT_BINARY_DIR}/ALLConfigVersion.cmake"
+    VERSION "${ALL_VERSION}"
+    COMPATIBILITY SameMajorVersion)
+install(FILES
+    "${CMAKE_CURRENT_BINARY_DIR}/ALLConfig.cmake"
+    "${CMAKE_CURRENT_BINARY_DIR}/ALLConfigVersion.cmake"
+    DESTINATION lib/cmake/ALL)
+
+
 # vim: sw=4 ts=4 et
diff --git a/contrib/voro++/src/CMakeLists.txt b/contrib/voro++/src/CMakeLists.txt
index 8f4636f40af88b0fe2b8cb4fccc8cb3a31e78b53..daf286a6f5aab5321407093f67961bf5a521ab23 100644
--- a/contrib/voro++/src/CMakeLists.txt
+++ b/contrib/voro++/src/CMakeLists.txt
@@ -7,6 +7,12 @@ file (GLOB ${MODULE_NAME}_SRCS voro++.cc)
 # Create the library.
 add_library (${MODULE_NAME} ${${MODULE_NAME}_SRCS})
 
-install (TARGETS ${MODULE_NAME} 
-		ARCHIVE DESTINATION lib 
+target_include_directories(${MODULE_NAME}
+	INTERFACE
+	"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>"
+	"$<INSTALL_INTERFACE:include>")
+
+install (TARGETS ${MODULE_NAME}
+	EXPORT ALLTargets
+		ARCHIVE DESTINATION lib
 		LIBRARY DESTINATION lib)
diff --git a/docs/Examples.rst b/docs/Examples.rst
index 84c5e396cdf83e7bd40c866dc433ff1466e5d4a9..fe7ef3dbd7c0a16ef9ab61681f89cbf16e3dd67b 100644
--- a/docs/Examples.rst
+++ b/docs/Examples.rst
@@ -3,10 +3,84 @@
 Examples
 ========
 In the ``/examples`` sub directory several C++ and Fortran example
-programs are placed.
+programs are place, as well as example projects. In some cases, where
+`ALL` would be confusing, the library is referred to as `libALL`.
+
+Projects
+--------
+To show how to integrate our library into your project, there are example
+CMake and GNU make projects.
+
+CMake
+^^^^^
+In the ``/examples`` directory are two example CMake projects. One uses a
+separately installed (or at least compiled) ALL, and the other includes
+the library as a subdirectory and builds it along with the main project.
+
+When copying the example projects, make sure the symbolic links are still
+resolved. The example programs of the project are just linked from the
+examples, with the exception of ``ALL_test.cpp``. This program is
+modified, so different feature flags are used for VTK and Voronoi, to test
+external usage of these features. The change happens in the shell script
+building the project.
+
+In both cases, if VTK output is enabled, CMake must be able to find it. If
+it is not able to by default, or a specific version should be used, set
+VTK_DIR to the directory containing VTK's CMake configuration. For our
+test system, which uses VTK 7.1, this is the ``/lib/cmake/vtk-7.1``
+subdirectory of the install prefix of VTK.
+
+
+Package
+"""""""
+The example project using ``find_package`` is available in
+``/example/CMakeProject``. The full build steps are visible from
+``build_all.sh``, which first compiles the library and then the example
+project, after setting ``ALL_DIR`` (and ``VTK_DIR``).
+
+In general, it suffices to just use ``find_package(ALL 0.9)`` in your
+project's ``CMakeLists.txt`` and then link the corresponding executables
+against this using ``target_link_library(YOUR_TARGET PUBLIC ALL:ALL)``.
+The libraries targets are exported in the ``ALL::`` namespace. The Fortran
+module is then ``ALL::ALL_fortran``.
+
+
+Subdirectory
+""""""""""""
+This project includes the library directly in the source tree via
+``add_subdirectory``. To avoid cyclic symbolic links, this version does
+not run out of the box, since we need the source tree of the library as a
+subdirectory of the project's directory. So copy the contents of
+``/example/CMakeProjectSubdir``. The files assume the library to reside in
+the subdirectory ``all`` and, if VTK is enabled, the VTK installation
+in ``vtk_bin``. Also remember, that the symbolic links still resolve. Then
+you can just run CMake and the project, along with the library, will be
+build. This is also referenced in ``build_all.sh``.
+
+The targets you have to link your executables against are, however, ``ALL``
+or ``ALL_fortran`` respectively. The library is only namespaced if using
+the aforementioned ``find_package`` method. And some name collisions may
+therefore also occur. Using this method causes the library to be
+automatically be build, but also to be rebuild every time the build
+directory is cleaned.
+
+
+GNU Make
+^^^^^^^^
+An example of integrating ALL into a traditional GNU Makefile project is
+shown in ``/example/MakefileProject``. A symbolic link to the VTK
+installation directory is assumed to exist as ``vtk_bin``, otherwise the
+Makefile must be updated (see ``VTK_DIR``). It also assumes its directory
+in the source tree as relative position to the ALL source directory.
+Moving the project needs updating of ``ALL_SOURCE``. It will automatically
+compile ALL using the options provided in ``LIBALL_CONFIGURE``.
+
+
+Programs
+--------
 
 ``ALL_test``
-------------
+^^^^^^^^^^^^
 MPI C++ code that generates a particle distribution over the domains. At
 program start the domains form an orthogonal decomposition of the cubic 3d
 system. Each domain has the same volume as each other domain. Depending
@@ -57,7 +131,7 @@ not already exist. The resulting output can be visualized with tools like
 ParaView or VisIt.
 
 ``ALL_test_f`` and ``ALL_test_f_obj``
--------------------------------------
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 The Fortran example provides a more basic version of the test program
 ``ALL_test``, as its main goal is to show the functionality of the Fortran
 interface. The code creates a basic uniform orthogonal domain
@@ -67,7 +141,7 @@ out the domain distribution of the start configuration and of the final
 configuration.
 
 ``ALL_Staggered`` and ``ALL_Staggered_f``
------------------------------------------
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 These create a very simple load balancing situation with fixed load and
 domains placed along the z direction. The C++ and Fortran versions are
 functionally the same, so the differences between the interfaces can be
diff --git a/docs/Usage.rst b/docs/Usage.rst
index 40fbae98b34e3addd7d42db0723333b17ef9c952..97df603fd16c1acda034988dbfe37a8d36317a38 100644
--- a/docs/Usage.rst
+++ b/docs/Usage.rst
@@ -6,7 +6,9 @@ Usage
 The library is presented as a single load balancing object ``ALL::ALL``
 from ``ALL.hpp``. All classes are encapsulated in the ``ALL`` name space.
 Simple (and not so simple) examples are available in the ``/examples`` sub
-directory.  The simple examples are also documented at length.
+directory. The simple examples are also documented at length. In cases
+where the name `ALL` is misleading, the library is referred to as
+`libALL`.
 
 Errors are treated as exceptions that are thrown of a (sub) class of
 ``ALL::CustomException``. Likely candidates that may throw exceptions are
diff --git a/example/CMakeProject/ALL_Staggered.cpp b/example/CMakeProject/ALL_Staggered.cpp
new file mode 120000
index 0000000000000000000000000000000000000000..8bca7c2bfb9323f5e40ba4b3d616cf451accc289
--- /dev/null
+++ b/example/CMakeProject/ALL_Staggered.cpp
@@ -0,0 +1 @@
+../ALL_Staggered.cpp
\ No newline at end of file
diff --git a/example/CMakeProject/ALL_Staggered_f.F90 b/example/CMakeProject/ALL_Staggered_f.F90
new file mode 120000
index 0000000000000000000000000000000000000000..824e45ef989b09920cc0a5660a3403b88361d251
--- /dev/null
+++ b/example/CMakeProject/ALL_Staggered_f.F90
@@ -0,0 +1 @@
+../ALL_Staggered_f.F90
\ No newline at end of file
diff --git a/example/CMakeProject/ALL_test_src.cpp b/example/CMakeProject/ALL_test_src.cpp
new file mode 120000
index 0000000000000000000000000000000000000000..4ade0dc2b2c72bdc89006407f66ef7965ea88924
--- /dev/null
+++ b/example/CMakeProject/ALL_test_src.cpp
@@ -0,0 +1 @@
+../ALL_test.cpp
\ No newline at end of file
diff --git a/example/CMakeProject/CMakeLists.txt b/example/CMakeProject/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..417c5fb68ede055e2ae0727e5216c2b6ba0d9ee0
--- /dev/null
+++ b/example/CMakeProject/CMakeLists.txt
@@ -0,0 +1,45 @@
+# REMEMBER TO SET CC AND CXX!
+# CC=gcc CXX=g++ cmake -S . -B build -DALL_DIR=`pwd`/../../jall_bin/lib/cmake/ALL
+
+cmake_minimum_required(VERSION 3.14)
+project(ExampleProject)
+
+enable_language(CXX)
+enable_language(Fortran)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
+
+# For cleaner code we should also include MPI here, since this project's source
+# also needs MPI. Otherwise, we are free to leave it out, since the parts
+# required by ALL are automatically included.
+find_package(MPI REQUIRED COMPONENTS CXX Fortran)
+
+# Some variants for testing VTK output and the voronoi method. These are only
+# required, so the code used in .this. project has the corresponding features
+# enabled and calls the respective functions from the library. This is not
+# required for the library itself. Although the library needs have been built
+# with the respective features enabled.
+add_compile_definitions(TEST_VTK_OUTPUT)
+add_compile_definitions(TEST_VORONOI)
+
+find_package(ALL 0.9.1)
+
+add_executable(ALL_Staggered ALL_Staggered.cpp)
+target_link_libraries(ALL_Staggered PUBLIC ALL::ALL)
+# This is in this case not .necessary., since it is already inherited from ALL,
+# however, for readability and clear intent, we should still link against MPI
+# ourselves, since our code also uses MPI directly.
+target_link_libraries(ALL_Staggered PUBLIC ${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES})
+target_include_directories(ALL_Staggered PRIVATE ${MPI_CXX_INCLUDE_PATH})
+
+add_executable(ALL_Staggered_f ALL_Staggered_f.F90)
+set_property(TARGET ALL_Staggered_f PROPERTY LINKER_LANGUAGE Fortran)
+target_link_libraries(ALL_Staggered_f PUBLIC ALL::ALL_fortran)
+target_link_libraries(ALL_Staggered_f PUBLIC ${MPI_Fortran_LINK_FLAGS} ${MPI_Fortran_LIBRARIES})
+target_include_directories(ALL_Staggered_f PRIVATE ${MPI_Fortran_INCLUDE_PATH})
+
+add_executable(ALL_test ALL_test.cpp)
+target_link_libraries(ALL_test PUBLIC ALL::ALL)
+target_link_libraries(ALL_test PUBLIC ${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES})
+target_include_directories(ALL_test PRIVATE ${MPI_CXX_INCLUDE_PATH})
diff --git a/example/CMakeProject/build_all.sh b/example/CMakeProject/build_all.sh
new file mode 100755
index 0000000000000000000000000000000000000000..33a70818f1310f998e4f73f186034bd3983ed433
--- /dev/null
+++ b/example/CMakeProject/build_all.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+# all commands must execute successfully
+set -e
+set -o pipefail
+set -u
+set -x
+
+# $ALL_INSTALL_DIR must be an absolute path!
+ALL_ROOT_DIR=../..
+ALL_BUILD_DIR=all_build
+ALL_INSTALL_DIR=`pwd`/all_bin #where ALL installs itself to
+ALL_PACKAGE=`pwd`/all_package #where our project expects the installed ALL
+VTK_DIR=`pwd`/../../../vtk_bin
+BUILD_DIR=build
+
+# We only move ALL after installation from $ALL_INSTALL_DIR to $ALL_PACKAGE to
+# test for errors in relocatability of the library. A typical user does not
+# need to do that and can just set $ALL_PACKAGE to the directory ALL installs
+# itself to.
+
+export CC=gcc
+export CXX=g++
+
+build_all () {
+	rm -rf "$ALL_BUILD_DIR"
+	mkdir "$ALL_BUILD_DIR"
+	cmake -S "$ALL_ROOT_DIR" -B "$ALL_BUILD_DIR"\
+		-DCMAKE_INSTALL_PREFIX="$ALL_INSTALL_DIR"\
+		-DCM_ALL_FORTRAN=ON\
+		-DCM_ALL_VTK_OUTPUT=ON\
+		-DCM_ALL_VORONOI=ON\
+		-DCMAKE_BUILD_TYPE=Release\
+		-DVTK_DIR="$VTK_DIR"/lib/cmake/vtk-7.1
+
+	cmake --build "$ALL_BUILD_DIR"
+	rm -rf "ALL_INSTALL_DIR"
+	cmake --install "$ALL_BUILD_DIR"
+	if [[ $ALL_INSTALL_DIR != $ALL_PACKAGE ]]
+	then
+		rm -rf "$ALL_PACKAGE"
+		mv "$ALL_INSTALL_DIR" "$ALL_PACKAGE"
+	fi
+}
+
+build_self () {
+	rm -rf "$BUILD_DIR"
+	mkdir "$BUILD_DIR"
+	cmake -S . -B "$BUILD_DIR"\
+		-DALL_DIR="$ALL_PACKAGE"/lib/cmake/ALL\
+		-DVTK_DIR="$VTK_DIR"/lib/cmake/vtk-7.1
+
+	VERBOSE=1 cmake --build "$BUILD_DIR"
+}
+
+prepare_example () {
+	cat $1 | sed \
+		-e 's/ALL_VTK_OUTPUT/TEST_VTK_OUTPUT/'\
+		-e 's/ALL_VORONOI_ACTIVE/TEST_VORONOI/'\
+		> $2
+}
+
+prepare_example ALL_test_src.cpp ALL_test.cpp
+
+build_all
+build_self
diff --git a/example/CMakeProjectSubdir/ALL_Staggered.cpp b/example/CMakeProjectSubdir/ALL_Staggered.cpp
new file mode 120000
index 0000000000000000000000000000000000000000..8bca7c2bfb9323f5e40ba4b3d616cf451accc289
--- /dev/null
+++ b/example/CMakeProjectSubdir/ALL_Staggered.cpp
@@ -0,0 +1 @@
+../ALL_Staggered.cpp
\ No newline at end of file
diff --git a/example/CMakeProjectSubdir/ALL_Staggered_f.F90 b/example/CMakeProjectSubdir/ALL_Staggered_f.F90
new file mode 120000
index 0000000000000000000000000000000000000000..824e45ef989b09920cc0a5660a3403b88361d251
--- /dev/null
+++ b/example/CMakeProjectSubdir/ALL_Staggered_f.F90
@@ -0,0 +1 @@
+../ALL_Staggered_f.F90
\ No newline at end of file
diff --git a/example/CMakeProjectSubdir/ALL_test_src.cpp b/example/CMakeProjectSubdir/ALL_test_src.cpp
new file mode 120000
index 0000000000000000000000000000000000000000..4ade0dc2b2c72bdc89006407f66ef7965ea88924
--- /dev/null
+++ b/example/CMakeProjectSubdir/ALL_test_src.cpp
@@ -0,0 +1 @@
+../ALL_test.cpp
\ No newline at end of file
diff --git a/example/CMakeProjectSubdir/CMakeLists.txt b/example/CMakeProjectSubdir/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..b13887ec09ce4a62bbf8bd97d7243e093dd37772
--- /dev/null
+++ b/example/CMakeProjectSubdir/CMakeLists.txt
@@ -0,0 +1,51 @@
+# REMEMBER TO SET CC AND CXX!
+# CC=gcc CXX=g++ cmake -S . -B build -DALL_DIR=`pwd`/../../jall_bin/lib/cmake/ALL
+
+cmake_minimum_required(VERSION 3.14)
+project(ExampleProject)
+
+enable_language(CXX)
+enable_language(Fortran)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
+
+# For cleaner code we should also include MPI here, since this project's source
+# also needs MPI. Otherwise, we are free to leave it out, since the parts
+# required by ALL are automatically included.
+find_package(MPI REQUIRED COMPONENTS CXX Fortran)
+
+# Some variants for testing VTK output and the voronoi method. These are only
+# required, so the code used in .this. project has the corresponding features
+# enabled and calls the respective functions from the library. This is not
+# required for the library itself. Although the library needs to be build with
+# the respective features enabled.
+add_compile_definitions(TEST_VTK_OUTPUT)
+add_compile_definitions(TEST_VORONOI)
+
+set(CM_ALL_FORTRAN ON)
+#set(CM_ALL_USE_F08 ON)
+set(CM_ALL_VORONOI ON)
+set(CM_ALL_VTK_OUTPUT ON)
+
+add_subdirectory(all)
+
+# The target names have Ex prefixed, since these are already taken by the library itself.
+add_executable(ExALL_Staggered ALL_Staggered.cpp)
+target_link_libraries(ExALL_Staggered PUBLIC ALL)
+# This is in this case not .necessary., since it is already inherited from ALL,
+# however, for readability and clear intent, we should still link against MPI
+# ourselves, since our code also uses MPI directly.
+target_link_libraries(ExALL_Staggered PUBLIC ${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES})
+target_include_directories(ExALL_Staggered PRIVATE ${MPI_CXX_INCLUDE_PATH})
+
+add_executable(ExALL_Staggered_f ALL_Staggered_f.F90)
+set_property(TARGET ExALL_Staggered_f PROPERTY LINKER_LANGUAGE Fortran)
+target_link_libraries(ExALL_Staggered_f PUBLIC ALL_fortran)
+target_link_libraries(ExALL_Staggered_f PUBLIC ${MPI_Fortran_LINK_FLAGS} ${MPI_Fortran_LIBRARIES})
+target_include_directories(ExALL_Staggered_f PRIVATE ${MPI_Fortran_INCLUDE_PATH})
+
+add_executable(ExALL_test ALL_test.cpp)
+target_link_libraries(ExALL_test PUBLIC ALL)
+target_link_libraries(ExALL_test PUBLIC ${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES})
+target_include_directories(ExALL_test PRIVATE ${MPI_CXX_INCLUDE_PATH})
diff --git a/example/CMakeProjectSubdir/all_contains_source_tree b/example/CMakeProjectSubdir/all_contains_source_tree
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/example/CMakeProjectSubdir/build_all.sh b/example/CMakeProjectSubdir/build_all.sh
new file mode 100755
index 0000000000000000000000000000000000000000..8f8fe629982e72b6c97a0ac61957a08207c2401d
--- /dev/null
+++ b/example/CMakeProjectSubdir/build_all.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+export VTK_DIR="`pwd`/vtk_bin/lib/cmake/vtk-7.1"
+
+prepare_example () {
+	cat $1 | sed \
+		-e 's/ALL_VTK_OUTPUT/TEST_VTK_OUTPUT/'\
+		-e 's/ALL_VORONOI_ACTIVE/TEST_VORONOI/'\
+		> $2
+}
+
+prepare_example ALL_test_src.cpp ALL_test.cpp
+rm -rf build && CC=gcc CXX=g++ cmake -S . -B build && VERBOSE=1 cmake --build build
diff --git a/example/CMakeProjectSubdir/vtk_bin_contains_vtk_install_dir b/example/CMakeProjectSubdir/vtk_bin_contains_vtk_install_dir
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/example/MakefileProject/ALL_Staggered.cpp b/example/MakefileProject/ALL_Staggered.cpp
new file mode 120000
index 0000000000000000000000000000000000000000..8bca7c2bfb9323f5e40ba4b3d616cf451accc289
--- /dev/null
+++ b/example/MakefileProject/ALL_Staggered.cpp
@@ -0,0 +1 @@
+../ALL_Staggered.cpp
\ No newline at end of file
diff --git a/example/MakefileProject/ALL_Staggered_f.F90 b/example/MakefileProject/ALL_Staggered_f.F90
new file mode 120000
index 0000000000000000000000000000000000000000..824e45ef989b09920cc0a5660a3403b88361d251
--- /dev/null
+++ b/example/MakefileProject/ALL_Staggered_f.F90
@@ -0,0 +1 @@
+../ALL_Staggered_f.F90
\ No newline at end of file
diff --git a/example/MakefileProject/ALL_test_src.cpp b/example/MakefileProject/ALL_test_src.cpp
new file mode 120000
index 0000000000000000000000000000000000000000..4ade0dc2b2c72bdc89006407f66ef7965ea88924
--- /dev/null
+++ b/example/MakefileProject/ALL_test_src.cpp
@@ -0,0 +1 @@
+../ALL_test.cpp
\ No newline at end of file
diff --git a/example/MakefileProject/Makefile b/example/MakefileProject/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..6738a321e8d3c6668ff994ce8aa218db9c50d638
--- /dev/null
+++ b/example/MakefileProject/Makefile
@@ -0,0 +1,83 @@
+# Set our compilers
+CC=gcc
+CXX=g++
+FC=gfortran
+# as well as MPI wrapper
+MCC=mpicc
+MCXX=mpic++
+MFC=mpifort
+
+# This Makefile will build ALL automatically, but not VTK. That is assumed to
+# be available in $(VTK_DIR). It can be built automatically by reproducing the
+# way ALL is included. In general, changes to the library do not trigger a
+# rebuild, so in those cases, you need to run `make clean-ext-liball`
+# explicitly to trigger the rebuild.
+#
+# This Makefile also enables the Voronoi and VTK features of ALL. If these are
+# not necessary, you can remove the corresponding lines.
+
+ALL_DIR=all_bin
+VTK_DIR=vtk_bin
+
+ALL_BUILD=all_build
+ALL_SOURCE=all
+ALL_SOURCE=../..
+
+LIBALL_INCLUDE := -I$(ALL_DIR)/include/modules -I$(ALL_DIR)/include
+LIBALL_LIB := $(ALL_DIR)/lib/libALL_fortran.a $(ALL_DIR)/lib/libALL.a
+LIBALL_LIB += $(ALL_DIR)/lib/libvoro.a
+LIBALL_CONFIG_FILE := $(ALL_DIR)/lib/cmake/ALL/ALLConfig.cmake
+LIBALL_DEFINES += -DALL_VTK_OUTPUT -DALL_VORONOI_ACTIVE
+
+LIBALL_CONFIGURE := -DCM_ALL_FORTRAN=ON -DCM_ALL_VORONOI=ON -DCM_ALL_VTK_OUTPUT=ON -DCMAKE_BUILD_TYPE=Release
+
+# Since gfortran does not link the standard C++ library by default, we need to
+# explicitly state it.
+FFLAGS += -lstdc++
+
+FLAGS += -DTEST_VTK_OUTPUT -DTEST_VORONOI
+FLAGS += $(LIBALL_DEFINES)
+
+# The linking order of VTK can be gleaned from the CMake invocation of any
+# executable of the library. Just compile the library using `VERBOSE=1` and the
+# command lines are output as well.
+VTK_INCLUDE := -I$(VTK_DIR)/include/vtk-7.1
+VTK_LIB := $(subst lib/,$(VTK_DIR)/lib/, lib/libvtkFiltersProgrammable-7.1.a lib/libvtkIOParallelXML-7.1.a lib/libvtkIOXML-7.1.a lib/libvtkIOXMLParser-7.1.a lib/libvtkexpat-7.1.a lib/libvtkParallelMPI-7.1.a lib/libvtkParallelCore-7.1.a lib/libvtkIOLegacy-7.1.a lib/libvtkIOCore-7.1.a lib/libvtkCommonExecutionModel-7.1.a lib/libvtkCommonDataModel-7.1.a lib/libvtkCommonTransforms-7.1.a lib/libvtkCommonMisc-7.1.a lib/libvtkCommonMath-7.1.a lib/libvtkCommonSystem-7.1.a lib/libvtkCommonCore-7.1.a lib/libvtksys-7.1.a -ldl -lpthread lib/libvtkzlib-7.1.a)
+
+INCLUDES += $(LIBALL_INCLUDE)
+INCLUDES += $(VTK_INCLUDE)
+LIBS += $(LIBALL_LIB) $(VTK_LIB)
+
+.PHONY: all clean clean-ext clean-ext-liball
+
+all: ALL_Staggered ALL_Staggered_f ALL_test
+
+clean:
+	rm -rf ALL_Staggered ALL_Staggered_f ALL_test.cpp ALL_test
+
+clean-ext: clean-ext-liball
+
+clean-ext-liball:
+	rm -rf $(ALL_BUILD) $(ALL_DIR)
+
+# Our projects executables:
+ALL_Staggered: ALL_Staggered.cpp $(LIBALL_CONFIG_FILE)
+	$(MCXX) $(FLAGS) $(CXXFLAGS) $(INCLUDES) $< $(LIBS) -o $@
+
+ALL_Staggered_f: ALL_Staggered_f.F90 $(LIBALL_CONFIG_FILE)
+	$(MFC) $(FLAGS) $(FFLAGS) $(INCLUDES) $< $(LIBS) -o $@
+
+ALL_test.cpp: ALL_test_src.cpp
+	$(shell cat $< | sed -e 's/ALL_VTK_OUTPUT/TEST_VTK_OUTPUT/' -e 's/ALL_VORONOI_ACTIVE/TEST_VORONOI/' > $@)
+
+ALL_test: ALL_test.cpp $(LIBALL_CONFIG_FILE)
+	$(MCXX) $(FLAGS) $(CXXFLAGS) $(INCLUDES) $< $(LIBS) -o $@
+
+# The library part follows:
+$(LIBALL_CONFIG_FILE):
+	rm -rf $(ALL_BUILD)
+	mkdir -p $(ALL_BUILD)
+	CC=$(CC) CXX=$(CXX) FC=$(FC) VTK_DIR=$(VTK_DIR)/lib/cmake/vtk-7.1 cmake -S $(ALL_SOURCE) -B $(ALL_BUILD)  -DCMAKE_INSTALL_PREFIX=`pwd`/$(ALL_DIR) $(LIBALL_CONFIGURE)
+	cmake --build $(ALL_BUILD)
+	rm -rf $(ALL_DIR)
+	cmake --install $(ALL_BUILD)
diff --git a/misc/preprocess.sh b/misc/preprocess.sh
new file mode 100755
index 0000000000000000000000000000000000000000..7864756e2170170f6ceb887b159cc065aca9e9ac
--- /dev/null
+++ b/misc/preprocess.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+# Usage:
+# $1: path to include directory
+# $2: output file
+# $3..: additional defines (without -D)
+
+# Either run this script in the include directory, or pass the include
+# directory as an additional argument ($1).
+
+set -euo pipefail
+
+set -x
+
+HEADERS="ALL_CustomExceptions.hpp
+ALL_Defines.h
+ALL_ForceBased.hpp
+ALL_Functions.hpp
+ALL_Histogram.hpp
+ALL.hpp
+ALL_LB.hpp
+ALL_Point.hpp
+ALL_Staggered.hpp
+ALL_Tensor.hpp
+ALL_Voronoi.hpp"
+
+PROCESSED_DIR=`mktemp -d`
+
+CWD=`pwd`
+cd "$1"
+if [[ ${2:0:1} == / ]]
+then
+	OUTFILE="$2"
+else
+	OUTFILE="$CWD/$2"
+fi
+shift
+shift
+
+for f in $HEADERS
+do
+	cat $f | sed -e 's!#\s*include\s*<!// PPIGNORE <!' > "$PROCESSED_DIR/$f"
+done
+
+cd "$PROCESSED_DIR"
+
+DEFINES=
+for d in "$@"
+do
+	DEFINES="$DEFINES -D$d"
+done
+
+cpp -undef -fdirectives-only $DEFINES -o ALL.ii ALL.hpp
+
+mkdir -p "${OUTFILE%/*}"
+cat ALL.ii | sed -e 's!// PPIGNORE <!#include <!' > "$OUTFILE"
+
+rm -rf $PROCESSED_DIR
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 283e2ceda34219ea46a2329e62030ce9215a6b0a..9d7cf93bb871d897a82646c949875f1e3d167d6c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,59 +1,65 @@
-set(ALL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
-set(ALL_HEADER_FILES ${ALL_INCLUDE_DIR}/ALL.hpp
-                     ${ALL_INCLUDE_DIR}/ALL_LB.hpp
-                     ${ALL_INCLUDE_DIR}/ALL_Functions.hpp
-                     ${ALL_INCLUDE_DIR}/ALL_Histogram.hpp
-                     ${ALL_INCLUDE_DIR}/ALL_Staggered.hpp
-                     ${ALL_INCLUDE_DIR}/ALL_Tensor.hpp
-                     ${ALL_INCLUDE_DIR}/ALL_ForceBased.hpp
-                     ${ALL_INCLUDE_DIR}/ALL_Voronoi.hpp
-                     ${ALL_INCLUDE_DIR}/ALL_Point.hpp
-                     ${ALL_INCLUDE_DIR}/ALL_CustomExceptions.hpp)
-
+set(ALL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../include)
+set(ALL_HEADER_FILES
+    ${ALL_INCLUDE_DIR}/ALL_CustomExceptions.hpp
+    ${ALL_INCLUDE_DIR}/ALL_Defines.h
+    ${ALL_INCLUDE_DIR}/ALL_ForceBased.hpp
+    ${ALL_INCLUDE_DIR}/ALL_Functions.hpp
+    ${ALL_INCLUDE_DIR}/ALL_Histogram.hpp
+    ${ALL_INCLUDE_DIR}/ALL.hpp
+    ${ALL_INCLUDE_DIR}/ALL_LB.hpp
+    ${ALL_INCLUDE_DIR}/ALL_Point.hpp
+    ${ALL_INCLUDE_DIR}/ALL_Staggered.hpp
+    ${ALL_INCLUDE_DIR}/ALL_Tensor.hpp
+    ${ALL_INCLUDE_DIR}/ALL_Voronoi.hpp)
 
 add_library (ALL ALL.cpp ALL_fortran.cpp ${ALL_HEADER_FILES})
 
 if(CM_ALL_VTK_OUTPUT)
     target_include_directories(ALL PUBLIC ${VTK_INCLUDE_DIRS})
     target_link_libraries(ALL PUBLIC ${VTK_LIBRARIES})
+    target_compile_definitions(ALL PUBLIC ALL_VTK_OUTPUT)
 endif(CM_ALL_VTK_OUTPUT)
 if(CM_ALL_VORONOI)
-    target_include_directories(ALL PUBLIC ${CM_ALL_VORO_INC})
-    target_link_libraries(ALL PUBLIC ${CM_ALL_VORO_LIB})
+    target_link_libraries(ALL PUBLIC voro)
+    target_compile_definitions(ALL PUBLIC ALL_VORONOI_ACTIVE)
 endif(CM_ALL_VORONOI)
 
 target_include_directories(ALL PUBLIC ${MPI_CXX_INCLUDE_PATH})
-target_include_directories (ALL PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${ALL_INCLUDE_DIR})
 target_link_libraries(ALL PUBLIC ${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES})
+target_include_directories (ALL
+    PUBLIC
+    "$<BUILD_INTERFACE:${ALL_INCLUDE_DIR}>"
+    "$<INSTALL_INTERFACE:include>")
 
-install(TARGETS ALL 
-        RUNTIME DESTINATION bin
-        LIBRARY DESTINATION lib
-        ARCHIVE DESTINATION lib
-        INCLUDES DESTINATION include)
+# For inclusion in Fortran code, explicit linking against the C++ standard
+# library is necessary.
+target_link_libraries(ALL INTERFACE stdc++)
+
+install(TARGETS ALL
+    EXPORT ALLTargets
+    RUNTIME DESTINATION bin
+    LIBRARY DESTINATION lib
+    ARCHIVE DESTINATION lib
+    INCLUDES DESTINATION include)
 
 install(FILES ${ALL_HEADER_FILES}
-        DESTINATION include)
+    DESTINATION include)
 
 if (CM_ALL_FORTRAN)
-    set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/modules)
+    set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../modules)
     add_library (ALL_fortran ALL_module.F90)
     set_property(TARGET ALL_fortran PROPERTY LINKER_LANGUAGE Fortran)
 
-    if(CM_ALL_VTK_OUTPUT)
-        target_include_directories(ALL_fortran PUBLIC ${VTK_INCLUDE_DIRS})
-        target_link_libraries(ALL_fortran PUBLIC ${VTK_LIBRARIES})
-    endif(CM_ALL_VTK_OUTPUT)
-    #if(CM_ALL_VORONOI)
-    #    target_include_directories(ALL_fortran PUBLIC ${CM_ALL_VORO_INC})
-    #    target_link_libraries(ALL_fortran PUBLIC ${CM_ALL_VORO_LIB})
-    #endif(CM_ALL_VORONOI)
-
     target_include_directories(ALL_fortran PUBLIC ${MPI_Fortran_INCLUDE_PATH})
-    target_include_directories(ALL_fortran PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${ALL_INCLUDE_DIR})
-    target_link_libraries(ALL_fortran PUBLIC ${MPI_Fortran_LINK_FLAGS} ${MPI_Fortran_LIBRARIES} ALL)
+    target_include_directories(ALL_fortran
+        INTERFACE
+        "$<BUILD_INTERFACE:${CMAKE_Fortran_MODULE_DIRECTORY}>"
+        "$<INSTALL_INTERFACE:include/modules>")
+    target_link_libraries(ALL_fortran PUBLIC ${MPI_Fortran_LINK_FLAGS} ${MPI_Fortran_LIBRARIES})
+    target_link_libraries(ALL_fortran PUBLIC ALL)
 
-    install(TARGETS ALL_fortran 
+    install(TARGETS ALL_fortran
+        EXPORT ALLTargets
         RUNTIME DESTINATION bin
         LIBRARY DESTINATION lib
         ARCHIVE DESTINATION lib
@@ -66,11 +72,12 @@ add_executable(Amalgamate Amalgamate.c)
 target_include_directories(Amalgamate PRIVATE ${STB_INCLUDE_DIR})
 set(AMALGAMATED_FILENAME ALL_Amalgamated.hpp)
 add_custom_command(
-	TARGET ALL
-	POST_BUILD
-	COMMAND $<TARGET_FILE:Amalgamate> ${ALL_INCLUDE_DIR}/ALL.hpp ${ALL_INCLUDE_DIR} > ${AMALGAMATED_FILENAME}
-	)
+    TARGET ALL
+    POST_BUILD
+    COMMAND $<TARGET_FILE:Amalgamate> ${ALL_INCLUDE_DIR}/ALL.hpp ${ALL_INCLUDE_DIR} > ${AMALGAMATED_FILENAME}
+    )
 install(
-	FILES ${CMAKE_CURRENT_BINARY_DIR}/${AMALGAMATED_FILENAME}
-	TYPE INCLUDE
-	)
+    FILES ${CMAKE_CURRENT_BINARY_DIR}/${AMALGAMATED_FILENAME}
+    TYPE INCLUDE
+    )
+# vim: sw=4 ts=4 et