diff options
author | Regina Pfeifer <regina@mailbox.org> | 2019-04-08 07:55:52 (GMT) |
---|---|---|
committer | Regina Pfeifer <regina@mailbox.org> | 2019-07-22 13:27:56 (GMT) |
commit | dfaa87f1b3335b2e80f68726fd5e1b3bbd87d667 (patch) | |
tree | d631728ba6308e21581ab455fd341d9fc92dd11d /Source/cmState.cxx | |
parent | 28f2d12a055e025aa0ddeb9842f204f29181eaff (diff) | |
download | CMake-dfaa87f1b3335b2e80f68726fd5e1b3bbd87d667.zip CMake-dfaa87f1b3335b2e80f68726fd5e1b3bbd87d667.tar.gz CMake-dfaa87f1b3335b2e80f68726fd5e1b3bbd87d667.tar.bz2 |
cmState: Support BuiltinCommands as free functions
Diffstat (limited to 'Source/cmState.cxx')
-rw-r--r-- | Source/cmState.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 441f11c..0b12a65 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -432,6 +432,23 @@ void cmState::AddBuiltinCommand(std::string const& name, Command command) this->BuiltinCommands.emplace(name, std::move(command)); } +void cmState::AddBuiltinCommand(std::string const& name, + BuiltinCommand command) +{ + this->AddBuiltinCommand( + name, + [command](const std::vector<cmListFileArgument>& args, + cmExecutionStatus& status) -> bool { + std::vector<std::string> expandedArguments; + if (!status.GetMakefile().ExpandArguments(args, expandedArguments)) { + // There was an error expanding arguments. It was already + // reported, so we can skip this command without error. + return true; + } + return command(expandedArguments, status); + }); +} + void cmState::AddDisallowedCommand(std::string const& name, std::unique_ptr<cmCommand> command, cmPolicies::PolicyID policy, |