aboutsummaryrefslogtreecommitdiff
path: root/build2/bin
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-11-05 15:25:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-11-05 15:25:59 +0200
commitbe2774dd81da77661511280fda868a02e4be87eb (patch)
treeb01c55a25027573049d7d051264b749cc2de9676 /build2/bin
parent3585bd0ea3e7a32f8dc3e634b4358d822d9ee018 (diff)
Only search for external tools (compilers, linkers, etc) in PATH
Specifically, omit the current executable's directory on Windows since there is no reason for them to be found there automagically and this can lead to surprising behavior (for example, our MinGW GCC being used instead of the user's even though the user's is in PATH before ours).
Diffstat (limited to 'build2/bin')
-rw-r--r--build2/bin/guess.cxx17
1 files changed, 13 insertions, 4 deletions
diff --git a/build2/bin/guess.cxx b/build2/bin/guess.cxx
index ab7edf6..913736d 100644
--- a/build2/bin/guess.cxx
+++ b/build2/bin/guess.cxx
@@ -52,7 +52,10 @@ namespace build2
dr << info << "use config.bin.ar to override";
});
- arp = run_search (ar, true, fallback);
+ // Only search in PATH (specifically, omitting the current
+ // executable's directory on Windows).
+ //
+ arp = run_search (ar, true, fallback, true /* path_only */);
}
if (rl != nullptr)
@@ -63,7 +66,7 @@ namespace build2
dr << info << "use config.bin.ranlib to override";
});
- rlp = run_search (*rl, true, fallback);
+ rlp = run_search (*rl, true, fallback, true /* path_only */);
}
// Binutils, LLVM, and FreeBSD ar/ranlib all recognize the --version
@@ -269,7 +272,10 @@ namespace build2
dr << info << "use config.bin.ld to override";
});
- pp = run_search (ld, true, fallback);
+ // Only search in PATH (specifically, omitting the current
+ // executable's directory on Windows).
+ //
+ pp = run_search (ld, true, fallback, true /* path_only */);
}
// Binutils ld recognizes the --version option. Microsoft's link.exe
@@ -397,7 +403,10 @@ namespace build2
dr << info << "use config.bin.rc to override";
});
- pp = run_search (rc, true, fallback);
+ // Only search in PATH (specifically, omitting the current
+ // executable's directory on Windows).
+ //
+ pp = run_search (rc, true, fallback, true /* path_only */);
}
// Binutils windres recognizes the --version option.