--- MapServer-rel-8-4-0.orig/CMakeLists.txt	2025-02-09 18:26:44.802057700 +0300
+++ MapServer-rel-8-4-0/CMakeLists.txt	2025-02-09 18:28:40.502936000 +0300
@@ -392,6 +392,12 @@
     VERSION ${MapServer_VERSION_STRING}
     SOVERSION 2
 )
+  if(WIN32)
+    find_package(dlfcn-win32 CONFIG QUIET)
+    if(TARGET dlfcn-win32::dl)
+      target_link_libraries(mapserver PRIVATE dlfcn-win32::dl)
+    endif()
+  endif()
 endif(BUILD_DYNAMIC)
 
 if(BUILD_STATIC)
