From 34896d4f98d9520b71cc74b0e149d1fc4035f55d Mon Sep 17 00:00:00 2001
From: Frederik Hennig <frederik.hennig@fau.de>
Date: Tue, 10 Dec 2024 16:36:17 +0100
Subject: [PATCH] started CMake setup for examples

---
 .gitignore              | 3 +++
 CMakeLists.txt          | 8 +++++++-
 examples/CMakeLists.txt | 8 ++++++++
 3 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 examples/CMakeLists.txt

diff --git a/.gitignore b/.gitignore
index ef18ef2..c970c0e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,5 +21,8 @@ dist
 htmlcov
 coverage.xml                
 
+# cmake
+CMakeUserPresets.json
+
 # scratch
 scratch
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bab7c8f..f02698b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,9 @@
 cmake_minimum_required( VERSION 3.24 )
 project ( sfg-walberla )
 
-SET ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
+option( SFG_WALBERLA_BUILD_EXAMPLES "Build sfg-walberla's examples" OFF )
+
+list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
 find_package( PystencilsSfg REQUIRED )
 
 add_library( sfg_walberla INTERFACE )
@@ -17,3 +19,7 @@ target_link_libraries(
     INTERFACE
     core stencil domain_decomposition blockforest field
 )
+
+if( ${SFG_WALBERLA_BUILD_EXAMPLES} )
+    add_subdirectory( examples )
+endif()
\ No newline at end of file
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
new file mode 100644
index 0000000..4b5db3b
--- /dev/null
+++ b/examples/CMakeLists.txt
@@ -0,0 +1,8 @@
+include(FetchContent)
+
+FetchContent_Declare(
+    walberla
+    GIT_REPOSITORY https://i10git.cs.fau.de/walberla/walberla.git
+)
+
+FetchContent_MakeAvailable(walberla)
-- 
GitLab