From ac90b262a93eeb49787489353bb381348464ab6c Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Fri, 9 Sep 2022 13:18:58 +0200
Subject: [PATCH] [cmake] Enable BUILD_SHARED_LIBS=ON on Windows.

---
 scripts/cmake/Dependencies.cmake | 1 +
 scripts/cmake/MetisSetup.cmake   | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/cmake/Dependencies.cmake b/scripts/cmake/Dependencies.cmake
index 5a37639f28a..f891daaf0e8 100644
--- a/scripts/cmake/Dependencies.cmake
+++ b/scripts/cmake/Dependencies.cmake
@@ -181,6 +181,7 @@ if(OGS_BUILD_SWMM)
     CPMAddPackage(
         NAME SWMMInterface GITHUB_REPOSITORY ufz/SwmmInterface
         GIT_TAG 141e05ae1f419918799d7bf9178ebcd97feb1ed3
+        OPTIONS "BUILD_SHARED_LIBS OFF"
     )
     if(SWMMInterface_ADDED)
         target_include_directories(
diff --git a/scripts/cmake/MetisSetup.cmake b/scripts/cmake/MetisSetup.cmake
index 6c6fde90cae..73131168b26 100644
--- a/scripts/cmake/MetisSetup.cmake
+++ b/scripts/cmake/MetisSetup.cmake
@@ -10,7 +10,10 @@ include(${GKLIB_PATH}/GKlibSystem.cmake)
 
 # Metis library
 file(GLOB _metis_sources ${metis_SOURCE_DIR}/libmetis/*.c)
-ogs_add_library(ogs_metis ${GKlib_sources} ${_metis_sources})
+if(WIN32)
+    set(_metis_static STATIC)
+endif()
+ogs_add_library(ogs_metis ${_metis_static} ${GKlib_sources} ${_metis_sources})
 target_compile_definitions(ogs_metis PUBLIC USE_GKREGEX)
 target_include_directories(
     ogs_metis PUBLIC ${metis_SOURCE_DIR}/GKlib ${metis_SOURCE_DIR}/include
-- 
GitLab