From f5e017e53d5eaccc208901c3e3c3de3cb9a0fa30 Mon Sep 17 00:00:00 2001
From: Boris Basic <boris.basic@edf.fr>
Date: Thu, 15 Dec 2022 17:15:14 +0100
Subject: [PATCH] Update HDF5 to 1.10.9 and MED to 4.1.1

---
 build-telemac-deps.bat    |  10 +-
 patches/hdf5-1.10.8.patch | 321 --------------------------------------
 patches/med-4.1.0.patch   |  80 ----------
 patches/med-4.1.1.patch   |  42 +++++
 4 files changed, 47 insertions(+), 406 deletions(-)
 delete mode 100644 patches/hdf5-1.10.8.patch
 delete mode 100644 patches/med-4.1.0.patch
 create mode 100644 patches/med-4.1.1.patch

diff --git a/build-telemac-deps.bat b/build-telemac-deps.bat
index e783e82..cb2a68a 100644
--- a/build-telemac-deps.bat
+++ b/build-telemac-deps.bat
@@ -54,8 +54,8 @@ if not defined cmake_path (
 rem ***************************
 rem * Set dependency versions *
 rem ***************************
-set hdf5=hdf5-1.10.8
-set med=med-4.1.0
+set hdf5=hdf5-1.10.9
+set med=med-4.1.1
 set metis=metis-5.1.1
 set msmpi=msmpi-10.1.2
 set lapack=lapack-3.10.0
@@ -127,8 +127,8 @@ goto exit
 rem ********
 rem * HDF5 *
 rem ********
-call :download %hdf5% "https://www.hdfgroup.org/package/hdf5-1-10-8-zip/?wpdmdl=16060&refresh=61dee6661eab21641997926" || exit /b 1
-set cmake_config_options=-DHDF5_GENERATE_HEADERS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_BUILD_TOOLS:BOOL=OFF -DHDF5_BUILD_UTILS:BOOL=OFF -DHDF5_BUILD_HL_LIB:BOOL=OFF -DHDF5_BUILD_HL_TOOLS:BOOL=OFF
+call :download %hdf5% "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.9/src/hdf5-1.10.9.zip" || exit /b 1
+set cmake_config_options=-DONLY_SHARED_LIBS:BOOL=ON -DHDF5_GENERATE_HEADERS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_BUILD_TOOLS:BOOL=OFF -DHDF5_BUILD_UTILS:BOOL=OFF -DHDF5_BUILD_HL_LIB:BOOL=OFF -DHDF5_BUILD_HL_TOOLS:BOOL=OFF
 call :cmake_build %hdf5% || exit /b 1
 exit /b 0
 
@@ -136,7 +136,7 @@ exit /b 0
 rem *******
 rem * MED *
 rem *******
-call :download %med% "https://files.salome-platform.org/Salome/other/med-4.1.0.tar.gz" || exit /b 1
+call :download %med% "https://files.salome-platform.org/Salome/other/med-4.1.1.tar.gz" || exit /b 1
 set cmake_config_options=-DHDF5_ROOT_DIR:PATH=%install_path%/%hdf5% -DMEDFILE_BUILD_TESTS:BOOL=OFF -DMEDFILE_INSTALL_DOC:BOOL=OFF
 if %compiler% == intel (
   rem MED libraries cannot be built as shared libraries with Visual Studio generator as they
diff --git a/patches/hdf5-1.10.8.patch b/patches/hdf5-1.10.8.patch
deleted file mode 100644
index e355e6c..0000000
--- a/patches/hdf5-1.10.8.patch
+++ /dev/null
@@ -1,321 +0,0 @@
-diff -ur hdf5-1.10.8/CMakeFilters.cmake hdf5-1.10.8-patched/CMakeFilters.cmake
---- hdf5-1.10.8/CMakeFilters.cmake	2021-10-16 16:26:31.000000000 +0200
-+++ hdf5-1.10.8-patched/CMakeFilters.cmake	2022-01-07 00:01:45.079486100 +0100
-@@ -63,9 +63,9 @@
-       find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared)
-       if (NOT ZLIB_FOUND)
-         find_package (ZLIB) # Legacy find
--        if (ZLIB_FOUND)
--          set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES})
--        endif ()
-+      endif ()
-+      if (ZLIB_FOUND)
-+        set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES})
-       endif ()
-     endif ()
-     if (ZLIB_FOUND)
-@@ -115,9 +115,9 @@
-     if (USE_LIBAEC)
-       set(libaec_USE_STATIC_LIBS ${USE_LIBAEC_STATIC})
-       find_package (libaec 1.0.5 CONFIG)
--      if (SZIP_FOUND)
--        set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES})
--      endif ()
-+    endif ()
-+    if (SZIP_FOUND)
-+      set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES})
-     endif ()
- 
-     if (NOT SZIP_FOUND)
-diff -ur hdf5-1.10.8/config/cmake_ext_mod/HDFMacros.cmake hdf5-1.10.8-patched/config/cmake_ext_mod/HDFMacros.cmake
---- hdf5-1.10.8/config/cmake_ext_mod/HDFMacros.cmake	2021-10-22 06:44:51.000000000 +0200
-+++ hdf5-1.10.8-patched/config/cmake_ext_mod/HDFMacros.cmake	2022-01-11 22:47:32.227533500 +0100
-@@ -129,8 +129,12 @@
-       OUTPUT_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME}
-   )
- 
-+  if (MINGW)
-+    set_target_properties (${libtarget} PROPERTIES ARCHIVE_OUTPUT_NAME ${libname})
-+    set_target_properties (${libtarget} PROPERTIES RUNTIME_OUTPUT_NAME ${libname})
-+  endif () 
-   if (${libtype} MATCHES "STATIC")
--    if (WIN32)
-+    if (MSVC)
-       set_target_properties (${libtarget} PROPERTIES
-           COMPILE_PDB_NAME_DEBUG          ${LIB_DEBUG_NAME}
-           COMPILE_PDB_NAME_RELEASE        ${LIB_RELEASE_NAME}
-diff -ur hdf5-1.10.8/src/H5private.h hdf5-1.10.8-patched/src/H5private.h
---- hdf5-1.10.8/src/H5private.h	2021-10-21 15:42:56.000000000 +0200
-+++ hdf5-1.10.8-patched/src/H5private.h	2022-01-07 13:45:37.772646400 +0100
-@@ -43,11 +43,13 @@
- #include <sys/time.h>
- #endif
- #ifdef H5_HAVE_UNISTD_H
-+#include <unistd.h>
-+#include <sys/types.h>
-+#endif
- #ifdef H5_HAVE_PWD_H
- #include <pwd.h>
- #endif
--#include <unistd.h>
--#include <sys/types.h>
-+#ifdef H5_HAVE_WAITPID
- #include <sys/wait.h>
- #endif
- 
-diff -ur hdf5-1.10.8/test/dt_arith.c hdf5-1.10.8-patched/test/dt_arith.c
---- hdf5-1.10.8/test/dt_arith.c	2021-10-21 15:42:56.000000000 +0200
-+++ hdf5-1.10.8-patched/test/dt_arith.c	2022-01-07 11:15:39.693318800 +0100
-@@ -81,7 +81,7 @@
-  * be allowed to continue (cf. Posix signals) so in order to recover from a
-  * SIGFPE we run tests that might generate one in a child process.
-  */
--#ifdef H5_HAVE_UNISTD_H
-+#if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)
- #define HANDLE_SIGFPE
- #endif
- 
-diff -ur hdf5-1.10.8/test/swmr.c hdf5-1.10.8-patched/test/swmr.c
---- hdf5-1.10.8/test/swmr.c	2021-10-21 15:42:56.000000000 +0200
-+++ hdf5-1.10.8-patched/test/swmr.c	2022-01-07 11:46:36.151621700 +0100
-@@ -2394,7 +2394,7 @@
-  *  (5) Parent: open a file with write access; enable SWMR writing mode
-  *      Child: concurrent open of the file with write and SWMR write access (fail)
-  */
--#ifndef H5_HAVE_UNISTD_H
-+#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID))
- 
- static int
- test_start_swmr_write_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t new_format)
-@@ -2407,11 +2407,11 @@
-     }
- 
-     SKIPPED();
--    HDputs("    Test skipped due to a lack of unistd.h functionality.");
-+    HDputs("    Test skipped due to fork or waitpid not defined..");
-     return 0;
- } /* test_start_swmr_write_concur() */
- 
--#else  /* H5_HAVE_UNISTD_H */
-+#else  /* !defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
- 
- static int
- test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
-@@ -3013,7 +3013,7 @@
-     return -1;
- 
- } /* test_start_swmr_write_concur() */
--#endif /* H5_HAVE_UNISTD_H */
-+#endif /* !defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
- 
- /*
-  * test_start_swmr_write_stress_ohdr():
-@@ -4810,7 +4810,7 @@
- **    This is for concurrent access.
- **
- *****************************************************************/
--#ifndef H5_HAVE_UNISTD_H
-+#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) && defined(H5_HAVE_FLOCK))
- 
- static int
- test_file_lock_concur(hid_t H5_ATTR_UNUSED in_fapl)
-@@ -4818,12 +4818,12 @@
-     /* Output message about test being performed */
-     TESTING("File open with different combinations of flags--concurrent access");
-     SKIPPED();
--    HDputs("    Test skipped due to a lack of unistd.h functionality.");
-+    HDputs("    Test skipped due to fork or waitpid not defined..");
-     return 0;
- 
- } /* end test_file_lock_concur() */
- 
--#else /* H5_HAVE_UNISTD_H */
-+#else /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) && defined(H5_HAVE_FLOCK)) */
- 
- static int
- test_file_lock_concur(hid_t in_fapl)
-@@ -5193,7 +5193,7 @@
- 
- } /* end test_file_lock_concur() */
- 
--#endif /* H5_HAVE_UNISTD_H */
-+#endif /* #if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) && defined(H5_HAVE_FLOCK)) */
- 
- /****************************************************************
- **
-@@ -5203,7 +5203,7 @@
- **    This is for concurrent access.
- **
- *****************************************************************/
--#ifndef H5_HAVE_UNISTD_H
-+#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID))
- 
- static int
- test_file_lock_swmr_concur(hid_t H5_ATTR_UNUSED in_fapl)
-@@ -5211,12 +5211,12 @@
-     /* Output message about test being performed */
-     TESTING("File open with different combintations of flags + SWMR flags--concurrent access");
-     SKIPPED();
--    HDputs("    Test skipped due to a lack of unistd.h functionality.");
-+    HDputs("    Test skipped due to fork or waitpid not defined..");
-     return 0;
- 
- } /* end test_file_lock_swmr_concur() */
- 
--#else /* H5_HAVE_UNISTD_H */
-+#else /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) */
- 
- static int
- test_file_lock_swmr_concur(hid_t in_fapl)
-@@ -6216,7 +6216,7 @@
- 
- } /* end test_file_lock_swmr_concur() */
- 
--#endif /* H5_HAVE_UNISTD_H */
-+#endif /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) */
- 
- /****************************************************************
- **
-@@ -6228,7 +6228,7 @@
- static int
- test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_override)
- {
--#ifndef H5_HAVE_UNISTD_H
-+#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID))
-     if (turn_locking_on && env_var_override)
-         TESTING("File locking: ON w/ env var override")
-     else if (turn_locking_on && !env_var_override)
-@@ -6238,9 +6238,9 @@
-     else
-         TESTING("File locking: OFF")
-     SKIPPED();
--    HDputs("    Test skipped due to a lack of unistd.h functionality.");
-+    HDputs("    Test skipped due to fork or waitpid not defined..");
-     return 0;
--#else /* H5_HAVE_UNISTD_H */
-+#else /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) */
-     hid_t  fid  = -1;               /* File ID */
-     hid_t  fapl = -1;               /* File access property list */
-     char   filename[NAME_BUF_SIZE]; /* file name */
-@@ -6406,7 +6406,7 @@
- 
-     return -1;
- 
--#endif /* H5_HAVE_UNISTD_H */
-+#endif /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) */
- 
- } /* end test_file_locking() */
- 
-@@ -6700,7 +6700,7 @@
-  *              (7) Refresh the dataset
-  *              (8) Verify the dataset's dimension and data are correct
-  */
--#ifndef H5_HAVE_UNISTD_H
-+#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID))
- 
- static int
- test_refresh_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t new_format)
-@@ -6713,11 +6713,11 @@
-     }
- 
-     SKIPPED();
--    HDputs("    Test skipped due to a lack of unistd.h functionality.");
-+    HDputs("    Test skipped due to fork or waitpid not defined..");
-     return 0;
- } /* test_refresh_concur() */
- 
--#else  /* H5_HAVE_UNISTD_H */
-+#else  /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) */
- 
- static int
- test_refresh_concur(hid_t in_fapl, hbool_t new_format)
-@@ -7017,7 +7017,7 @@
-     return -1;
- 
- } /* test_refresh_concur() */
--#endif /* H5_HAVE_UNISTD_H */
-+#endif /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) */
- 
- /*
-  * test_multiple_same():
-diff -ur hdf5-1.10.8/test/twriteorder.c hdf5-1.10.8-patched/test/twriteorder.c
---- hdf5-1.10.8/test/twriteorder.c	2021-10-16 16:26:32.000000000 +0200
-+++ hdf5-1.10.8-patched/test/twriteorder.c	2022-01-07 11:20:22.487543000 +0100
-@@ -63,7 +63,7 @@
- /* This test uses many POSIX things that are not available on
-  * Windows.
-  */
--#ifdef H5_HAVE_UNISTD_H
-+#if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)
- 
- #define DATAFILE "twriteorder.dat"
- /* #define READERS_MAX      10 */ /* max number of readers */
-@@ -466,7 +466,7 @@
-     return ret_value;
- }
- 
--#else /* H5_HAVE_UNISTD_H */
-+#else /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
- 
- int
- main(void)
-@@ -475,4 +475,4 @@
-     return EXIT_SUCCESS;
- } /* end main() */
- 
--#endif /* H5_HAVE_UNISTD_H */
-+#endif /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
-diff -ur hdf5-1.10.8/test/use_append_chunk.c hdf5-1.10.8-patched/test/use_append_chunk.c
---- hdf5-1.10.8/test/use_append_chunk.c	2021-10-16 16:26:32.000000000 +0200
-+++ hdf5-1.10.8-patched/test/use_append_chunk.c	2022-01-07 11:29:27.044306900 +0100
-@@ -63,7 +63,7 @@
- /* This test uses many POSIX things that are not available on
-  * Windows.
-  */
--#ifdef H5_HAVE_UNISTD_H
-+#if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)
- 
- #include "use.h"
- 
-@@ -270,7 +270,7 @@
-     return (ret_value);
- }
- 
--#else /* H5_HAVE_UNISTD_H */
-+#else /* defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) */
- 
- int
- main(void)
-@@ -279,4 +279,4 @@
-     return EXIT_SUCCESS;
- } /* end main() */
- 
--#endif /* H5_HAVE_UNISTD_H */
-+#endif /* defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) */
-diff -ur hdf5-1.10.8/test/use_append_mchunks.c hdf5-1.10.8-patched/test/use_append_mchunks.c
---- hdf5-1.10.8/test/use_append_mchunks.c	2021-10-16 16:26:32.000000000 +0200
-+++ hdf5-1.10.8-patched/test/use_append_mchunks.c	2022-01-07 11:30:42.734486400 +0100
-@@ -55,7 +55,7 @@
- /* This test uses many POSIX things that are not available on
-  * Windows.
-  */
--#ifdef H5_HAVE_UNISTD_H
-+#if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)
- 
- #include "use.h"
- 
-@@ -265,7 +265,7 @@
-     return (ret_value);
- } /* end main() */
- 
--#else /* H5_HAVE_UNISTD_H */
-+#else /* defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) */
- 
- int
- main(void)
-@@ -274,4 +274,4 @@
-     return EXIT_SUCCESS;
- } /* end main() */
- 
--#endif /* H5_HAVE_UNISTD_H */
-+#endif /* defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) */
diff --git a/patches/med-4.1.0.patch b/patches/med-4.1.0.patch
deleted file mode 100644
index b269053..0000000
--- a/patches/med-4.1.0.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-diff -ur med-4.1.0/src/CMakeLists.txt med-4.1.0-patched/src/CMakeLists.txt
---- med-4.1.0/src/CMakeLists.txt	2020-03-12 16:45:46.000000000 +0100
-+++ med-4.1.0-patched/src/CMakeLists.txt	2021-12-28 14:41:43.155590300 +0100
-@@ -82,8 +82,11 @@
-     VERSION   11.0.1)
-   TARGET_LINK_LIBRARIES(medC ${HDF5_LIBS} ${MPI_LIBS})
-   MED_SET_DEFINITIONS(medC NOGDI)
--  
--  INSTALL(TARGETS medC EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX})  
-+  IF(WIN32)
-+    INSTALL(TARGETS medC EXPORT ${_export_group} ARCHIVE DESTINATION lib${LIB_SUFFIX} RUNTIME DESTINATION bin)
-+  ELSE()
-+    INSTALL(TARGETS medC EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX})
-+  ENDIF()
- ENDIF()
- 
- ######### Static Libraries ##########
-@@ -113,7 +116,11 @@
-       SOVERSION 11
-       VERSION   11.0.1)
-     TARGET_LINK_LIBRARIES(medfwrap medC)
--    INSTALL(TARGETS medfwrap EXPORT medfileTargetsF DESTINATION lib${LIB_SUFFIX})
-+    IF(WIN32)
-+      INSTALL(TARGETS medfwrap EXPORT medfileTargetsF ARCHIVE DESTINATION lib${LIB_SUFFIX} RUNTIME DESTINATION bin)
-+    ELSE()
-+      INSTALL(TARGETS medfwrap EXPORT medfileTargetsF DESTINATION lib${LIB_SUFFIX})
-+    ENDIF()
- 
-     # Add Shared MED library
-     ADD_LIBRARY(med SHARED MEDiterators.c)
-@@ -124,7 +131,11 @@
-     TARGET_LINK_LIBRARIES(med medfwrap)    
-    
-     # Install only the resulting library:
--    INSTALL(TARGETS med EXPORT medTargetsF DESTINATION lib${LIB_SUFFIX})
-+    IF(WIN32)
-+      INSTALL(TARGETS med EXPORT medTargetsF ARCHIVE DESTINATION lib${LIB_SUFFIX} RUNTIME DESTINATION bin)
-+    ELSE()
-+      INSTALL(TARGETS med EXPORT medTargetsF DESTINATION lib${LIB_SUFFIX})
-+    ENDIF()
-   ENDIF()
- 
-   ######### Static Libraries ##########
-diff -ur med-4.1.0/src/cfi/filecf.c med-4.1.0-patched/src/cfi/filecf.c
---- med-4.1.0/src/cfi/filecf.c	2020-03-11 10:36:33.000000000 +0100
-+++ med-4.1.0-patched/src/cfi/filecf.c	2021-12-29 10:38:02.515617100 +0100
-@@ -63,7 +63,7 @@
- 	const int const *access, 
- 	const med_int* const major, 
- 	const med_int* const minor, 
--	const med_int* const release
-+	const med_int* const release,
- 	const med_int* const len)
- #else
- med_idt
-@@ -389,7 +389,7 @@
- 	 char    *oname,
- 	 unsigned int bidon,
- 	 med_int *len,
--	 med_int *oxist)
-+	 med_int *oexist)
- #else
- med_int
- nmfifoex(const med_idt const *fid,
-diff -ur med-4.1.0/tools/medimport/CMakeLists.txt med-4.1.0-patched/tools/medimport/CMakeLists.txt
---- med-4.1.0/tools/medimport/CMakeLists.txt	2020-03-12 16:45:46.000000000 +0100
-+++ med-4.1.0-patched/tools/medimport/CMakeLists.txt	2021-12-28 14:40:31.980089200 +0100
-@@ -59,7 +59,11 @@
-     VERSION 0.4.0)
-   TARGET_LINK_LIBRARIES(medimportengine medC)
-   SET_TARGET_PROPERTIES(medimportengine PROPERTIES OUTPUT_NAME medimport)
--  INSTALL(TARGETS medimportengine DESTINATION lib${LIB_SUFFIX})
-+  IF(WIN32)
-+    INSTALL(TARGETS medimportengine ARCHIVE DESTINATION lib${LIB_SUFFIX} RUNTIME DESTINATION bin)
-+  ELSE()
-+    INSTALL(TARGETS medimportengine DESTINATION lib${LIB_SUFFIX})
-+  ENDIF()
-   SET(_lib_to_link "medimportengine")
- ENDIF()
- 
diff --git a/patches/med-4.1.1.patch b/patches/med-4.1.1.patch
new file mode 100644
index 0000000..3aca8c9
--- /dev/null
+++ b/patches/med-4.1.1.patch
@@ -0,0 +1,42 @@
+diff -ur med-4.1.1/src/CMakeLists.txt med-4.1.1-patched/src/CMakeLists.txt
+--- med-4.1.1/src/CMakeLists.txt	2021-10-08 13:45:35.000000000 +0200
++++ med-4.1.1-patched/src/CMakeLists.txt	2022-12-15 16:16:52.861440700 +0100
+@@ -83,7 +83,11 @@
+   TARGET_LINK_LIBRARIES(medC ${HDF5_LIBS} ${MPI_LIBS})
+   MED_SET_DEFINITIONS(medC NOGDI)
+   
+-  INSTALL(TARGETS medC EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX})  
++  IF(WIN32)
++    INSTALL(TARGETS medC EXPORT ${_export_group} ARCHIVE DESTINATION lib${LIB_SUFFIX} RUNTIME DESTINATION bin)
++  ELSE()
++    INSTALL(TARGETS medC EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX})
++  ENDIF()
+ ENDIF()
+ 
+ ######### Static Libraries ##########
+@@ -113,7 +117,11 @@
+       SOVERSION 11
+       VERSION   11.1.1)
+     TARGET_LINK_LIBRARIES(medfwrap medC)
+-    INSTALL(TARGETS medfwrap EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX})
++    IF(WIN32)
++      INSTALL(TARGETS medfwrap EXPORT ${_export_group} ARCHIVE DESTINATION lib${LIB_SUFFIX} RUNTIME DESTINATION bin)
++    ELSE()
++      INSTALL(TARGETS medfwrap EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX})
++    ENDIF()
+ 
+     # Add Shared MED library
+     ADD_LIBRARY(med SHARED MEDiterators.c)
+@@ -124,7 +132,11 @@
+     TARGET_LINK_LIBRARIES(med medfwrap)    
+    
+     # Install only the resulting library:
+-    INSTALL(TARGETS med EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX})
++    IF(WIN32)
++      INSTALL(TARGETS med EXPORT ${_export_group} ARCHIVE DESTINATION lib${LIB_SUFFIX} RUNTIME DESTINATION bin)
++    ELSE()
++      INSTALL(TARGETS med EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX})
++    ENDIF()
+   ENDIF()
+ 
+   ######### Static Libraries ##########
-- 
GitLab