ENH: Changed generated includes to not have full path specified.

This commit is contained in:
Brad King 2001-03-16 09:25:18 -05:00
parent be4db9150c
commit df8a7ecafd
2 changed files with 13 additions and 20 deletions

View File

@ -253,16 +253,16 @@ bool cmCableDefineSetCommand::AddSourceFile(const std::string& file)
// We must locate the file in the include path so that we can detect // We must locate the file in the include path so that we can detect
// its extension, and whether there is more than one to find. // its extension, and whether there is more than one to find.
std::string header = file+".h"; std::string header = file+".h";
std::string txx = file+".txx";
m_Makefile->ExpandVariablesInString(header); m_Makefile->ExpandVariablesInString(header);
m_Makefile->ExpandVariablesInString(txx);
// See if the file just exists here. The compiler's search path will // See if the file just exists here. The compiler's search path will
// locate it. // locate it.
if(cmSystemTools::FileExists(header.c_str())) if(cmSystemTools::FileExists(header.c_str()))
{ {
m_SourceHeaders.push_back(header); m_SourceHeaders.push_back(header);
// See if there is a matching .txx as well. // See if there is a matching .txx as well.
std::string txx = file+".txx";
m_Makefile->ExpandVariablesInString(txx);
if(cmSystemTools::FileExists(txx.c_str())) if(cmSystemTools::FileExists(txx.c_str()))
{ {
m_InstantiationSources.push_back(txx); m_InstantiationSources.push_back(txx);
@ -277,15 +277,13 @@ bool cmCableDefineSetCommand::AddSourceFile(const std::string& file)
for(std::vector<std::string>::const_iterator dir = includeDirectories.begin(); for(std::vector<std::string>::const_iterator dir = includeDirectories.begin();
dir != includeDirectories.end(); ++dir) dir != includeDirectories.end(); ++dir)
{ {
std::string path = *dir + "/" + header; std::string path = *dir + "/";
m_Makefile->ExpandVariablesInString(path); m_Makefile->ExpandVariablesInString(path);
if(cmSystemTools::FileExists(path.c_str())) if(cmSystemTools::FileExists((path+header).c_str()))
{ {
m_SourceHeaders.push_back(path); m_SourceHeaders.push_back(header);
// See if there is a matching .txx as well. // See if there is a matching .txx as well.
std::string txx = *dir + "/" + file + ".txx"; if(cmSystemTools::FileExists((path+txx).c_str()))
m_Makefile->ExpandVariablesInString(txx);
if(cmSystemTools::FileExists(txx.c_str()))
{ {
m_InstantiationSources.push_back(txx); m_InstantiationSources.push_back(txx);
} }

View File

@ -28,13 +28,10 @@ void cmCableSourceFilesCommand::FinalPass()
// finder will need hints. Add one for each source file. // finder will need hints. Add one for each source file.
cmClassFile& cFile = m_Makefile->GetClasses()[index]; cmClassFile& cFile = m_Makefile->GetClasses()[index];
std::string curPath = m_Makefile->GetCurrentDirectory();
curPath += "/";
for(Entries::const_iterator f = m_Entries.begin(); for(Entries::const_iterator f = m_Entries.begin();
f != m_Entries.end(); ++f) f != m_Entries.end(); ++f)
{ {
std::string header = curPath+*f+".h"; std::string header = *f+".h";
cFile.m_Depends.push_back(header); cFile.m_Depends.push_back(header);
} }
} }
@ -59,11 +56,9 @@ void cmCableSourceFilesCommand::WriteConfiguration() const
for(Entries::const_iterator f = m_Entries.begin(); for(Entries::const_iterator f = m_Entries.begin();
f != m_Entries.end(); ++f) f != m_Entries.end(); ++f)
{ {
std::string file = curPath+*f;
// Look for the normal include file. // Look for the normal include file.
std::string header = file+".h"; std::string header = *f+".h";
if(cmSystemTools::FileExists(header.c_str())) if(cmSystemTools::FileExists((curPath+header).c_str()))
{ {
os << indent << " <File name=\"" << header.c_str() << "\"/>" os << indent << " <File name=\"" << header.c_str() << "\"/>"
<< std::endl; << std::endl;
@ -74,10 +69,10 @@ void cmCableSourceFilesCommand::WriteConfiguration() const
} }
// Look for an instantiation file. // Look for an instantiation file.
std::string instantiation = file+".txx"; std::string txx = *f+".txx";
if(cmSystemTools::FileExists(instantiation.c_str())) if(cmSystemTools::FileExists((curPath+txx).c_str()))
{ {
os << indent << " <File name=\"" << instantiation.c_str() os << indent << " <File name=\"" << txx.c_str()
<< "\" purpose=\"instantiate\"/>" << std::endl; << "\" purpose=\"instantiate\"/>" << std::endl;
} }
} }