From f0bdfbee770e3fe9ebea8063f564be4479b8d70c Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Wed, 27 May 2026 05:43:56 +0200 Subject: [PATCH] fixed mingw warning --- implementations/Crafter.Build-External.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/implementations/Crafter.Build-External.cpp b/implementations/Crafter.Build-External.cpp index fc6c1ec..e2a6e74 100644 --- a/implementations/Crafter.Build-External.cpp +++ b/implementations/Crafter.Build-External.cpp @@ -281,15 +281,17 @@ ExternalBuildResult Crafter::BuildExternal( // (runtime-loader). The rpath stays embedded in the produced // binary so it picks up shared deps from the cache without any // LD_LIBRARY_PATH gymnastics. Static deps (.a) ignore the rpath - // harmlessly. + // harmlessly. PE/COFF targets (mingw, msvc) resolve DLLs via PATH + // or adjacency rather than rpath, so lld warns if we pass it. + bool isPe = target == "x86_64-w64-mingw32" || target == "x86_64-pc-windows-msvc"; std::string buildDirAbs = fs::absolute(cmakeBuildDir).string(); result.linkFlags.push_back(std::format("-L{}", buildDirAbs)); - result.linkFlags.push_back(std::format("-Wl,-rpath,{}", buildDirAbs)); + if (!isPe) result.linkFlags.push_back(std::format("-Wl,-rpath,{}", buildDirAbs)); for (const fs::path& libDir : dep.libDirs) { fs::path full = libDir.is_absolute() ? libDir : cmakeBuildDir / libDir; std::string fullAbs = fs::absolute(full).string(); result.linkFlags.push_back(std::format("-L{}", fullAbs)); - result.linkFlags.push_back(std::format("-Wl,-rpath,{}", fullAbs)); + if (!isPe) result.linkFlags.push_back(std::format("-Wl,-rpath,{}", fullAbs)); } for (const std::string& lib : dep.libs) { result.linkFlags.push_back(std::format("-l{}", lib));