diff options
-rw-r--r-- | Source/cmMakeDepend.cxx | 32 | ||||
-rw-r--r-- | Source/cmMakeDepend.h | 4 |
2 files changed, 26 insertions, 10 deletions
diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 78a7c1f..b56f26a 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -80,7 +80,7 @@ void cmMakeDepend::SetMakefile(const cmMakefile* makefile) const cmDependInformation* cmMakeDepend::FindDependencies(const char* file) { - cmDependInformation* info = this->GetDependInformation(file); + cmDependInformation* info = this->GetDependInformation(file,NULL); this->GenerateDependInformation(info); return info; } @@ -235,15 +235,20 @@ void cmMakeDepend::DependWalk(cmDependInformation* info) void cmMakeDepend::AddDependency(cmDependInformation* info, const char* file) { - cmDependInformation* dependInfo = this->GetDependInformation(file); + cmDependInformation* dependInfo = + this->GetDependInformation(file, + cmSystemTools::GetFilenamePath( + cmSystemTools::CollapseFullPath( + info->m_FullPath.c_str())).c_str()); this->GenerateDependInformation(dependInfo); info->AddDependencies(dependInfo); } -cmDependInformation* cmMakeDepend::GetDependInformation(const char* file) +cmDependInformation* cmMakeDepend::GetDependInformation(const char* file, + const char *extraPath) { // Get the full path for the file so that lookup is unambiguous. - std::string fullPath = this->FullPath(file); + std::string fullPath = this->FullPath(file, extraPath); // Try to find the file's instance of cmDependInformation. DependInformationMap::const_iterator result = @@ -279,7 +284,7 @@ void cmMakeDepend::GenerateMakefileDependencies() if(!(*i)->GetIsAHeaderFileOnly()) { cmDependInformation* info = - this->GetDependInformation((*i)->GetFullPath().c_str()); + this->GetDependInformation((*i)->GetFullPath().c_str(),NULL); this->AddFileToSearchPath(info->m_FullPath.c_str()); info->m_cmSourceFile = *i; this->GenerateDependInformation(info); @@ -290,11 +295,11 @@ void cmMakeDepend::GenerateMakefileDependencies() // find the full path to fname by searching the m_IncludeDirectories array -std::string cmMakeDepend::FullPath(const char* fname) +std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath) { if(cmSystemTools::FileExists(fname)) { - return std::string(fname); + return std::string(cmSystemTools::CollapseFullPath(fname)); } for(std::vector<std::string>::iterator i = m_IncludeDirectories.begin(); @@ -305,10 +310,21 @@ std::string cmMakeDepend::FullPath(const char* fname) path = path + fname; if(cmSystemTools::FileExists(path.c_str())) { - return path; + return cmSystemTools::CollapseFullPath(path.c_str()); } } + if (extraPath) + { + std::string path = extraPath; + path = path + "/"; + path = path + fname; + if(cmSystemTools::FileExists(path.c_str())) + { + return cmSystemTools::CollapseFullPath(path.c_str()); + } + } + // Couldn't find the file. return std::string(fname); } diff --git a/Source/cmMakeDepend.h b/Source/cmMakeDepend.h index fd904fa..5e59950 100644 --- a/Source/cmMakeDepend.h +++ b/Source/cmMakeDepend.h @@ -139,14 +139,14 @@ protected: * Get an instance of cmDependInformation corresponding to the given file * name. */ - cmDependInformation* GetDependInformation(const char* file); + cmDependInformation* GetDependInformation(const char* file, const char *extraPath); /** * Find the full path name for the given file name. * This uses the include directories. * TODO: Cache path conversions to reduce FileExists calls. */ - std::string FullPath(const char*); + std::string FullPath(const char *filename, const char *extraPath); const cmMakefile* m_Makefile; bool m_Verbose; |