--- a/External/Wannier/Patches/3.1.0.patch
+++ b/External/Wannier/Patches/3.1.0.patch
@@ -212,6 +212,7 @@
 +  "${PROJECT_NAME}-lib"
 +  EXPORT
 +  "${PROJECT_NAME}-targets"
++  RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
 +  LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
 +  ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
 +)
--- a/Src/CMakeLists.txt
+++ b/Src/CMakeLists.txt
@@ -361,9 +361,7 @@
   matel.F90 matel_params.f90 matel_registry.F90 matel_table.F90 matel_ylm.F90
   md_out.F90
   memory.F
-  memory_all.F90
   memory_log.F90
-  memory_snapshot.f90
   mesh.F
   meshcomm.F
   meshdscf.F
@@ -453,7 +451,6 @@
   rhoofd.F90
   rhoofdsp.F90
   runinfo_m.F90
-  rusage.f90
   sankey_change_basis.F90
   save_density_matrix.F90
   savepsi.F
@@ -542,6 +539,9 @@
 if( SIESTA_WITH_PEXSI )
   list(APPEND libsiesta_sources
 
+    memory_all.F90
+    memory_snapshot.f90
+    rusage.f90
     pexsi-solver/m_pexsi.F90
     pexsi-solver/m_pexsi_dos.F90
     pexsi-solver/m_pexsi_driver.F90
@@ -636,6 +636,8 @@
   $<$<BOOL:${ELSI_HAS_PEXSI}>:${PROJECT_NAME}.cxx_dummy_lib>
   # Profiling
   $<$<BOOL:${SIESTA_WITH_PROFILE_NVTX}>:${PROJECT_NAME}.nvtx-c>
+  # Windows
+  $<$<BOOL:${WIN32}>:ws2_32>
 )
 
 ## For stuff that depends on libsiesta, add its include directory
@@ -792,7 +794,9 @@
 if( SIESTA_INSTALL )
   install(
     TARGETS ${PROJECT_NAME}.libsiesta
-    RUNTIME DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+    RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+    LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+    ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
     )
   install(
     TARGETS ${PROJECT_NAME}.siesta
--- a/Src/MPI/CMakeLists.txt
+++ b/Src/MPI/CMakeLists.txt
@@ -142,4 +142,11 @@
   )
 endif()
 
-
+if( SIESTA_INSTALL )
+  install(
+    TARGETS ${PROJECT_NAME}.mpi
+    RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+    LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+    ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+    )
+endif()
--- a/Src/sockets.c
+++ b/Src/sockets.c
@@ -39,10 +39,16 @@
 #include <unistd.h>
 #include <string.h>
 #include <sys/types.h>
+#ifndef _WIN32
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/un.h>
 #include <netdb.h>
