@@ -228,26 +228,58 @@ FUNCTION(MYSQL_INSTALL_TARGETS)
228228 IF (SIGNCODE)
229229 SIGN_TARGET(${target} ${COMP} )
230230 ENDIF ()
231+ IF (INSTALL_RUNTIME_DEPENDENCIES)
232+ # Populate INSTALLED_TARGETS list (stored as global property)
233+ # The list is used in INSTALL_RUNTIME_DEPS
234+ GET_PROPERTY (installed_targets GLOBAL PROPERTY INSTALLED_TARGETS)
235+ IF (NOT installed_targets)
236+ SET (installed_targets)
237+ ENDIF ()
238+ LIST (APPEND installed_targets "${target} " )
239+ SET_PROPERTY (GLOBAL PROPERTY INSTALLED_TARGETS "${installed_targets} " )
240+ SET (RUNTIME_DEPS RUNTIME_DEPENDENCY_SET ${target} )
241+ ENDIF ()
242+ INSTALL (TARGETS ${target} DESTINATION ${ARG_DESTINATION} ${COMP} ${RUNTIME_DEPS} )
243+ INSTALL_DEBUG_SYMBOLS(${target} ${COMP} INSTALL_LOCATION ${ARG_DESTINATION} )
231244 ENDFOREACH ()
245+ ENDFUNCTION ()
232246
233- IF (WIN32 AND INSTALL_RUNTIME_DEPENDENCIES)
234- STRING (JOIN "." runtime_deps_set_name ${TARGETS} )
235- SET (RUNTIME_DEPS RUNTIME_DEPENDENCY_SET "${runtime_deps_set_name} " )
236- ENDIF ()
237247
238- INSTALL (TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION} ${COMP} ${RUNTIME_DEPS} )
239- INSTALL_DEBUG_SYMBOLS(${TARGETS} ${COMP} INSTALL_LOCATION ${ARG_DESTINATION} )
248+ # On Windows, installs runtime dependency for all targets
249+ FUNCTION (INSTALL_RUNTIME_DEPS)
250+ IF (NOT WIN32 OR NOT INSTALL_RUNTIME_DEPENDENCIES)
251+ RETURN ()
252+ ENDIF ()
253+ # Install all runtime dependencies
254+
255+ GET_PROPERTY (installed_targets GLOBAL PROPERTY INSTALLED_TARGETS)
256+ # Exclude all dependencies that are shared libraries from the
257+ # same build.
258+ FOREACH (tgt ${installed_targets} )
259+ SET (exclude_libs)
260+ GET_TARGET_PROPERTY (link_libraries ${tgt} LINK_LIBRARIES )
261+ IF (link_libraries )
262+ FOREACH (lib ${link_libraries} )
263+ IF (TARGET ${lib} )
264+ GET_TARGET_PROPERTY (type ${lib} TYPE )
265+ IF (type MATCHES "SHARED" )
266+ LIST (APPEND exclude_libs "$<TARGET_FILE_BASE_NAME:${lib} >\\ .dll" )
267+ ENDIF ()
268+ ENDIF ()
269+ ENDFOREACH ()
270+ ENDIF ()
240271
241- IF (WIN32 AND INSTALL_RUNTIME_DEPENDENCIES)
242272 INSTALL (
243273 RUNTIME_DEPENDENCY_SET
244- " ${runtime_deps_set_name} "
274+ ${tgt}
245275 COMPONENT RuntimeDeps
246276 DESTINATION ${INSTALL_BINDIR}
247277 PRE_EXCLUDE_REGEXES
248278 "api-ms-" # Windows stuff
249279 "ext-ms-"
250- "server\\ .dll" # main server DLL, installed separately
280+ "icuuc\\ .dll" # Old Windows 10 (1809)
281+ "icuin\\ .dll"
282+ ${exclude_libs}
251283 "clang_rt" # ASAN libraries
252284 "vcruntime"
253285 POST_EXCLUDE_REGEXES
@@ -257,7 +289,7 @@ FUNCTION(MYSQL_INSTALL_TARGETS)
257289 ${VCPKG_INSTALLED_DIR} /${VCPKG_TARGET_TRIPLET} /bin
258290 $<$<CONFIG:Debug>:${VCPKG_INSTALLED_DIR} /${VCPKG_TARGET_TRIPLET} /debug/bin>
259291 )
260- ENDIF ()
292+ ENDFOREACH ()
261293ENDFUNCTION ()
262294
263295# Optionally install mysqld/client/embedded from debug build run. outside of the current build dir
0 commit comments