2017-04-03 10:44:14 -07:00
|
|
|
#include "pch.h"
|
2017-04-27 18:08:52 -07:00
|
|
|
|
2017-10-13 18:37:41 -07:00
|
|
|
#include <vcpkg/base/system.h>
|
|
|
|
#include <vcpkg/build.h>
|
|
|
|
#include <vcpkg/commands.h>
|
|
|
|
#include <vcpkg/help.h>
|
2017-04-03 10:44:14 -07:00
|
|
|
|
|
|
|
namespace vcpkg::Commands::Env
|
|
|
|
{
|
2017-11-02 15:20:42 -07:00
|
|
|
const CommandStructure COMMAND_STRUCTURE = {
|
|
|
|
Help::create_example_string("env --triplet x64-windows"),
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
{},
|
|
|
|
nullptr,
|
|
|
|
};
|
|
|
|
|
2017-04-03 16:29:11 -07:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
|
2017-04-03 10:44:14 -07:00
|
|
|
{
|
2017-11-02 15:20:42 -07:00
|
|
|
args.parse_arguments(COMMAND_STRUCTURE);
|
2017-04-03 10:44:14 -07:00
|
|
|
|
2017-08-28 17:21:34 -07:00
|
|
|
const auto pre_build_info = Build::PreBuildInfo::from_triplet_file(paths, default_triplet);
|
2017-11-25 11:49:15 -08:00
|
|
|
const Toolset& toolset = paths.get_toolset(pre_build_info);
|
2018-03-02 08:59:17 -08:00
|
|
|
auto env_cmd = Build::make_build_env_cmd(pre_build_info, toolset);
|
|
|
|
if (env_cmd.empty())
|
|
|
|
System::cmd_execute_clean("cmd");
|
|
|
|
else
|
|
|
|
System::cmd_execute_clean(env_cmd + " && cmd");
|
2017-04-03 10:44:14 -07:00
|
|
|
|
|
|
|
Checks::exit_success(VCPKG_LINE_INFO);
|
|
|
|
}
|
|
|
|
}
|