From 629105b2eddf6092eb18f786320ff8b60722b890 Mon Sep 17 00:00:00 2001
From: Soeren Peters <soe.peters@tu-braunschweig.de>
Date: Mon, 13 Sep 2021 12:53:14 +0200
Subject: [PATCH] Make boost optional for all user. When BUILD_USE_BOOST is
 enabled cmake will look for the boost header only libraries. Afterwards boost
 needs to be linked to the required library. e.g: if(BUILD_USE_BOOST)    
 target_link_libraries(${library_name} PRIVATE Boost::boost) endif()

---
 CMakeLists.txt | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3261fe860..7796c73f8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,7 +46,7 @@ option(BUILD_VF_CPU "Build VirtualFluids cpu variant" OFF)
 option(BUILD_VF_GPU "Build VirtualFluids gpu variant" OFF)
 
 option(BUILD_USE_OPENMP "Build VirtualFluids with openmp" ON)
-
+option(BUILD_USE_BOOST "Build VirtualFluids with boost" OFF)
 
 # vf gpu
 option(BUILD_VF_GPU          "Build VirtualFluids GPU"     ON )
@@ -166,6 +166,19 @@ endif()
 
 find_package(MPI REQUIRED)
 
+# boost
+IF(BUILD_USE_BOOST)
+    list(APPEND VF_COMPILER_DEFINITION BUILD_USE_BOOST)
+
+    set(Boost_USE_STATIC_LIBS ON)
+    set(Boost_USE_MULTITHREADED ON)
+    set(Boost_USE_STATIC_RUNTIME ON)
+
+    # minimum boost version: 1.60
+    # no packages specfied - only headeronly libraries
+    find_package(Boost 1.60 REQUIRED)
+ENDIF()
+
 add_subdirectory(src/logger)
 add_subdirectory(src/basics)
 #add_subdirectory(src/mpi)
-- 
GitLab