From 28c6ad5116135b884aa23435364ed4ee19c6b9a2 Mon Sep 17 00:00:00 2001
From: "TESLA01\\soerenpeters" <peters@irmb.tu-bs.de>
Date: Wed, 9 Dec 2020 12:51:37 +0100
Subject: [PATCH] Set the CMAKE_MSVC_RUNTIME_LIBRARY

---
 CMakeLists.txt                           | 12 ++++++++++--
 src/gpu/VirtualFluids_GPU/CMakeLists.txt |  2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 50073d8a0..1fd7dfff1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,8 +8,9 @@
 #################################################################################
 #  required cmake versions
 #  CMAKE 3.13: target_link_options
+#  CMAKE 3.15: CMAKE_MSVC_RUNTIME_LIBRARY
 #################################################################################
-cmake_minimum_required(VERSION 3.13..3.18 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.15..3.18 FATAL_ERROR)
 
 project(VirtualFluids CXX)
 
@@ -43,7 +44,14 @@ option(BUILD_VF_INCLUDE_WHAT_YOU_USE "Add IWYU to the targets" OFF)
 option(BUILD_VF_CPPCHECK "Add cppcheck to the targets" OFF)
 option(BUILD_VF_COVERAGE "Add the -coverage compiler flag." OFF)
 
-option(BUILD_SHARED_LIBS "" ON)
+option(BUILD_SHARED_LIBS "" OFF)
+
+# windows: use multi-threaded dynamically-linked runtime library
+if(BUILD_SHARED_LIBS)
+    set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
+else()
+    set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+endif()
 
 option(USE_OPENMP "Include OpenMP support" ON)
 
diff --git a/src/gpu/VirtualFluids_GPU/CMakeLists.txt b/src/gpu/VirtualFluids_GPU/CMakeLists.txt
index 6635323c8..f533c3799 100644
--- a/src/gpu/VirtualFluids_GPU/CMakeLists.txt
+++ b/src/gpu/VirtualFluids_GPU/CMakeLists.txt
@@ -7,7 +7,7 @@ ELSE(MSVC)
 ENDIF(MSVC)
 
 
-vf_add_library(BUILDTYPE shared PRIVATE_LINK ${libsToLink})
+vf_add_library(PRIVATE_LINK ${libsToLink})
 
 linkMPI()
 linkCUDA()
-- 
GitLab