more crazt changes source files now must match with full path
This commit is contained in:
parent
d5d0f17e5c
commit
703242071f
@ -281,7 +281,11 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
|
|||||||
name += ".";
|
name += ".";
|
||||||
name += outsf->GetSourceExtension();
|
name += outsf->GetSourceExtension();
|
||||||
}
|
}
|
||||||
srcFilesToProcess.push(name);
|
std::string temp =
|
||||||
|
cmSystemTools::GetFilenamePath(outsf->GetFullPath());
|
||||||
|
temp += "/";
|
||||||
|
temp += name;
|
||||||
|
srcFilesToProcess.push(temp);
|
||||||
}
|
}
|
||||||
// add its dependencies to the list to check
|
// add its dependencies to the list to check
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -705,7 +705,11 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
|
|||||||
name += ".";
|
name += ".";
|
||||||
name += outsf->GetSourceExtension();
|
name += outsf->GetSourceExtension();
|
||||||
}
|
}
|
||||||
srcFilesToProcess.push(name);
|
std::string temp =
|
||||||
|
cmSystemTools::GetFilenamePath(outsf->GetFullPath());
|
||||||
|
temp += "/";
|
||||||
|
temp += name;
|
||||||
|
srcFilesToProcess.push(temp);
|
||||||
}
|
}
|
||||||
// add its dependencies to the list to check
|
// add its dependencies to the list to check
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -1625,7 +1625,25 @@ cmData* cmMakefile::LookupData(const char* name) const
|
|||||||
|
|
||||||
cmSourceFile* cmMakefile::GetSource(const char* sourceName) const
|
cmSourceFile* cmMakefile::GetSource(const char* sourceName) const
|
||||||
{
|
{
|
||||||
std::string s = cmSystemTools::GetFilenameName(sourceName);
|
// if the source is provided with a full path use it, otherwise
|
||||||
|
// by default it is in the current source dir
|
||||||
|
std::string path = cmSystemTools::GetFilenamePath(sourceName);
|
||||||
|
std::string s = sourceName;
|
||||||
|
if (path.empty())
|
||||||
|
{
|
||||||
|
s = this->GetCurrentDirectory();
|
||||||
|
s += "/";
|
||||||
|
s += cmSystemTools::GetFilenameName(sourceName);
|
||||||
|
path = this->GetCurrentDirectory();
|
||||||
|
}
|
||||||
|
std::string sname =
|
||||||
|
cmSystemTools::GetFilenameWithoutLastExtension(s);
|
||||||
|
|
||||||
|
/* unfortunately old CMakeList files sometimes use sources with providing
|
||||||
|
* their extensions. If this is the case then we must
|
||||||
|
*/
|
||||||
|
|
||||||
|
// compute the extension
|
||||||
std::string ext;
|
std::string ext;
|
||||||
ext = cmSystemTools::GetFilenameLastExtension(s);
|
ext = cmSystemTools::GetFilenameLastExtension(s);
|
||||||
s = s.substr(0, s.length()-ext.length());
|
s = s.substr(0, s.length()-ext.length());
|
||||||
@ -1633,15 +1651,15 @@ cmSourceFile* cmMakefile::GetSource(const char* sourceName) const
|
|||||||
{
|
{
|
||||||
ext = ext.substr(1);
|
ext = ext.substr(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(std::vector<cmSourceFile*>::const_iterator i = m_SourceFiles.begin();
|
for(std::vector<cmSourceFile*>::const_iterator i = m_SourceFiles.begin();
|
||||||
i != m_SourceFiles.end(); ++i)
|
i != m_SourceFiles.end(); ++i)
|
||||||
{
|
{
|
||||||
if ((*i)->GetSourceName() == s)
|
if (cmSystemTools::GetFilenamePath((*i)->GetFullPath()) == path &&
|
||||||
|
(*i)->GetSourceName() == sname &&
|
||||||
|
(ext.size() == 0 || (ext == (*i)->GetSourceExtension())))
|
||||||
{
|
{
|
||||||
if ((ext.size() == 0 || (ext == (*i)->GetSourceExtension())))
|
return *i;
|
||||||
{
|
|
||||||
return *i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1650,58 +1668,48 @@ cmSourceFile* cmMakefile::GetSource(const char* sourceName) const
|
|||||||
cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName,
|
cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName,
|
||||||
bool generated)
|
bool generated)
|
||||||
{
|
{
|
||||||
|
// make it a full path first
|
||||||
|
std::string path = cmSystemTools::GetFilenamePath(sourceName);
|
||||||
|
std::string src = sourceName;
|
||||||
|
if (path.empty())
|
||||||
|
{
|
||||||
|
src = this->GetCurrentDirectory();
|
||||||
|
src += "/";
|
||||||
|
src += cmSystemTools::GetFilenameName(sourceName);
|
||||||
|
}
|
||||||
|
|
||||||
// check to see if it exists
|
// check to see if it exists
|
||||||
cmSourceFile* ret = this->GetSource(sourceName);
|
cmSourceFile* ret = this->GetSource(src.c_str());
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we must create one
|
// we must create one
|
||||||
std::string newfile = sourceName;
|
|
||||||
cmSourceFile file;
|
cmSourceFile file;
|
||||||
std::string path = cmSystemTools::GetFilenamePath(newfile);
|
path = cmSystemTools::GetFilenamePath(src);
|
||||||
if(generated)
|
if(generated)
|
||||||
{
|
{
|
||||||
std::string ext = cmSystemTools::GetFilenameLastExtension(newfile);
|
std::string ext = cmSystemTools::GetFilenameLastExtension(src);
|
||||||
std::string name_no_ext = cmSystemTools::GetFilenameName(newfile.c_str());
|
std::string name_no_ext = cmSystemTools::GetFilenameName(src.c_str());
|
||||||
name_no_ext = name_no_ext.substr(0, name_no_ext.length()-ext.length());
|
name_no_ext = name_no_ext.substr(0, name_no_ext.length()-ext.length());
|
||||||
if ( ext.length() && ext[0] == '.' )
|
if ( ext.length() && ext[0] == '.' )
|
||||||
{
|
{
|
||||||
ext = ext.substr(1);
|
ext = ext.substr(1);
|
||||||
}
|
}
|
||||||
if((path.size() && path[0] == '/') ||
|
file.SetName(name_no_ext.c_str(), path.c_str(), ext.c_str(), false);
|
||||||
(path.size() > 1 && path[1] == ':'))
|
|
||||||
{
|
|
||||||
file.SetName(name_no_ext.c_str(), path.c_str(), ext.c_str(), false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
file.SetName(name_no_ext.c_str(), this->GetCurrentOutputDirectory(),
|
|
||||||
ext.c_str(), false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if this is a full path then
|
file.SetName(cmSystemTools::GetFilenameName(src.c_str()).c_str(),
|
||||||
if((path.size() && path[0] == '/') ||
|
path.c_str(),
|
||||||
(path.size() > 1 && path[1] == ':'))
|
this->GetSourceExtensions(),
|
||||||
{
|
this->GetHeaderExtensions());
|
||||||
file.SetName(cmSystemTools::GetFilenameName(newfile.c_str()).c_str(),
|
|
||||||
path.c_str(),
|
|
||||||
this->GetSourceExtensions(),
|
|
||||||
this->GetHeaderExtensions());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
file.SetName(newfile.c_str(), this->GetCurrentDirectory(),
|
|
||||||
this->GetSourceExtensions(),
|
|
||||||
this->GetHeaderExtensions());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// add the source file to the makefile
|
// add the source file to the makefile
|
||||||
this->AddSource(file);
|
this->AddSource(file);
|
||||||
ret = this->GetSource(sourceName);
|
src = file.GetFullPath();
|
||||||
|
ret = this->GetSource(src.c_str());
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
cmSystemTools::Error(
|
cmSystemTools::Error(
|
||||||
|
@ -54,12 +54,26 @@ void cmTarget::GenerateSourceFilesFromSourceLists( cmMakefile &mf)
|
|||||||
mf.ExpandVariablesInString(temps);
|
mf.ExpandVariablesInString(temps);
|
||||||
|
|
||||||
// Next if one wasn't found then assume it is a single class
|
// Next if one wasn't found then assume it is a single class
|
||||||
|
// check to see if it is an existing source file
|
||||||
if (!done && mf.GetSource(temps.c_str()))
|
if (!done && mf.GetSource(temps.c_str()))
|
||||||
{
|
{
|
||||||
m_SourceFiles.push_back(mf.GetSource(temps.c_str()));
|
m_SourceFiles.push_back(mf.GetSource(temps.c_str()));
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check to see if it is an existing source file in the output directory
|
||||||
|
if (!done && cmSystemTools::GetFilenamePath(temps).empty())
|
||||||
|
{
|
||||||
|
std::string testName = mf.GetCurrentOutputDirectory();
|
||||||
|
testName += "/";
|
||||||
|
testName += temps;
|
||||||
|
if (mf.GetSource(testName.c_str()))
|
||||||
|
{
|
||||||
|
m_SourceFiles.push_back(mf.GetSource(testName.c_str()));
|
||||||
|
done = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if it wasn't a source file listed with the makefile
|
// 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
|
// 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
|
// where a source list would be passed into here, by making it
|
||||||
|
Loading…
x
Reference in New Issue
Block a user