diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-03-18 15:21:08 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-03-31 21:18:44 (GMT) |
commit | 28e1d2f8fc08516e8fc3a009777437d3e086b8e6 (patch) | |
tree | 6706855db40e1726ad1d5e29bf8c763c7286156e /Source | |
parent | bf98cc252f18e761ed9a57d2f7a9304bfbb621de (diff) | |
download | CMake-28e1d2f8fc08516e8fc3a009777437d3e086b8e6.zip CMake-28e1d2f8fc08516e8fc3a009777437d3e086b8e6.tar.gz CMake-28e1d2f8fc08516e8fc3a009777437d3e086b8e6.tar.bz2 |
cmStringCommand: Add GENEX_STRIP subcommand.
Strip out any generator expressions in the input string.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmStringCommand.cxx | 25 | ||||
-rw-r--r-- | Source/cmStringCommand.h | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 7bc7b05..ea762eb 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -101,6 +101,10 @@ bool cmStringCommand { return this->HandleMakeCIdentifierCommand(args); } + else if(subCommand == "GENEX_STRIP") + { + return this->HandleGenexStripCommand(args); + } std::string e = "does not recognize sub-command "+subCommand; this->SetError(e); @@ -810,6 +814,27 @@ bool cmStringCommand } //---------------------------------------------------------------------------- +bool cmStringCommand +::HandleGenexStripCommand(std::vector<std::string> const& args) +{ + if(args.size() != 3) + { + this->SetError("sub-command GENEX_STRIP requires two arguments."); + return false; + } + + const std::string& input = args[1]; + + std::string result = cmGeneratorExpression::Preprocess(input, + cmGeneratorExpression::StripAllGeneratorExpressions); + + const std::string& variableName = args[2]; + + this->Makefile->AddDefinition(variableName, result.c_str()); + return true; +} + +//---------------------------------------------------------------------------- bool cmStringCommand::HandleStripCommand( std::vector<std::string> const& args) { diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index b8053c5..5b7412d 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -75,6 +75,7 @@ protected: bool HandleFindCommand(std::vector<std::string> const& args); bool HandleTimestampCommand(std::vector<std::string> const& args); bool HandleMakeCIdentifierCommand(std::vector<std::string> const& args); + bool HandleGenexStripCommand(std::vector<std::string> const& args); class RegexReplacement { |