fixed mingw warning
All checks were successful
CI / build-test-release (push) Successful in 18m54s

This commit is contained in:
Jorijn van der Graaf 2026-05-27 05:43:56 +02:00
commit f0bdfbee77

View file

@ -281,15 +281,17 @@ ExternalBuildResult Crafter::BuildExternal(
// (runtime-loader). The rpath stays embedded in the produced // (runtime-loader). The rpath stays embedded in the produced
// binary so it picks up shared deps from the cache without any // binary so it picks up shared deps from the cache without any
// LD_LIBRARY_PATH gymnastics. Static deps (.a) ignore the rpath // 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(); std::string buildDirAbs = fs::absolute(cmakeBuildDir).string();
result.linkFlags.push_back(std::format("-L{}", buildDirAbs)); 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) { for (const fs::path& libDir : dep.libDirs) {
fs::path full = libDir.is_absolute() ? libDir : cmakeBuildDir / libDir; fs::path full = libDir.is_absolute() ? libDir : cmakeBuildDir / libDir;
std::string fullAbs = fs::absolute(full).string(); std::string fullAbs = fs::absolute(full).string();
result.linkFlags.push_back(std::format("-L{}", fullAbs)); 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) { for (const std::string& lib : dep.libs) {
result.linkFlags.push_back(std::format("-l{}", lib)); result.linkFlags.push_back(std::format("-l{}", lib));