forked from qt-creator/qt-creator
CMakePM: Fix dll path addition for MinGW
Amends 0d8a542b4f
Fixes: QTCREATORBUG-30529
Change-Id: Ic786f1e7075ef68cf9d590d27ef90b9d1e8631b0
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -301,9 +301,14 @@ static CMakeBuildTarget toBuildTarget(const TargetDetails &t,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
const FilePath buildDir = relativeLibs ? buildDirectory : currentBuildDir;
|
const FilePath buildDir = relativeLibs ? buildDirectory : currentBuildDir;
|
||||||
std::optional<QString> dllName;
|
FilePath tmp = buildDir.resolvePath(part);
|
||||||
|
if (f.role == "libraries")
|
||||||
|
tmp = tmp.parentDir();
|
||||||
|
|
||||||
|
std::optional<QString> dllName;
|
||||||
if (buildDir.osType() == OsTypeWindows && (f.role == "libraries")) {
|
if (buildDir.osType() == OsTypeWindows && (f.role == "libraries")) {
|
||||||
|
part = FilePath::fromUserInput(part).fileName();
|
||||||
|
|
||||||
// Skip object libraries on Windows. This case can happen with static qml plugins
|
// Skip object libraries on Windows. This case can happen with static qml plugins
|
||||||
if (part.endsWith(".obj") || part.endsWith(".o"))
|
if (part.endsWith(".obj") || part.endsWith(".o"))
|
||||||
continue;
|
continue;
|
||||||
@@ -312,15 +317,17 @@ static CMakeBuildTarget toBuildTarget(const TargetDetails &t,
|
|||||||
for (const QString &suffix :
|
for (const QString &suffix :
|
||||||
{QString(".lib"), QString(".dll.a"), QString(".a")}) {
|
{QString(".lib"), QString(".dll.a"), QString(".a")}) {
|
||||||
if (part.endsWith(suffix) && !dllName)
|
if (part.endsWith(suffix) && !dllName)
|
||||||
dllName = FilePath::fromUserInput(
|
dllName = part.chopped(suffix.length()).append(".dll");
|
||||||
part.chopped(suffix.length()).append(".dll"))
|
|
||||||
.fileName();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePath tmp = buildDir.resolvePath(part);
|
// MinGW has libQt6Core.a -> Qt6Core.dll
|
||||||
if (f.role == "libraries")
|
const QString mingwPrefix("lib");
|
||||||
tmp = tmp.parentDir();
|
const QString mingwSuffix(".a");
|
||||||
|
if (part.startsWith(mingwPrefix) && part.endsWith(mingwSuffix))
|
||||||
|
dllName = part.chopped(mingwSuffix.length())
|
||||||
|
.sliced(mingwPrefix.length())
|
||||||
|
.append(".dll");
|
||||||
|
}
|
||||||
|
|
||||||
if (!tmp.isEmpty() && tmp.isDir()) {
|
if (!tmp.isEmpty() && tmp.isDir()) {
|
||||||
// f.role is libraryPath or frameworkPath
|
// f.role is libraryPath or frameworkPath
|
||||||
@@ -349,6 +356,7 @@ static CMakeBuildTarget toBuildTarget(const TargetDetails &t,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ct.libraryDirectories = filteredUnique(librarySeachPaths);
|
ct.libraryDirectories = filteredUnique(librarySeachPaths);
|
||||||
|
qCInfo(cmakeLogger) << "libraryDirectories for target" << ct.title << ":" << ct.libraryDirectories;
|
||||||
}
|
}
|
||||||
return ct;
|
return ct;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user