From a22977e0e1ebd31bc52861e09e2dfac96830f2de Mon Sep 17 00:00:00 2001
From: Joaquim <jmfluis@gmail.com>
Date: Sun, 2 Aug 2026 23:21:39 +0100
Subject: [PATCH] Restrict the build of gmt_update to Windows only. (#9120)

Apply the patch use in the Debion build (see #9116)
---
 src/CMakeLists.txt | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1d9a682fa39..c379a0b996f 100644
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -603,16 +603,19 @@ target_link_libraries (gshhg_version ${NETCDF_LIBRARIES})
 # script2verbatim for removing comments, replacing -ps from example scripts
 add_executable (script2verbatim script2verbatim.c)
 
-# gmt_update — standalone binary updater. Deliberately does NOT link against
-# libgmt/pslib so that those DLLs are NOT held open by this process and can be
-# replaced on Windows. Uses only libcurl + an embedded public-domain SHA-256.
-add_executable (gmt_update gmt_update.c sha256.c)
-target_include_directories (gmt_update PRIVATE ${CURL_INCLUDE_DIRS})
-target_link_libraries (gmt_update ${CURL_LIBRARIES})
-if (WIN32)
-	target_link_libraries (gmt_update rstrtmgr)
-endif (WIN32)
-install (TARGETS gmt_update RUNTIME DESTINATION ${GMT_BINDIR} COMPONENT Runtime)
+option(WITH_GMT_UPDATE "Build and install gmt_update executable" ON)
+if (WITH_GMT_UPDATE)
+	# gmt_update — standalone binary updater. Deliberately does NOT link against
+	# libgmt/pslib so that those DLLs are NOT held open by this process and can be
+	# replaced on Windows. Uses only libcurl + an embedded public-domain SHA-256.
+	add_executable (gmt_update gmt_update.c sha256.c)
+	target_include_directories (gmt_update PRIVATE ${CURL_INCLUDE_DIRS})
+	target_link_libraries (gmt_update ${CURL_LIBRARIES})
+	if (WIN32)
+		target_link_libraries (gmt_update rstrtmgr)
+	endif (WIN32)
+	install (TARGETS gmt_update RUNTIME DESTINATION ${GMT_BINDIR} COMPONENT Runtime)
+endif()
 
 
 ##

From d52a1e5825b73c3ad6948efce1ac8eeff01c2c93 Mon Sep 17 00:00:00 2001
From: Joaquim <jmfluis@gmail.com>
Date: Mon, 3 Aug 2026 00:13:59 +0100
Subject: [PATCH] Limit the compilation of gmt_update to MSVC only (#9121)

(Still having troubles to make it compile in Yggdrasil (for Julia))
---
 src/CMakeLists.txt | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c379a0b996f..781ba594265 100644
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -603,18 +603,20 @@ target_link_libraries (gshhg_version ${NETCDF_LIBRARIES})
 # script2verbatim for removing comments, replacing -ps from example scripts
 add_executable (script2verbatim script2verbatim.c)
 
-option(WITH_GMT_UPDATE "Build and install gmt_update executable" ON)
-if (WITH_GMT_UPDATE)
-	# gmt_update — standalone binary updater. Deliberately does NOT link against
-	# libgmt/pslib so that those DLLs are NOT held open by this process and can be
-	# replaced on Windows. Uses only libcurl + an embedded public-domain SHA-256.
-	add_executable (gmt_update gmt_update.c sha256.c)
-	target_include_directories (gmt_update PRIVATE ${CURL_INCLUDE_DIRS})
-	target_link_libraries (gmt_update ${CURL_LIBRARIES})
-	if (WIN32)
-		target_link_libraries (gmt_update rstrtmgr)
-	endif (WIN32)
-	install (TARGETS gmt_update RUNTIME DESTINATION ${GMT_BINDIR} COMPONENT Runtime)
+if (MSVC)
+	option(WITH_GMT_UPDATE "Build and install gmt_update executable" ON)
+	if (WITH_GMT_UPDATE)
+		# gmt_update — standalone binary updater. Deliberately does NOT link against
+		# libgmt/pslib so that those DLLs are NOT held open by this process and can be
+		# replaced on Windows. Uses only libcurl + an embedded public-domain SHA-256.
+		add_executable (gmt_update gmt_update.c sha256.c)
+		target_include_directories (gmt_update PRIVATE ${CURL_INCLUDE_DIRS})
+		target_link_libraries (gmt_update ${CURL_LIBRARIES})
+		if (WIN32)
+			target_link_libraries (gmt_update rstrtmgr)
+		endif (WIN32)
+		install (TARGETS gmt_update RUNTIME DESTINATION ${GMT_BINDIR} COMPONENT Runtime)
+	endif()
 endif()
 
 
