modified to handle src list vectors without proper dollar signs

This commit is contained in:
Ken Martin 2002-06-24 16:42:34 -04:00
parent 7df776057b
commit d1879a77e8
1 changed files with 62 additions and 17 deletions

View File

@ -34,10 +34,13 @@ void cmTarget::GenerateSourceFilesFromSourceLists( cmMakefile &mf)
for (std::vector<std::string>::const_iterator s = m_SourceLists.begin(); for (std::vector<std::string>::const_iterator s = m_SourceLists.begin();
s != m_SourceLists.end(); ++s) s != m_SourceLists.end(); ++s)
{ {
int done = 0;
// replace any variables // replace any variables
std::string temps = *s; std::string temps = *s;
mf.ExpandVariablesInString(temps); mf.ExpandVariablesInString(temps);
// look for a srclist
// look for a srclist, this is old code we really don't want
// any source lists in the future.
if (mf.GetSources().find(temps) != mf.GetSources().end()) if (mf.GetSources().find(temps) != mf.GetSources().end())
{ {
const std::vector<cmSourceFile*> &clsList = const std::vector<cmSourceFile*> &clsList =
@ -46,28 +49,70 @@ void cmTarget::GenerateSourceFilesFromSourceLists( cmMakefile &mf)
m_SourceFiles.insert(m_SourceFiles.end(), m_SourceFiles.insert(m_SourceFiles.end(),
clsList.begin(), clsList.begin(),
clsList.end()); clsList.end());
done = 1;
} }
// if one wasn't found then assume it is a single class
else // Next if one wasn't found then assume it is a single class
if (!done && mf.GetSource(temps.c_str()))
{ {
// if the source file is already in the makefile, use it m_SourceFiles.push_back(mf.GetSource(temps.c_str()));
if (mf.GetSource(temps.c_str())) done = 1;
}
// if it wasn't a source file listed with the makefile
// see if it is a variable. This is for old CMake 1.2 compatability
// where a source list would be passed into here, by making it
// a vector we need to possibly lookup the variable to maintain
// CMake 1.2 compatability.
if (!done)
{
const char* versionValue
= mf.GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
if (!versionValue || atof(versionValue) <= 1.2)
{ {
m_SourceFiles.push_back(mf.GetSource(temps.c_str())); const char* varValue =
} mf.GetDefinition(temps.c_str());
// otherwise try to create it if (varValue)
else {
{ std::vector<std::string> tval;
cmSourceFile file; tval.push_back(varValue);
file.SetIsAnAbstractClass(false); std::vector<std::string> args;
file.SetName(temps.c_str(), mf.GetCurrentDirectory(), cmSystemTools::ExpandListArguments(tval, args);
mf.GetSourceExtensions(), int i;
mf.GetHeaderExtensions()); for (i = 0; i < args.size(); ++i)
m_SourceFiles.push_back(mf.AddSource(file)); {
if (mf.GetSource(args[i].c_str()))
{
m_SourceFiles.push_back(mf.GetSource(args[i].c_str()));
}
else
{
cmSourceFile file;
file.SetIsAnAbstractClass(false);
file.SetName(args[i].c_str(), mf.GetCurrentDirectory(),
mf.GetSourceExtensions(),
mf.GetHeaderExtensions());
m_SourceFiles.push_back(mf.AddSource(file));
}
}
done = 1;
}
} }
} }
// if we still are not done, try to create the SourceFile structure
if (!done)
{
cmSourceFile file;
file.SetIsAnAbstractClass(false);
file.SetName(temps.c_str(), mf.GetCurrentDirectory(),
mf.GetSourceExtensions(),
mf.GetHeaderExtensions());
m_SourceFiles.push_back(mf.AddSource(file));
done = 1;
}
} }
// expand any link library variables whle we are at it // expand any link library variables whle we are at it
LinkLibraries::iterator p = m_LinkLibraries.begin(); LinkLibraries::iterator p = m_LinkLibraries.begin();
for (;p != m_LinkLibraries.end(); ++p) for (;p != m_LinkLibraries.end(); ++p)