diff options
author | Brad King <brad.king@kitware.com> | 2009-07-14 14:14:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-07-14 14:14:41 (GMT) |
commit | d60608c858b5d3f521ee03b86c5d6eb215ff7af0 (patch) | |
tree | 631ac531cff02a42821bcf2247d0483ab2b3bace | |
parent | b44413f9f8e92280325d105d3095f5bb4a3f090f (diff) | |
download | CMake-d60608c858b5d3f521ee03b86c5d6eb215ff7af0.zip CMake-d60608c858b5d3f521ee03b86c5d6eb215ff7af0.tar.gz CMake-d60608c858b5d3f521ee03b86c5d6eb215ff7af0.tar.bz2 |
STYLE: Factor CollectOriginalDirectories code
This factors code out of cmOrderDirectories::CollectOriginalDirectories
into cmOrderDirectories::AddOriginalDirectories. Later a new call will
be added, and this is more readable anyway.
-rw-r--r-- | Source/cmOrderDirectories.cxx | 47 | ||||
-rw-r--r-- | Source/cmOrderDirectories.h | 1 |
2 files changed, 28 insertions, 20 deletions
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 24b7138..f95c68a 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -393,26 +393,7 @@ void cmOrderDirectories::CollectOriginalDirectories() // Add user directories specified for inclusion. These should be // indexed first so their original order is preserved as much as // possible subject to the constraints. - for(std::vector<std::string>::const_iterator - di = this->UserDirectories.begin(); - di != this->UserDirectories.end(); ++di) - { - // We never explicitly specify implicit link directories. - if(this->ImplicitDirectories.find(*di) != - this->ImplicitDirectories.end()) - { - continue; - } - - // Skip the empty string. - if(di->empty()) - { - continue; - } - - // Add this directory. - this->AddOriginalDirectory(*di); - } + this->AddOriginalDirectories(this->UserDirectories); // Add directories containing constraints. for(unsigned int i=0; i < this->ConstraintEntries.size(); ++i) @@ -439,6 +420,32 @@ int cmOrderDirectories::AddOriginalDirectory(std::string const& dir) } //---------------------------------------------------------------------------- +void +cmOrderDirectories +::AddOriginalDirectories(std::vector<std::string> const& dirs) +{ + for(std::vector<std::string>::const_iterator di = dirs.begin(); + di != dirs.end(); ++di) + { + // We never explicitly specify implicit link directories. + if(this->ImplicitDirectories.find(*di) != + this->ImplicitDirectories.end()) + { + continue; + } + + // Skip the empty string. + if(di->empty()) + { + continue; + } + + // Add this directory. + this->AddOriginalDirectory(*di); + } +} + +//---------------------------------------------------------------------------- struct cmOrderDirectoriesCompare { typedef std::pair<int, int> ConflictPair; diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h index 5407733..6d05f93 100644 --- a/Source/cmOrderDirectories.h +++ b/Source/cmOrderDirectories.h @@ -66,6 +66,7 @@ private: std::vector<int> DirectoryVisited; void CollectOriginalDirectories(); int AddOriginalDirectory(std::string const& dir); + void AddOriginalDirectories(std::vector<std::string> const& dirs); void FindConflicts(); void FindImplicitConflicts(); void OrderDirectories(); |