Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output error text if cmake failed during triplet var detection #536

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions locales/messages.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"CiBaselineRegressionHeader": "REGRESSIONS:",
"CiBaselineUnexpectedPass": "PASSING, REMOVE FROM FAIL LIST: {spec} ({path}).",
"CmakeTargetsExcluded": "note: {count} additional targets are not displayed.",
"CommandFailed": "command:\n{command_line}\nfailed with the following results:\n{list}\n",
"CouldNotDeduceNugetIdAndVersion": "Could not deduce nuget id and version from filename: {path}",
"CurlReportedUnexpectedResults": "curl has reported unexpected results to vcpkg and vcpkg cannot continue.\nPlease review the following text for sensitive information and open an issue on the Microsoft/vcpkg GitHub to help fix this problem!\ncmd: {command_line}\n=== curl output ===\n{actual}\n=== end curl output ===\n",
"DownloadedSources": "Downloaded sources for {spec}",
Expand Down
17 changes: 16 additions & 1 deletion src/vcpkg/cmakevars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,14 @@ endfunction()
return dep_info_path;
}

DECLARE_AND_REGISTER_MESSAGE(CommandFailed,
(msg::command_line, msg::list),
"",
"command:\n"
"{command_line}\n"
"failed with the following results:\n"
"{list}\n");

void TripletCMakeVarProvider::launch_and_split(
const Path& script_path, std::vector<std::vector<std::pair<std::string, std::string>>>& vars) const
{
Expand All @@ -264,7 +272,14 @@ endfunction()
[&](StringView sv) { lines.emplace_back(sv.begin(), sv.end()); },
default_working_directory);

Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, exit_code == 0 ? "" : Strings::join("\n", lines));
if (exit_code != 0)
{
msg::println(Color::error,
msgCommandFailed,
msg::command_line = cmd_launch_cmake.command_line(),
msg::list = Strings::join(", ", lines));
Checks::exit_fail(VCPKG_LINE_INFO);
}

const auto end = lines.cend();

Expand Down