diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index cbc8c8ba3..ea45e3c09 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -64,13 +64,16 @@ struct cmFortranFile struct cmFortranParser_s { - cmFortranParser_s(cmDependsFortran* self, - std::set& ppDefines, - cmFortranSourceInfo& info); + cmFortranParser_s(std::vector const& includes, + std::set& ppDefines, + cmFortranSourceInfo& info); ~cmFortranParser_s(); - // Pointer back to the main class. - cmDependsFortran* Self; + bool FindIncludeFile(const char* dir, const char* includeName, + std::string& fileName); + + // The include file search path. + std::vector IncludePath; // Lexical scanner instance. yyscan_t Scanner; @@ -201,7 +204,7 @@ bool cmDependsFortran::WriteDependencies( // Create the parser object. The constructor takes ppMacro and info per // reference, so we may look into the resulting objects later. - cmFortranParser parser(this, ppDefines, info); + cmFortranParser parser(this->IncludePath, ppDefines, info); // Push on the starting file. cmFortranParser_FilePush(&parser, src.c_str()); @@ -885,9 +888,9 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, } //---------------------------------------------------------------------------- -bool cmDependsFortran::FindIncludeFile(const char* dir, - const char* includeName, - std::string& fileName) +bool cmFortranParser_s::FindIncludeFile(const char* dir, + const char* includeName, + std::string& fileName) { // If the file is a full path, include it directly. if(cmSystemTools::FileIsFullPath(includeName)) @@ -927,10 +930,10 @@ bool cmDependsFortran::FindIncludeFile(const char* dir, //---------------------------------------------------------------------------- cmFortranParser_s -::cmFortranParser_s(cmDependsFortran* self, - std::set& ppDefines, - cmFortranSourceInfo& info): - Self(self), PPDefinitions(ppDefines), Info(info) +::cmFortranParser_s(std::vector const& includes, + std::set& ppDefines, + cmFortranSourceInfo& info): + IncludePath(includes), PPDefinitions(ppDefines), Info(info) { this->InInterface = 0; this->InPPFalseBranch = 0; @@ -1100,7 +1103,7 @@ void cmFortranParser_RuleInclude(cmFortranParser* parser, // problem because either the source will not compile or the user // does not care about depending on this included source. std::string fullName; - if(parser->Self->FindIncludeFile(dir.c_str(), name, fullName)) + if(parser->FindIncludeFile(dir.c_str(), name, fullName)) { // Found the included file. Save it in the set of included files. parser->Info.Includes.insert(fullName); diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index 9f280886a..db2df1967 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -46,12 +46,6 @@ public: static bool ModulesDiffer(const char* modFile, const char* stampFile, const char* compilerId); - /** Method to find an included file in the include path. Fortran - always searches the directory containing the including source - first. */ - bool FindIncludeFile(const char* dir, const char* includeName, - std::string& fileName); - protected: // Finalize the dependency information for the target. virtual bool Finalize(std::ostream& makeDepends,