From a1bb947cfed28ffee65edf83c4def269b168c154 Mon Sep 17 00:00:00 2001 From: autoantwort Date: Sun, 5 Jan 2025 01:36:11 +0100 Subject: [PATCH 1/2] Don't use non functional cmake versions --- src/vcpkg/tools.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/vcpkg/tools.cpp b/src/vcpkg/tools.cpp index 9836d269d5..e4784f2a84 100644 --- a/src/vcpkg/tools.cpp +++ b/src/vcpkg/tools.cpp @@ -344,6 +344,14 @@ namespace vcpkg out_candidate_paths.push_back(*pf / "CMake" / "bin" / "cmake.exe"); } } + + virtual bool 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 get_version(const ToolCache&, MessageSink&, const Path& exe_path) const override { @@ -765,6 +773,7 @@ namespace vcpkg for (auto&& candidate : candidates) { if (!fs.exists(candidate, IgnoreErrors{})) continue; + if (!tool_provider.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(); @@ -773,7 +782,6 @@ namespace vcpkg if (!parsed_version) continue; auto& actual_version = *parsed_version.get(); if (!accept_version(actual_version)) continue; - if (!tool_provider.is_acceptable(candidate)) continue; return PathAndVersion{candidate, *version}; } From 43947b621820a74ab4a76ff1dff9c0d83c0326af Mon Sep 17 00:00:00 2001 From: autoantwort Date: Mon, 6 Jan 2025 21:52:53 +0100 Subject: [PATCH 2/2] New function --- src/vcpkg/tools.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/vcpkg/tools.cpp b/src/vcpkg/tools.cpp index e4784f2a84..20c19af394 100644 --- a/src/vcpkg/tools.cpp +++ b/src/vcpkg/tools.cpp @@ -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 { @@ -345,7 +352,7 @@ namespace vcpkg } } - virtual bool is_acceptable(const Path& exe_path) const override + 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(); @@ -773,7 +780,7 @@ namespace vcpkg for (auto&& candidate : candidates) { if (!fs.exists(candidate, IgnoreErrors{})) continue; - if (!tool_provider.is_acceptable(candidate)) 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(); @@ -782,6 +789,7 @@ namespace vcpkg if (!parsed_version) continue; auto& actual_version = *parsed_version.get(); if (!accept_version(actual_version)) continue; + if (!tool_provider.is_acceptable(candidate)) continue; return PathAndVersion{candidate, *version}; }