From 7c4adfa3bb93cdb7f8f4e04c7ac745b8c7d6a822 Mon Sep 17 00:00:00 2001
From: Oliver Sander <oliver.sander@tu-dresden.de>
Date: Fri, 26 Oct 2018 20:50:17 +0200
Subject: [PATCH] Move 2bcontact.cc to newly created directory 'src'

'src' is where Dune modules are expected to have these files.
---
 CHANGELOG.md                     |  7 +++++++
 CMakeLists.txt                   |  4 +---
 2bcontact.cc => src/2bcontact.cc |  0
 src/CMakeLists.txt               | 16 ++++++++++++++++
 4 files changed, 24 insertions(+), 3 deletions(-)
 rename 2bcontact.cc => src/2bcontact.cc (100%)
 create mode 100644 src/CMakeLists.txt

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 54432ccd..50e68ba7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+Changes in dune-contact v2.6.0
+==============================
+
+* There is now a subdirectory `src`, and some of the compilable source code
+  files have moved there.  This makes `dune-contact` more consistent with
+  other Dune modules.
+
 Changes in dune-contact v2.5.0
 ==============================
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e554fa9c..cd1ee0a6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,13 +13,11 @@ dune_project()
 
 add_subdirectory(doc)
 add_subdirectory(dune)
+add_subdirectory(src)
 add_subdirectory(test)
 dune_symlink_to_source_files(FILES resources)
 
 set(programs "")
-if(HAVE_AMIRAMESH)
-  list(APPEND programs 2bcontact)
-endif()
 if(HAVE_AMIRAMESH AND HAVE_IPOPT)
   list(APPEND programs 1badaptmeasure 1bcontact het2bcontact 2bnonlincontact 2bmgnonlincontact)
 endif()
diff --git a/2bcontact.cc b/src/2bcontact.cc
similarity index 100%
rename from 2bcontact.cc
rename to src/2bcontact.cc
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 00000000..d08c09cf
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,16 @@
+set(programs "")
+#if(HAVE_AMIRAMESH)
+  list(APPEND programs 2bcontact)
+#endif()
+
+foreach(_program ${programs})
+  add_executable(${_program} ${_program}.cc)
+  target_link_dune_default_libraries(${_program})
+  add_dune_amiramesh_flags(${_program})
+  add_dune_ipopt_flags(${_program})
+  add_dune_ug_flags(${_program})
+  add_dune_psurface_flags(${_program})
+  add_dune_mpi_flags(${_program})
+  target_compile_options(${_program} PRIVATE "-fpermissive")
+endforeach()
+
-- 
GitLab