diff options
author | Ken Martin <ken.martin@kitware.com> | 2006-12-07 14:45:32 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2006-12-07 14:45:32 (GMT) |
commit | 27379d7b081be852c2b290a98db548cffffbff04 (patch) | |
tree | fcc9e19282bdfb71bf4bf9b1f8fcea1401c2fbd5 /Source/cmSetDirectoryPropertiesCommand.cxx | |
parent | 833548f53a2ed799bb0df23fd7d973c30b423d1b (diff) | |
download | CMake-27379d7b081be852c2b290a98db548cffffbff04.zip CMake-27379d7b081be852c2b290a98db548cffffbff04.tar.gz CMake-27379d7b081be852c2b290a98db548cffffbff04.tar.bz2 |
ENH: make properties a bit more formal with documentation and chaining
Diffstat (limited to 'Source/cmSetDirectoryPropertiesCommand.cxx')
-rw-r--r-- | Source/cmSetDirectoryPropertiesCommand.cxx | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/Source/cmSetDirectoryPropertiesCommand.cxx b/Source/cmSetDirectoryPropertiesCommand.cxx index e329e37..427ac73 100644 --- a/Source/cmSetDirectoryPropertiesCommand.cxx +++ b/Source/cmSetDirectoryPropertiesCommand.cxx @@ -27,59 +27,74 @@ bool cmSetDirectoryPropertiesCommand::InitialPass( this->SetError("called with incorrect number of arguments"); return false; } + + std::string errors; + bool ret = + cmSetDirectoryPropertiesCommand::RunCommand(this->Makefile, + args.begin() + 1, + args.end(), errors); + if (!ret) + { + this->SetError(errors.c_str()); + } + return ret; +} - std::vector<std::string>::const_iterator ait; - for ( ait = args.begin()+1; - ait != args.end(); - ait += 2 ) +bool cmSetDirectoryPropertiesCommand +::RunCommand(cmMakefile *mf, + std::vector<std::string>::const_iterator ait, + std::vector<std::string>::const_iterator aitend, + std::string &errors) +{ + for (; ait != aitend; ait += 2 ) { - if ( ait +1 == args.end() ) + if ( ait +1 == aitend) { - this->SetError("Wrong number of arguments"); + errors = "Wrong number of arguments"; return false; } const std::string& prop = *ait; const std::string& value = *(ait+1); if ( prop == "VARIABLES" ) { - this->SetError - ("Variables and cache variables should be set using SET command"); + errors = + "Variables and cache variables should be set using SET command"; return false; } else if ( prop == "MACROS" ) { - this->SetError - ("Commands and macros cannot be set using SET_CMAKE_PROPERTIES"); + errors = + "Commands and macros cannot be set using SET_CMAKE_PROPERTIES"; return false; } else if ( prop == "INCLUDE_DIRECTORIES" ) { std::vector<std::string> varArgsExpanded; cmSystemTools::ExpandListArgument(value, varArgsExpanded); - this->Makefile->SetIncludeDirectories(varArgsExpanded); + mf->SetIncludeDirectories(varArgsExpanded); } else if ( prop == "LINK_DIRECTORIES" ) { std::vector<std::string> varArgsExpanded; cmSystemTools::ExpandListArgument(value, varArgsExpanded); - this->Makefile->SetLinkDirectories(varArgsExpanded); + mf->SetLinkDirectories(varArgsExpanded); } else if ( prop == "INCLUDE_REGULAR_EXPRESSION" ) { - this->Makefile->SetIncludeRegularExpression(value.c_str()); + mf->SetIncludeRegularExpression(value.c_str()); } else { if ( prop == "ADDITIONAL_MAKE_CLEAN_FILES" ) { // This property is not inherrited - if ( strcmp(this->Makefile->GetCurrentDirectory(), - this->Makefile->GetStartDirectory()) != 0 ) + if ( strcmp(mf->GetCurrentDirectory(), + mf->GetStartDirectory()) != 0 ) { continue; } } - this->Makefile->SetProperty(prop.c_str(), value.c_str()); + mf->SetProperty(prop.c_str(), value.c_str()); } } |