--- curl-8.16.0/lib/CMakeLists.txt.orig	2025-09-10 07:43:43.000000000 +0200
+++ curl-8.16.0/lib/CMakeLists.txt	2025-09-10 14:50:47.894311500 +0200
@@ -25,6 +25,7 @@
 set(LIBCURL_OUTPUT_NAME "${LIB_NAME}" CACHE STRING "Basename of the curl library")
 
 set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${CURL_DEBUG_MACROS} "BUILDING_LIBCURL")
+set(CURL_BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
 
 configure_file("curl_config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/curl_config.h")
 
@@ -58,6 +59,8 @@
   add_custom_target(curlu-unitprotos DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/unitprotos.h")
 endif()
 
+set_source_files_properties(pathtools.c PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
+
 ## Library definition
 
 if(NOT DEFINED IMPORT_LIB_SUFFIX)
--- a/lib/curl_config.h.cmake
+++ b/lib/curl_config.h.cmake
@@ -35,6 +35,9 @@
 /* Default SSL backend */
 #cmakedefine CURL_DEFAULT_SSL_BACKEND "${CURL_DEFAULT_SSL_BACKEND}"
 
+/* Location of executable */
+#cmakedefine CURL_BINDIR "${CURL_BINDIR}"
+
 /* disables alt-svc */
 #cmakedefine CURL_DISABLE_ALTSVC 1
 
--- a/lib/Makefile.inc
+++ b/lib/Makefile.inc
@@ -197,6 +197,7 @@
   noproxy.c          \
   openldap.c         \
   parsedate.c        \
+  pathtools.c        \
   pingpong.c         \
   pop3.c             \
   progress.c         \
@@ -333,6 +334,7 @@
   nonblock.h         \
   noproxy.h          \
   parsedate.h        \
+  pathtools.h        \
   pingpong.h         \
   pop3.h             \
   progress.h         \
--- curl-8.17.0/lib/vtls/vtls.c.orig	2025-11-05 08:00:46.000000000 +0100
+++ curl-8.17.0/lib/vtls/vtls.c	2025-11-05 19:38:33.104185800 +0100
@@ -85,6 +85,9 @@
 #include "../curl_memory.h"
 #include "../memdebug.h"
 
+#if defined(__MINGW32__)
+#include "../pathtools.h"
+#endif
 
 #define CLONE_STRING(var)                    \
   do {                                       \
@@ -306,7 +309,13 @@
 #endif
 #ifdef CURL_CA_PATH
     if(!sslc->custom_capath && !set->str[STRING_SSL_CAPATH]) {
+#if defined(__MINGW32__)
+    char *relocated_ca_path = single_path_relocation_lib(CURL_BINDIR, CURL_CA_PATH);
+    result = Curl_setstropt(&set->str[STRING_SSL_CAPATH], relocated_ca_path);
+    free(relocated_ca_path);
+#else
       result = Curl_setstropt(&set->str[STRING_SSL_CAPATH], CURL_CA_PATH);
+#endif /* defined(__MINGW32__) */
       if(result)
         return result;
     }
@@ -314,7 +323,13 @@
 #endif
 #ifdef CURL_CA_BUNDLE
     if(!sslc->custom_cafile && !set->str[STRING_SSL_CAFILE]) {
+#if defined(__MINGW32__)
+    char *relocated_bundle = single_path_relocation_lib(CURL_BINDIR, CURL_CA_BUNDLE);
+    result = Curl_setstropt(&set->str[STRING_SSL_CAFILE], relocated_bundle);
+    free(relocated_bundle);
+#else
       result = Curl_setstropt(&set->str[STRING_SSL_CAFILE], CURL_CA_BUNDLE);
+#endif /* defined(__MINGW32__) */
       if(result)
         return result;
     }
@@ -353,8 +368,14 @@
 #endif
 #ifdef CURL_CA_PATH
     if(!sslc->custom_capath && !set->str[STRING_SSL_CAPATH_PROXY]) {
+#if defined(__MINGW32__)
+    char *relocated_ca_path = single_path_relocation_lib(CURL_BINDIR, CURL_CA_PATH);
+    result = Curl_setstropt(&set->str[STRING_SSL_CAPATH_PROXY], relocated_ca_path);
+    free(relocated_ca_path);
+#else
       result = Curl_setstropt(&set->str[STRING_SSL_CAPATH_PROXY],
                               CURL_CA_PATH);
+#endif /* defined(__MINGW32__) */
       if(result)
         return result;
     }
@@ -362,8 +383,15 @@
 #endif
 #ifdef CURL_CA_BUNDLE
     if(!sslc->custom_cafile && !set->str[STRING_SSL_CAFILE_PROXY]) {
+#if defined(__MINGW32__)
+    char *relocated_bundle = single_path_relocation_lib(CURL_BINDIR, CURL_CA_BUNDLE);
+    result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_PROXY],
+                            relocated_bundle);
+    free(relocated_bundle);
+#else
       result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_PROXY],
                               CURL_CA_BUNDLE);
+#endif
       if(result)
         return result;
     }
