Skip to content

Commit

Permalink
Don't use non functional cmake versions (#1562)
Browse files Browse the repository at this point in the history
  • Loading branch information
autoantwort authored Jan 6, 2025
1 parent 3bc9bc7 commit ba96865
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/vcpkg/tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,13 @@ namespace vcpkg
MessageSink& status_sink,
const Path& exe_path) const = 0;

// returns true if and only if `exe_path` is a usable version of this tool, cheap check
virtual bool cheap_is_acceptable(const Path& exe_path) const
{
(void)exe_path;
return true;
}

// returns true if and only if `exe_path` is a usable version of this tool
virtual bool is_acceptable(const Path& exe_path) const
{
Expand Down Expand Up @@ -344,6 +351,14 @@ namespace vcpkg
out_candidate_paths.push_back(*pf / "CMake" / "bin" / "cmake.exe");
}
}

virtual bool cheap_is_acceptable(const Path& exe_path) const override
{
// the cmake version from mysys and cygwin can not be used because that version can't handle 'C:' in paths
auto path = exe_path.generic_u8string();
return !Strings::ends_with(path, "/usr/bin") && !Strings::ends_with(path, "/cygwin64/bin");
}

#endif
virtual ExpectedL<std::string> get_version(const ToolCache&, MessageSink&, const Path& exe_path) const override
{
Expand Down Expand Up @@ -765,6 +780,7 @@ namespace vcpkg
for (auto&& candidate : candidates)
{
if (!fs.exists(candidate, IgnoreErrors{})) continue;
if (!tool_provider.cheap_is_acceptable(candidate)) continue;
auto maybe_version = tool_provider.get_version(*this, status_sink, candidate);
log_candidate(candidate, maybe_version);
const auto version = maybe_version.get();
Expand Down

0 comments on commit ba96865

Please sign in to comment.