diff options
author | Eike Ziller <eike.ziller@qt.io> | 2024-05-13 10:12:58 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2024-05-13 08:53:38 +0000 |
commit | 6075904af52e52f955e3ed404ec0d46c064a1717 (patch) | |
tree | 48755b0a19bd83cb1bed4c83c102a8e9dd1529a0 /src/plugins/cmakeprojectmanager | |
parent | 67e233fefca4f182f3f7d5d986aa6cd98b3c3984 (diff) |
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.
Amends 0d8a542b4f7d8a7b4d27f42ff16d309fba6cbf22
Amends 8713919f31f2aecc7e7c15f1fc9ce7906b8fefa0
Fixes: QTCREATORBUG-30556
Change-Id: I76f60c5e646bce97169b205860babf6a0d3b08b6
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'src/plugins/cmakeprojectmanager')
-rw-r--r-- | src/plugins/cmakeprojectmanager/fileapidataextractor.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp index f4212a1a48..f1d3cee4ee 100644 --- a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp +++ b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp @@ -308,7 +308,8 @@ static CMakeBuildTarget toBuildTarget(const TargetDetails &t, std::optional<QString> dllName; 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 if (part.endsWith(".obj") || part.endsWith(".o")) @@ -322,12 +323,15 @@ static CMakeBuildTarget toBuildTarget(const TargetDetails &t, } // MinGW has libQt6Core.a -> Qt6Core.dll + // but libFoo.dll.a was already handled above const QString mingwPrefix("lib"); - const QString mingwSuffix(".a"); - if (part.startsWith(mingwPrefix) && part.endsWith(mingwSuffix)) - dllName = part.chopped(mingwSuffix.length()) + const QString mingwSuffix("a"); + const QString completeSuffix = partAsFilePath.completeSuffix(); + if (part.startsWith(mingwPrefix) && completeSuffix == mingwSuffix) { + dllName = part.chopped(mingwSuffix.length() + 1/*the '.'*/) .sliced(mingwPrefix.length()) .append(".dll"); + } } if (!tmp.isEmpty() && tmp.isDir()) { |