diff options
author | Ian Scott <ian.m.scott@stud.man.ac.uk> | 2001-07-27 17:06:05 (GMT) |
---|---|---|
committer | Ian Scott <ian.m.scott@stud.man.ac.uk> | 2001-07-27 17:06:05 (GMT) |
commit | 4878ed3d2937b717f31eb398db0121ec1f246d80 (patch) | |
tree | abb385287493e5b7450764f5ffc1aebf11954835 /Source/cmMakefile.cxx | |
parent | 6d54c3d6f8b03b137368c5868454f727ef707ceb (diff) | |
download | CMake-4878ed3d2937b717f31eb398db0121ec1f246d80.zip CMake-4878ed3d2937b717f31eb398db0121ec1f246d80.tar.gz CMake-4878ed3d2937b717f31eb398db0121ec1f246d80.tar.bz2 |
MAkefile now strips duplicate directores from the libraries and include paths
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5c8aad2..f9db806 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -408,6 +408,9 @@ void cmMakefile::FinalPass() { // do all the variable expansions here this->ExpandVariables(); + + this->StripDuplicateDirectories(); + // give all the commands a chance to do something // after the file has been parsed before generation for(std::vector<cmCommand*>::iterator i = m_UsedCommands.begin(); @@ -790,6 +793,29 @@ int cmMakefile::DumpDocumentationToFile(const char *fileName) } + // Remove duplicate directories from the library and include paths. +void cmMakefile::StripDuplicateDirectories() +{ + std::vector<std::string>::iterator begin, end; + // remove duplicates from m_IncludeDirectories + begin = m_IncludeDirectories.begin(); + end = m_IncludeDirectories.end(); + std::list<std::string> tmp1(begin, end); + tmp1.sort(); + m_IncludeDirectories.clear(); + std::unique_copy(tmp1.begin(), tmp1.end(), std::back_inserter(m_IncludeDirectories)); + + // remove duplicates from m_LinkDirectories + begin = m_LinkDirectories.begin(); + end = m_LinkDirectories.end(); + std::list<std::string> tmp2(begin, end); + tmp2.sort(); + m_LinkDirectories.clear(); + std::unique_copy(tmp2.begin(), tmp2.end(), std::back_inserter(m_LinkDirectories)); +} + + + void cmMakefile::ExpandVariablesInString(std::string& source) const { this->ExpandVariablesInString(source, false); |