forked from qt-creator/qt-creator
CMake: Fix library build path for MinGW
The code that handled the MinGW case of libFoo.a -> libFoo.dll broke the case of libFoo.dll.a -> libFoo.dll that is handled by the code before that. Amends0d8a542b4f
Amends8713919f31
Fixes: QTCREATORBUG-30556 Change-Id: I76f60c5e646bce97169b205860babf6a0d3b08b6 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -308,7 +308,8 @@ static CMakeBuildTarget toBuildTarget(const TargetDetails &t,
|
|||||||
|
|
||||||
std::optional<QString> dllName;
|
std::optional<QString> dllName;
|
||||||
if (buildDir.osType() == OsTypeWindows && (f.role == "libraries")) {
|
if (buildDir.osType() == OsTypeWindows && (f.role == "libraries")) {
|
||||||
part = FilePath::fromUserInput(part).fileName();
|
const auto partAsFilePath = FilePath::fromUserInput(part);
|
||||||
|
part = partAsFilePath.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"))
|
||||||
@@ -322,12 +323,15 @@ static CMakeBuildTarget toBuildTarget(const TargetDetails &t,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MinGW has libQt6Core.a -> Qt6Core.dll
|
// MinGW has libQt6Core.a -> Qt6Core.dll
|
||||||
|
// but libFoo.dll.a was already handled above
|
||||||
const QString mingwPrefix("lib");
|
const QString mingwPrefix("lib");
|
||||||
const QString mingwSuffix(".a");
|
const QString mingwSuffix("a");
|
||||||
if (part.startsWith(mingwPrefix) && part.endsWith(mingwSuffix))
|
const QString completeSuffix = partAsFilePath.completeSuffix();
|
||||||
dllName = part.chopped(mingwSuffix.length())
|
if (part.startsWith(mingwPrefix) && completeSuffix == mingwSuffix) {
|
||||||
|
dllName = part.chopped(mingwSuffix.length() + 1/*the '.'*/)
|
||||||
.sliced(mingwPrefix.length())
|
.sliced(mingwPrefix.length())
|
||||||
.append(".dll");
|
.append(".dll");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tmp.isEmpty() && tmp.isDir()) {
|
if (!tmp.isEmpty() && tmp.isDir()) {
|
||||||
|
Reference in New Issue
Block a user