summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmCableClassSet.cxx4
-rw-r--r--Source/cmCableWrapTclCommand.cxx4
-rw-r--r--Source/cmDSPWriter.cxx8
-rw-r--r--Source/cmMakeDepend.cxx4
-rw-r--r--Source/cmMakefile.cxx66
-rw-r--r--Source/cmMakefile.h15
-rw-r--r--Source/cmUnixMakefileGenerator.cxx12
7 files changed, 52 insertions, 61 deletions
diff --git a/Source/cmCableClassSet.cxx b/Source/cmCableClassSet.cxx
index 54ebcfc..ed56ad6 100644
--- a/Source/cmCableClassSet.cxx
+++ b/Source/cmCableClassSet.cxx
@@ -644,11 +644,11 @@ void ElementCombinationGenerator::FindTagSource()
}
// Get the makefile's include path.
- const std::set<std::string>& includePath =
+ const std::vector<std::string>& includePath =
m_Makefile->GetIncludeDirectories();
// Search the path for a file called "(m_Tag).h".
- for(std::set<std::string>::const_iterator dir = includePath.begin();
+ for(std::vector<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 1733a9b..feb24c8 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::set<std::string>& includes =
+ const std::vector<std::string>& includes =
m_Makefile->GetIncludeDirectories();
- for(std::set<std::string>::const_iterator i = includes.begin();
+ for(std::vector<std::string>::const_iterator i = includes.begin();
i != includes.end(); ++i)
{
commandArgs += " -I";
diff --git a/Source/cmDSPWriter.cxx b/Source/cmDSPWriter.cxx
index 626a213..eff7bf1 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::set<std::string>& includes = m_Makefile->GetIncludeDirectories();
- std::set<std::string>::iterator i;
+ std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
+ std::vector<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::set<std::string>::iterator i;
- std::set<std::string>& libdirs = m_Makefile->GetLinkDirectories();
+ std::vector<std::string>::iterator i;
+ std::vector<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 6416b98..5a18e07 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::set<std::string>& includes =
+ const std::vector<std::string>& includes =
m_Makefile->GetIncludeDirectories();
- for(std::set<std::string>::const_iterator j = includes.begin();
+ for(std::vector<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 915eb23..19cc386 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -170,17 +170,6 @@ 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
@@ -545,7 +534,15 @@ void cmMakefile::AddLinkLibrary(const char* lib)
void cmMakefile::AddLinkDirectory(const char* dir)
{
- m_LinkDirectories.insert(dir);
+ // Don't add a link directory that is already present. Yes, this
+ // linear search results in n^2 behavior, but n won't be getting
+ // much bigger than 20. We cannot use a set because of order
+ // dependency of the link search path.
+ if(std::find(m_LinkDirectories.begin(),
+ m_LinkDirectories.end(), dir) == m_LinkDirectories.end())
+ {
+ m_LinkDirectories.push_back(dir);
+ }
}
void cmMakefile::AddSubDirectory(const char* sub)
@@ -555,7 +552,15 @@ void cmMakefile::AddSubDirectory(const char* sub)
void cmMakefile::AddIncludeDirectory(const char* inc)
{
- m_IncludeDirectories.insert(inc);
+ // Don't add an include directory that is already present. Yes,
+ // this linear search results in n^2 behavior, but n won't be
+ // getting much bigger than 20. We cannot use a set because of
+ // order dependency of the include path.
+ if(std::find(m_IncludeDirectories.begin(),
+ m_IncludeDirectories.end(), inc) == m_IncludeDirectories.end())
+ {
+ m_IncludeDirectories.push_back(inc);
+ }
}
void cmMakefile::AddDefinition(const char* name, const char* value)
@@ -739,37 +744,20 @@ std::string cmMakefile::GetParentListFileName(const char *currentFileName)
void cmMakefile::ExpandVariables()
{
// Now expand varibles in the include and link strings
- 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)
+ for(std::vector<std::string>::iterator d = m_IncludeDirectories.begin();
+ d != m_IncludeDirectories.end(); ++d)
{
- x= *j;
- this->ExpandVariablesInString(x);
- new_set.insert(x);
+ this->ExpandVariablesInString(*d);
}
- m_IncludeDirectories = new_set;
-
- new_set.clear();
- begin = m_LinkDirectories.begin();
- end = m_LinkDirectories.end();
- for(j = begin; j != end; ++j)
+ for(std::vector<std::string>::iterator d = m_LinkDirectories.begin();
+ d != m_LinkDirectories.end(); ++d)
{
- x = *j;
- this->ExpandVariablesInString(x);
- new_set.insert(x);
+ this->ExpandVariablesInString(*d);
}
- m_LinkDirectories = new_set;
-
- cmTarget::LinkLibraries::iterator j2, end2;
- j2 = m_LinkLibraries.begin();
- end2 = m_LinkLibraries.end();
- for(; j2 != end2; ++j2)
+ for(cmTarget::LinkLibraries::iterator l = m_LinkLibraries.begin();
+ l != m_LinkLibraries.end(); ++l)
{
- this->ExpandVariablesInString(j2->first);
+ this->ExpandVariablesInString(l->first);
}
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index db7caf1..88acddb 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -383,11 +383,11 @@ public:
/**
* Get a list of include directories in the build.
*/
- std::set<std::string>& GetIncludeDirectories()
+ std::vector<std::string>& GetIncludeDirectories()
{
return m_IncludeDirectories;
}
- const std::set<std::string>& GetIncludeDirectories() const
+ const std::vector<std::string>& GetIncludeDirectories() const
{
return m_IncludeDirectories;
}
@@ -395,7 +395,7 @@ public:
/**
* Get a list of link directories in the build.
*/
- std::set<std::string>& GetLinkDirectories()
+ std::vector<std::string>& GetLinkDirectories()
{
return m_LinkDirectories;
}
@@ -523,8 +523,12 @@ protected:
SourceMap m_Sources;
std::vector<std::string> m_SubDirectories; // list of sub directories
- std::set<std::string> m_IncludeDirectories;
- std::set<std::string> m_LinkDirectories;
+
+ // The include and link-library paths. These may have order
+ // dependency, so they must be vectors (not set).
+ std::vector<std::string> m_IncludeDirectories;
+ std::vector<std::string> m_LinkDirectories;
+
std::vector<std::string> m_ListFiles; // list of command files loaded
@@ -555,7 +559,6 @@ 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 2599068..966db4a 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().insert(m_LibraryOutputPath);
+ m_Makefile->AddLinkDirectory(m_LibraryOutputPath.c_str());
}
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().insert(m_ExecutableOutputPath);
+ m_Makefile->AddLinkDirectory(m_ExecutableOutputPath.c_str());
}
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::set<std::string>& libdirs = m_Makefile->GetLinkDirectories();
- for(std::set<std::string>::iterator libDir = libdirs.begin();
+ std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
+ for(std::vector<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::set<std::string>& includes = m_Makefile->GetIncludeDirectories();
- std::set<std::string>::iterator i;
+ std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
+ std::vector<std::string>::iterator i;
fout << "-I" << m_Makefile->GetStartDirectory() << " ";
for(i = includes.begin(); i != includes.end(); ++i)
{