+#else
+#include <ws2tcpip.h>
+#include <winsock.h>
+#include <afunix.h>
+#endif
 
 void open_socket(int *psockfd, int* inet, int* port, const char* host)
 /* Opens a socket.
--- a/Util/Grid/CMakeLists.txt
+++ b/Util/Grid/CMakeLists.txt
@@ -98,7 +98,7 @@
 
 # To avoid "multiple rules" in Ninja
 # (could add OBJECT qualifier to avoid the lib appearing)
-siesta_add_library(${PROJECT_NAME}.aux_m_grid  m_grid.F90)
+siesta_add_library(${PROJECT_NAME}.aux_m_grid STATIC m_grid.F90)
 target_compile_definitions(${PROJECT_NAME}.aux_m_grid  PRIVATE CDF )
 target_link_libraries(${PROJECT_NAME}.aux_m_grid PUBLIC NetCDF::NetCDF_Fortran )
 
--- a/Util/JobList/Src/CMakeLists.txt
+++ b/Util/JobList/Src/CMakeLists.txt
@@ -1,7 +1,7 @@
 # To avoid "multiple rules" in Ninja
 # Maybe turn into global-utility targets
 
-siesta_add_library(${PROJECT_NAME}.aux_joblist
+siesta_add_library(${PROJECT_NAME}.aux_joblist STATIC
   jobList.f90 posix_calls.f90)
 
 siesta_add_executable(${PROJECT_NAME}.countJobs  countJobs.f90 )
--- a/Util/QMMM-driver/Src/CMakeLists.txt
+++ b/Util/QMMM-driver/Src/CMakeLists.txt
@@ -110,9 +110,7 @@
   ${top_srcdir}/m_cite.F90
   ${top_srcdir}/m_timer.F90
   ${top_srcdir}/memory.F
-  ${top_srcdir}/memory_all.F90
   ${top_srcdir}/memory_log.F90
-  ${top_srcdir}/memory_snapshot.f90
   ${top_srcdir}/m_wallclock.f90
   ${top_srcdir}/m_walltime.f90
 
@@ -165,7 +163,6 @@
   ${top_srcdir}/reinit_m.F90
   ${top_srcdir}/remove_intramol_pressure.f90
   ${top_srcdir}/reord.f
-  ${top_srcdir}/rusage.f90
   ${top_srcdir}/siesta_cml.f90
   ${top_srcdir}/siesta_cmlsubs.F90
   ${top_srcdir}/siesta_geom.F90
@@ -239,6 +236,8 @@
   $<$<BOOL:${SIESTA_WITH_DFTD3}>:s-dftd3::s-dftd3>
   LAPACK::LAPACK
   $<$<BOOL:${SIESTA_WITH_OPENMP}>:OpenMP::OpenMP_Fortran>
+  # Windows
+  $<$<BOOL:${WIN32}>:ws2_32>
  )
 
 
--- a/Util/STM/simple-stm/CMakeLists.txt
+++ b/Util/STM/simple-stm/CMakeLists.txt
@@ -4,7 +4,7 @@
 # To avoid "multiple rules" in Ninja
 # Maybe turn into global-utility targets
 
-siesta_add_library(${PROJECT_NAME}.stm_gridfunc   ${grid_srcdir}/m_gridfunc.F90)
+siesta_add_library(${PROJECT_NAME}.stm_gridfunc STATIC  ${grid_srcdir}/m_gridfunc.F90)
 
 siesta_add_executable( ${PROJECT_NAME}.plstm 
   plstm.f90
--- a/Util/SiestaSubroutine/SimpleTest/Src/CMakeLists.txt
+++ b/Util/SiestaSubroutine/SimpleTest/Src/CMakeLists.txt
@@ -21,6 +21,9 @@
 set_target_properties(${PROJECT_NAME}.sockets-dispatch
   PROPERTIES
   Fortran_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/sockets-include")
+if(WIN32)
+  target_link_libraries(${PROJECT_NAME}.sockets-dispatch PUBLIC ws2_32)
+endif()
 
 target_include_directories(${PROJECT_NAME}.sockets-dispatch
   INTERFACE
--- a/Util/Sockets/CMakeLists.txt
+++ b/Util/Sockets/CMakeLists.txt
@@ -11,6 +11,10 @@
 
 target_link_libraries(${PROJECT_NAME}.f2fmaster PRIVATE ${PROJECT_NAME}.sockets_objs )
 target_link_libraries(${PROJECT_NAME}.f2fslave PRIVATE ${PROJECT_NAME}.sockets_objs )
+if(WIN32)
+  target_link_libraries(${PROJECT_NAME}.f2fmaster PUBLIC ws2_32)
+  target_link_libraries(${PROJECT_NAME}.f2fslave PUBLIC ws2_32)
+endif()
     
 if( SIESTA_INSTALL )
   install(
--- a/Util/libsiestaqmmm/CMakeLists.txt
+++ b/Util/libsiestaqmmm/CMakeLists.txt
@@ -23,7 +23,9 @@
 
 install(
   TARGETS ${PROJECT_NAME}-libsiestaqmmm
-  RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
+  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
 )
 
 target_compile_definitions(
@@ -37,4 +39,6 @@
   PRIVATE
   $<$<BOOL:${SIESTA_WITH_OPENMP}>:OpenMP::OpenMP_Fortran>
   libfdf::libfdf
+  # Windows
+  $<$<BOOL:${WIN32}>:ws2_32>
 )
