diff options
author | Ken Martin <ken.martin@kitware.com> | 2007-06-25 13:51:37 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2007-06-25 13:51:37 (GMT) |
commit | 509f1fb9cb2d23938f4f4217a7f51597fa4af18a (patch) | |
tree | fcaaa9a18d57d26b72b108859ebd6844055170f6 /Source/cmSetPropertiesCommand.cxx | |
parent | 2d1c85ade3f7824eeb3f342f4a96a8843ee7b7b8 (diff) | |
download | CMake-509f1fb9cb2d23938f4f4217a7f51597fa4af18a.zip CMake-509f1fb9cb2d23938f4f4217a7f51597fa4af18a.tar.gz CMake-509f1fb9cb2d23938f4f4217a7f51597fa4af18a.tar.bz2 |
ENH: some property cleanup and added GetProperty
Diffstat (limited to 'Source/cmSetPropertiesCommand.cxx')
-rw-r--r-- | Source/cmSetPropertiesCommand.cxx | 52 |
1 files changed, 40 insertions, 12 deletions
diff --git a/Source/cmSetPropertiesCommand.cxx b/Source/cmSetPropertiesCommand.cxx index e83e281..aa4f7fa 100644 --- a/Source/cmSetPropertiesCommand.cxx +++ b/Source/cmSetPropertiesCommand.cxx @@ -80,9 +80,13 @@ bool cmSetPropertiesCommand::InitialPass( { scope = cmProperty::GLOBAL; } - else if (args[0] == "DIRECTORY" && numFiles == 1) + else if (args[0] == "DIRECTORY" && numFiles >= 1) { scope = cmProperty::DIRECTORY; + if (numFiles == 2) + { + scopeName = args[1].c_str(); + } } else if (args[0] == "TARGET" && numFiles == 2) { @@ -122,16 +126,39 @@ bool cmSetPropertiesCommand::InitialPass( break; case cmProperty::DIRECTORY: { - std::string errors; - bool ret = - cmSetDirectoryPropertiesCommand::RunCommand(this->Makefile, - args.begin() + 2, - args.end(), - errors); - if (!ret) + // lookup the makefile from the directory name + cmLocalGenerator *lg = this->Makefile->GetLocalGenerator(); + if (numFiles == 2) { - this->SetError(errors.c_str()); - return ret; + std::string sd = scopeName; + // make sure the start dir is a full path + if (!cmSystemTools::FileIsFullPath(sd.c_str())) + { + sd = this->Makefile->GetStartDirectory(); + sd += "/"; + sd += scopeName; + } + + // The local generators are associated with collapsed paths. + sd = cmSystemTools::CollapseFullPath(sd.c_str()); + + lg = this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> + FindLocalGenerator(sd.c_str()); + } + if (!lg) + { + this->SetError + ("DIRECTORY argument provided but requested directory not found. " + "This could be because the directory argument was invalid or, " + "it is valid but has not been processed yet."); + return false; + } + + for(j= propertyPairs.begin(); j != propertyPairs.end(); ++j) + { + const char *pn = j->c_str(); + ++j; + lg->GetMakefile()->SetProperty(pn,j->c_str()); } } break; @@ -139,8 +166,9 @@ bool cmSetPropertiesCommand::InitialPass( { for(j= propertyPairs.begin(); j != propertyPairs.end(); ++j) { - this->Makefile->GetCMakeInstance()->SetProperty(j->c_str(), - (++j)->c_str()); + const char *pn = j->c_str(); + ++j; + this->Makefile->GetCMakeInstance()->SetProperty(pn, j->c_str()); } } break; |