diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2006-03-10 21:53:04 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2006-03-10 21:53:04 (GMT) |
commit | ac432c7e7ceb86672aa2ee64a7b104d4ad48c464 (patch) | |
tree | 4fce9f001b89c2cf7f13638ee37a650a449f52d7 /Source/cmFileCommand.cxx | |
parent | 7387cb58505de65fea2622b443c1cc9d471818a2 (diff) | |
download | CMake-ac432c7e7ceb86672aa2ee64a7b104d4ad48c464.zip CMake-ac432c7e7ceb86672aa2ee64a7b104d4ad48c464.tar.gz CMake-ac432c7e7ceb86672aa2ee64a7b104d4ad48c464.tar.bz2 |
ENH: add a new FILE SYSTEM_PATH that allows you to read a environment variable with a path in it.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r-- | Source/cmFileCommand.cxx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 6c4ad5c..6895f84 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -71,6 +71,10 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args) { return this->HandleRelativePathCommand(args); } + else if ( subCommand == "SYSTEM_PATH" ) + { + return this->HandleSystemPathCommand(args); + } std::string e = "does not recognize sub-command "+subCommand; this->SetError(e.c_str()); @@ -889,3 +893,28 @@ bool cmFileCommand::HandleRemove(std::vector<std::string> const& args, return true; } +bool cmFileCommand::HandleSystemPathCommand(std::vector<std::string> + const& args) +{ + std::vector<std::string>::const_iterator i = args.begin(); + if(args.size() != 3) + { + this->SetError("FILE(SYSTEM_PATH ENV result) must be called with " + "only three arguments."); + return false; + } + i++; // Get rid of subcommand + std::vector<std::string> path; + cmSystemTools::GetPath(path, i->c_str()); + i++; + const char* var = i->c_str(); + std::string value; + for(std::vector<std::string>::iterator j = path.begin(); + j != path.end(); ++j) + { + value += *j; + value += ";"; + } + m_Makefile->AddDefinition(var, value.c_str()); + return true; +} |