From fa73a6da5a0b48738198ec9762b6950bcb398800 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 3 Dec 2019 15:35:05 +0100 Subject: MSVC: Remember only dependencies with libraries ... when collecting link-time dependencies. This is a hack for the case where an application depends on a static library, and both depend on a statically built Qt. A Qt plugin does not declare a library artifact when pulled in by a static library, because we don't want to link against plugins in that case. As a result, when the dependency collection runs for the application and finds a Qt plugin via traversing the static library, it won't see any libraries there. Before this patch, we'd skip such plugins when encountering them again as direct dependencies of the application, so they were missing on the linker command line. Fixes: QBS-1518 Change-Id: Ia0e5b39e4a2fb80b9fd1384610942ac627978571 Reviewed-by: Joerg Bornemann --- share/qbs/modules/cpp/msvc.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/qbs/modules/cpp/msvc.js b/share/qbs/modules/cpp/msvc.js index 5ede90840..8b7864400 100644 --- a/share/qbs/modules/cpp/msvc.js +++ b/share/qbs/modules/cpp/msvc.js @@ -322,7 +322,6 @@ function collectLibraryDependencies(product) { function traverse(dep) { if (seen.hasOwnProperty(dep.name)) return; - seen[dep.name] = true; if (dep.parameters.cpp && dep.parameters.cpp.link === false) return; @@ -331,10 +330,12 @@ function collectLibraryDependencies(product) { var dynamicLibraryArtifacts = staticLibraryArtifacts ? null : dep.artifacts["dynamiclibrary_import"]; if (staticLibraryArtifacts) { + seen[dep.name] = true; dep.dependencies.forEach(traverse); addArtifactFilePaths(dep, staticLibraryArtifacts); addExternalLibs(dep); } else if (dynamicLibraryArtifacts) { + seen[dep.name] = true; addArtifactFilePaths(dep, dynamicLibraryArtifacts); } } -- cgit v1.2.3