Skip to content

Commit ba96865

Browse files
authored
Don't use non functional cmake versions (#1562)
1 parent 3bc9bc7 commit ba96865

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/vcpkg/tools.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,13 @@ namespace vcpkg
292292
MessageSink& status_sink,
293293
const Path& exe_path) const = 0;
294294

295+
// returns true if and only if `exe_path` is a usable version of this tool, cheap check
296+
virtual bool cheap_is_acceptable(const Path& exe_path) const
297+
{
298+
(void)exe_path;
299+
return true;
300+
}
301+
295302
// returns true if and only if `exe_path` is a usable version of this tool
296303
virtual bool is_acceptable(const Path& exe_path) const
297304
{
@@ -344,6 +351,14 @@ namespace vcpkg
344351
out_candidate_paths.push_back(*pf / "CMake" / "bin" / "cmake.exe");
345352
}
346353
}
354+
355+
virtual bool cheap_is_acceptable(const Path& exe_path) const override
356+
{
357+
// the cmake version from mysys and cygwin can not be used because that version can't handle 'C:' in paths
358+
auto path = exe_path.generic_u8string();
359+
return !Strings::ends_with(path, "/usr/bin") && !Strings::ends_with(path, "/cygwin64/bin");
360+
}
361+
347362
#endif
348363
virtual ExpectedL<std::string> get_version(const ToolCache&, MessageSink&, const Path& exe_path) const override
349364
{
@@ -765,6 +780,7 @@ namespace vcpkg
765780
for (auto&& candidate : candidates)
766781
{
767782
if (!fs.exists(candidate, IgnoreErrors{})) continue;
783+
if (!tool_provider.cheap_is_acceptable(candidate)) continue;
768784
auto maybe_version = tool_provider.get_version(*this, status_sink, candidate);
769785
log_candidate(candidate, maybe_version);
770786
const auto version = maybe_version.get();

0 commit comments

Comments
 (0)