From b58930c8f656310f4c5326cd26875cc6c8882833 Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Fri, 14 Nov 2014 15:58:43 +0000
Subject: [PATCH] Add a template cmake build system

[[Imported from SVN: r9971]]
---
 CMakeLists.txt                    | 28 ++++++++++++++++++++++++++++
 cmake/modules/CMakeLists.txt      |  3 +++
 cmake/modules/DuneGfeMacros.cmake |  1 +
 doc/CMakeLists.txt                |  1 +
 doc/doxygen/CMakeLists.txt        |  2 ++
 dune/CMakeLists.txt               |  1 +
 dune/gfe/CMakeLists.txt           |  3 +++
 7 files changed, 39 insertions(+)
 create mode 100644 CMakeLists.txt
 create mode 100644 cmake/modules/CMakeLists.txt
 create mode 100644 cmake/modules/DuneGfeMacros.cmake
 create mode 100644 doc/CMakeLists.txt
 create mode 100644 doc/doxygen/CMakeLists.txt
 create mode 100644 dune/CMakeLists.txt
 create mode 100644 dune/gfe/CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 00000000..edb3f142
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,28 @@
+cmake_minimum_required(VERSION 2.8.6)
+project(dune-gfe CXX)
+
+if(NOT (dune-common_DIR OR dune-common_ROOT OR
+      "${CMAKE_PREFIX_PATH}" MATCHES ".*dune-common.*"))
+    string(REPLACE  ${CMAKE_PROJECT_NAME} dune-common dune-common_DIR
+      ${PROJECT_BINARY_DIR})
+endif()
+
+#find dune-common and set the module path
+find_package(dune-common REQUIRED)
+list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules"
+  ${dune-common_MODULE_PATH})
+
+#include the dune macros
+include(DuneMacros)
+
+# start a dune project with information from dune.module
+dune_project()
+
+add_subdirectory("src")
+add_subdirectory("m4")
+add_subdirectory("dune")
+add_subdirectory("doc")
+add_subdirectory("cmake/modules")
+
+# finalize the dune project, e.g. generating config.h etc.
+finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
new file mode 100644
index 00000000..34ddc41d
--- /dev/null
+++ b/cmake/modules/CMakeLists.txt
@@ -0,0 +1,3 @@
+set(modules "DuneGfeMacros.cmake")
+
+install(FILES ${modules} DESTINATION ${DUNE_INSTALL_MODULEDIR})
diff --git a/cmake/modules/DuneGfeMacros.cmake b/cmake/modules/DuneGfeMacros.cmake
new file mode 100644
index 00000000..613dfb66
--- /dev/null
+++ b/cmake/modules/DuneGfeMacros.cmake
@@ -0,0 +1 @@
+# File for module specific CMake tests.
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
new file mode 100644
index 00000000..be52cfcc
--- /dev/null
+++ b/doc/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory("doxygen")
diff --git a/doc/doxygen/CMakeLists.txt b/doc/doxygen/CMakeLists.txt
new file mode 100644
index 00000000..f7b8ea5c
--- /dev/null
+++ b/doc/doxygen/CMakeLists.txt
@@ -0,0 +1,2 @@
+# shortcut for creating the Doxyfile.in and Doxyfile
+add_doxygen_target()
diff --git a/dune/CMakeLists.txt b/dune/CMakeLists.txt
new file mode 100644
index 00000000..d7f4cb29
--- /dev/null
+++ b/dune/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(gfe)
diff --git a/dune/gfe/CMakeLists.txt b/dune/gfe/CMakeLists.txt
new file mode 100644
index 00000000..7ffd4e92
--- /dev/null
+++ b/dune/gfe/CMakeLists.txt
@@ -0,0 +1,3 @@
+#install headers
+install(FILES gfe.hh DESTINATION include/dune/gfe)
+
-- 
GitLab