diff options
author | Ian Scott <ian.m.scott@stud.man.ac.uk> | 2001-07-30 11:18:38 (GMT) |
---|---|---|
committer | Ian Scott <ian.m.scott@stud.man.ac.uk> | 2001-07-30 11:18:38 (GMT) |
commit | b24861d895f96040e35c94944cc3866e78e7781c (patch) | |
tree | 1b16733e3f9ebff6730d7bf5fba3a0ae40f7cc04 /Source | |
parent | 8bad4180c7908426b50809f5ba5948e408330cee (diff) | |
download | CMake-b24861d895f96040e35c94944cc3866e78e7781c.zip CMake-b24861d895f96040e35c94944cc3866e78e7781c.tar.gz CMake-b24861d895f96040e35c94944cc3866e78e7781c.tar.bz2 |
Removed the Uniquification of the include and link directory list in FinalPass,
and achieved the same effect by makein m_LinkDirectores and m_IncludeDirectories
a set rather than vector
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCableClassSet.cxx | 4 | ||||
-rw-r--r-- | Source/cmCableWrapTclCommand.cxx | 4 | ||||
-rw-r--r-- | Source/cmDSPWriter.cxx | 8 | ||||
-rw-r--r-- | Source/cmMakeDepend.cxx | 4 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 58 | ||||
-rw-r--r-- | Source/cmMakefile.h | 16 | ||||
-rw-r--r-- | Source/cmUnixMakefileGenerator.cxx | 12 |
7 files changed, 50 insertions, 56 deletions
diff --git a/Source/cmCableClassSet.cxx b/Source/cmCableClassSet.cxx index ed56ad6..54ebcfc 100644 --- a/Source/cmCableClassSet.cxx +++ b/Source/cmCableClassSet.cxx @@ -644,11 +644,11 @@ void ElementCombinationGenerator::FindTagSource() } // Get the makefile's include path. - const std::vector<std::string>& includePath = + const std::set<std::string>& includePath = m_Makefile->GetIncludeDirectories(); // Search the path for a file called "(m_Tag).h". - for(std::vector<std::string>::const_iterator dir = includePath.begin(); + for(std::set<std::string>::const_iterator dir = includePath.begin(); dir != includePath.end(); ++dir) { std::string filePath = *dir; diff --git a/Source/cmCableWrapTclCommand.cxx b/Source/cmCableWrapTclCommand.cxx index feb24c8..1733a9b 100644 --- a/Source/cmCableWrapTclCommand.cxx +++ b/Source/cmCableWrapTclCommand.cxx @@ -298,9 +298,9 @@ void cmCableWrapTclCommand::GenerateCableClassFiles(const char* name, commandArgs += m_Makefile->GetStartDirectory(); commandArgs += "\""; - const std::vector<std::string>& includes = + const std::set<std::string>& includes = m_Makefile->GetIncludeDirectories(); - for(std::vector<std::string>::const_iterator i = includes.begin(); + for(std::set<std::string>::const_iterator i = includes.begin(); i != includes.end(); ++i) { commandArgs += " -I"; diff --git a/Source/cmDSPWriter.cxx b/Source/cmDSPWriter.cxx index eff7bf1..626a213 100644 --- a/Source/cmDSPWriter.cxx +++ b/Source/cmDSPWriter.cxx @@ -68,8 +68,8 @@ void cmDSPWriter::OutputDSPFile() } // Setup /I and /LIBPATH options for the resulting DSP file - std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories(); - std::vector<std::string>::iterator i; + std::set<std::string>& includes = m_Makefile->GetIncludeDirectories(); + std::set<std::string>::iterator i; for(i = includes.begin(); i != includes.end(); ++i) { m_IncludeOptions += "/I \""; @@ -504,8 +504,8 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName, libMultiLineOptions += exePath; libMultiLineOptions += "\" \n"; } - std::vector<std::string>::iterator i; - std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories(); + std::set<std::string>::iterator i; + std::set<std::string>& libdirs = m_Makefile->GetLinkDirectories(); for(i = libdirs.begin(); i != libdirs.end(); ++i) { libOptions += " /LIBPATH:\""; diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 5a18e07..6416b98 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -90,9 +90,9 @@ void cmMakeDepend::SetMakefile(const cmMakefile* makefile) m_Makefile->m_ComplainFileRegularExpression.c_str()); // Now extract any include paths from the makefile flags - const std::vector<std::string>& includes = + const std::set<std::string>& includes = m_Makefile->GetIncludeDirectories(); - for(std::vector<std::string>::const_iterator j = includes.begin(); + for(std::set<std::string>::const_iterator j = includes.begin(); j != includes.end(); ++j) { std::string path = *j; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a420d2e..915eb23 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -170,6 +170,17 @@ void cmMakefile::PrintStringVector(const char* s, const std::vector<std::string> std::cout << " )\n"; } +void cmMakefile::PrintStringVector(const char* s, const std::set<std::string>& v) const +{ + std::cout << s << ": ( \n"; + for(std::set<std::string>::const_iterator i = v.begin(); + i != v.end(); ++i) + { + std::cout << (*i).c_str() << " "; + } + std::cout << " )\n"; +} + // call print on all the classes in the makefile void cmMakefile::Print() const @@ -409,8 +420,6 @@ 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(); @@ -536,7 +545,7 @@ void cmMakefile::AddLinkLibrary(const char* lib) void cmMakefile::AddLinkDirectory(const char* dir) { - m_LinkDirectories.push_back(dir); + m_LinkDirectories.insert(dir); } void cmMakefile::AddSubDirectory(const char* sub) @@ -546,7 +555,7 @@ void cmMakefile::AddSubDirectory(const char* sub) void cmMakefile::AddIncludeDirectory(const char* inc) { - m_IncludeDirectories.push_back(inc); + m_IncludeDirectories.insert(inc); } void cmMakefile::AddDefinition(const char* name, const char* value) @@ -730,19 +739,31 @@ std::string cmMakefile::GetParentListFileName(const char *currentFileName) void cmMakefile::ExpandVariables() { // Now expand varibles in the include and link strings - std::vector<std::string>::iterator j, begin, end; + std::set<std::string>::iterator j, begin, end; begin = m_IncludeDirectories.begin(); end = m_IncludeDirectories.end(); + std::set<std::string> new_set; + std::string x; + for(j = begin; j != end; ++j) { - this->ExpandVariablesInString(*j); + x= *j; + this->ExpandVariablesInString(x); + new_set.insert(x); } + m_IncludeDirectories = new_set; + + new_set.clear(); begin = m_LinkDirectories.begin(); end = m_LinkDirectories.end(); for(j = begin; j != end; ++j) { - this->ExpandVariablesInString(*j); + x = *j; + this->ExpandVariablesInString(x); + new_set.insert(x); } + m_LinkDirectories = new_set; + cmTarget::LinkLibraries::iterator j2, end2; j2 = m_LinkLibraries.begin(); end2 = m_LinkLibraries.end(); @@ -793,29 +814,6 @@ 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); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index e44d73d..db7caf1 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -383,11 +383,11 @@ public: /** * Get a list of include directories in the build. */ - std::vector<std::string>& GetIncludeDirectories() + std::set<std::string>& GetIncludeDirectories() { return m_IncludeDirectories; } - const std::vector<std::string>& GetIncludeDirectories() const + const std::set<std::string>& GetIncludeDirectories() const { return m_IncludeDirectories; } @@ -395,7 +395,7 @@ public: /** * Get a list of link directories in the build. */ - std::vector<std::string>& GetLinkDirectories() + std::set<std::string>& GetLinkDirectories() { return m_LinkDirectories; } @@ -481,11 +481,6 @@ public: */ void ExpandVariables(); - /** - * Strip Duplicate directories from Library and Include paths - */ - void cmMakefile::StripDuplicateDirectories(); - /** Recursivly read and create a cmMakefile object for * all CMakeLists.txt files in the GetSubDirectories list. * Once the file is found, it ReadListFile is called on @@ -528,8 +523,8 @@ protected: SourceMap m_Sources; std::vector<std::string> m_SubDirectories; // list of sub directories - std::vector<std::string> m_IncludeDirectories; - std::vector<std::string> m_LinkDirectories; + std::set<std::string> m_IncludeDirectories; + std::set<std::string> m_LinkDirectories; std::vector<std::string> m_ListFiles; // list of command files loaded @@ -560,6 +555,7 @@ private: friend class cmMakeDepend; // make depend needs direct access // to the m_Sources array void PrintStringVector(const char* s, const std::vector<std::string>& v) const; + void PrintStringVector(const char* s, const std::set<std::string>& v) const; void AddDefaultCommands(); void AddDefaultDefinitions(); std::set<cmFunctionBlocker *> m_FunctionBlockers; diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx index 5a93a38..2599068 100644 --- a/Source/cmUnixMakefileGenerator.cxx +++ b/Source/cmUnixMakefileGenerator.cxx @@ -65,7 +65,7 @@ void cmUnixMakefileGenerator::GenerateMakefile() m_LibraryOutputPath += "/"; } cmSystemTools::MakeDirectory(m_LibraryOutputPath.c_str()); - m_Makefile->GetLinkDirectories().push_back(m_LibraryOutputPath); + m_Makefile->GetLinkDirectories().insert(m_LibraryOutputPath); } if (m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH")) { @@ -76,7 +76,7 @@ void cmUnixMakefileGenerator::GenerateMakefile() m_ExecutableOutputPath += "/"; } cmSystemTools::MakeDirectory(m_ExecutableOutputPath.c_str()); - m_Makefile->GetLinkDirectories().push_back(m_ExecutableOutputPath); + m_Makefile->GetLinkDirectories().insert(m_ExecutableOutputPath); } if(m_CacheOnly) @@ -362,8 +362,8 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout, // collect all the flags needed for linking libraries std::string linkLibs; - std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories(); - for(std::vector<std::string>::iterator libDir = libdirs.begin(); + std::set<std::string>& libdirs = m_Makefile->GetLinkDirectories(); + for(std::set<std::string>::iterator libDir = libdirs.begin(); libDir != libdirs.end(); ++libDir) { std::string libpath = cmSystemTools::EscapeSpaces(libDir->c_str()); @@ -653,8 +653,8 @@ void cmUnixMakefileGenerator::OutputMakeFlags(std::ostream& fout) { // Output Include paths fout << "INCLUDE_FLAGS = "; - std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories(); - std::vector<std::string>::iterator i; + std::set<std::string>& includes = m_Makefile->GetIncludeDirectories(); + std::set<std::string>::iterator i; fout << "-I" << m_Makefile->GetStartDirectory() << " "; for(i = includes.begin(); i != includes.end(); ++i) { |