diff options
Diffstat (limited to 'Source/cmDependsFortran.cxx')
-rw-r--r-- | Source/cmDependsFortran.cxx | 109 |
1 files changed, 57 insertions, 52 deletions
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index e4a146c..8fc8347 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -34,11 +34,11 @@ public: std::string Source; // Set of provided and required modules. - std::set<cmStdString> Provides; - std::set<cmStdString> Requires; + std::set<std::string> Provides; + std::set<std::string> Requires; // Set of files included in the translation unit. - std::set<cmStdString> Includes; + std::set<std::string> Includes; }; //---------------------------------------------------------------------------- @@ -98,24 +98,24 @@ class cmDependsFortranInternals { public: // The set of modules provided by this target. - std::set<cmStdString> TargetProvides; + std::set<std::string> TargetProvides; // Map modules required by this target to locations. - typedef std::map<cmStdString, cmStdString> TargetRequiresMap; + typedef std::map<std::string, std::string> TargetRequiresMap; TargetRequiresMap TargetRequires; // Information about each object file. - typedef std::map<cmStdString, cmDependsFortranSourceInfo> ObjectInfoMap; + typedef std::map<std::string, cmDependsFortranSourceInfo> ObjectInfoMap; ObjectInfoMap ObjectInfo; cmDependsFortranSourceInfo& CreateObjectInfo(const char* obj, const char* src) { - std::map<cmStdString, cmDependsFortranSourceInfo>::iterator i = + std::map<std::string, cmDependsFortranSourceInfo>::iterator i = this->ObjectInfo.find(obj); if(i == this->ObjectInfo.end()) { - std::map<cmStdString, cmDependsFortranSourceInfo>::value_type + std::map<std::string, cmDependsFortranSourceInfo>::value_type entry(obj, cmDependsFortranSourceInfo()); i = this->ObjectInfo.insert(entry).first; i->second.Source = src; @@ -260,8 +260,8 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, cmGeneratedFileStream fiStream(fiName.c_str()); fiStream << "# The fortran modules provided by this target.\n"; fiStream << "provides\n"; - std::set<cmStdString> const& provides = this->Internal->TargetProvides; - for(std::set<cmStdString>::const_iterator i = provides.begin(); + std::set<std::string> const& provides = this->Internal->TargetProvides; + for(std::set<std::string>::const_iterator i = provides.begin(); i != provides.end(); ++i) { fiStream << " " << *i << "\n"; @@ -275,7 +275,7 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, cmGeneratedFileStream fcStream(fcName.c_str()); fcStream << "# Remove fortran modules provided by this target.\n"; fcStream << "FILE(REMOVE"; - for(std::set<cmStdString>::const_iterator i = provides.begin(); + for(std::set<std::string>::const_iterator i = provides.begin(); i != provides.end(); ++i) { std::string mod_upper = mod_dir; @@ -292,15 +292,15 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, stamp += ".mod.stamp"; fcStream << "\n"; fcStream << " \"" << - this->LocalGenerator->Convert(mod_lower.c_str(), + this->LocalGenerator->Convert(mod_lower, cmLocalGenerator::START_OUTPUT) << "\"\n"; fcStream << " \"" << - this->LocalGenerator->Convert(mod_upper.c_str(), + this->LocalGenerator->Convert(mod_upper, cmLocalGenerator::START_OUTPUT) << "\"\n"; fcStream << " \"" << - this->LocalGenerator->Convert(stamp.c_str(), + this->LocalGenerator->Convert(stamp, cmLocalGenerator::START_OUTPUT) << "\"\n"; } @@ -319,14 +319,14 @@ void cmDependsFortran::LocateModules() infoI != objInfo.end(); ++infoI) { cmDependsFortranSourceInfo const& info = infoI->second; - for(std::set<cmStdString>::const_iterator i = info.Provides.begin(); + for(std::set<std::string>::const_iterator i = info.Provides.begin(); i != info.Provides.end(); ++i) { // Include this module in the set provided by this target. this->Internal->TargetProvides.insert(*i); } - for(std::set<cmStdString>::const_iterator i = info.Requires.begin(); + for(std::set<std::string>::const_iterator i = info.Requires.begin(); i != info.Requires.end(); ++i) { // Include this module in the set required by this target. @@ -368,8 +368,8 @@ void cmDependsFortran::LocateModules() void cmDependsFortran::MatchLocalModules() { const char* stampDir = this->TargetDirectory.c_str(); - std::set<cmStdString> const& provides = this->Internal->TargetProvides; - for(std::set<cmStdString>::const_iterator i = provides.begin(); + std::set<std::string> const& provides = this->Internal->TargetProvides; + for(std::set<std::string>::const_iterator i = provides.begin(); i != provides.end(); ++i) { this->ConsiderModule(i->c_str(), stampDir); @@ -443,26 +443,31 @@ cmDependsFortran const char* src = info.Source.c_str(); // Write the include dependencies to the output stream. - internalDepends << obj << std::endl; + std::string obj_i = + this->LocalGenerator->Convert(obj, cmLocalGenerator::HOME_OUTPUT); + std::string obj_m = + this->LocalGenerator->ConvertToOutputFormat(obj_i, + cmLocalGenerator::MAKERULE); + internalDepends << obj_i << std::endl; internalDepends << " " << src << std::endl; - for(std::set<cmStdString>::const_iterator i = info.Includes.begin(); + for(std::set<std::string>::const_iterator i = info.Includes.begin(); i != info.Includes.end(); ++i) { - makeDepends << obj << ": " << - this->LocalGenerator->Convert(i->c_str(), + makeDepends << obj_m << ": " << + this->LocalGenerator->Convert(*i, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE) + cmLocalGenerator::MAKERULE) << std::endl; - internalDepends << " " << i->c_str() << std::endl; + internalDepends << " " << *i << std::endl; } makeDepends << std::endl; // Write module requirements to the output stream. - for(std::set<cmStdString>::const_iterator i = info.Requires.begin(); + for(std::set<std::string>::const_iterator i = info.Requires.begin(); i != info.Requires.end(); ++i) { // Require only modules not provided in the same source. - if(std::set<cmStdString>::const_iterator(info.Provides.find(*i)) != + if(std::set<std::string>::const_iterator(info.Provides.find(*i)) != info.Provides.end()) { continue; @@ -480,12 +485,12 @@ cmDependsFortran proxy += "/"; proxy += *i; proxy += ".mod.proxy"; - proxy = this->LocalGenerator->Convert(proxy.c_str(), + proxy = this->LocalGenerator->Convert(proxy, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE); + cmLocalGenerator::MAKERULE); // since we require some things add them to our list of requirements - makeDepends << obj << ".requires: " << proxy << std::endl; + makeDepends << obj_m << ".requires: " << proxy << std::endl; } // The object file should depend on timestamped files for the @@ -497,10 +502,10 @@ cmDependsFortran { // This module is known. Depend on its timestamp file. std::string stampFile = - this->LocalGenerator->Convert(required->second.c_str(), + this->LocalGenerator->Convert(required->second, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE); - makeDepends << obj << ": " << stampFile << "\n"; + cmLocalGenerator::MAKERULE); + makeDepends << obj_m << ": " << stampFile << "\n"; } else { @@ -510,26 +515,26 @@ cmDependsFortran if(this->FindModule(*i, module)) { module = - this->LocalGenerator->Convert(module.c_str(), + this->LocalGenerator->Convert(module, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE); - makeDepends << obj << ": " << module << "\n"; + cmLocalGenerator::MAKERULE); + makeDepends << obj_m << ": " << module << "\n"; } } } // Write provided modules to the output stream. - for(std::set<cmStdString>::const_iterator i = info.Provides.begin(); + for(std::set<std::string>::const_iterator i = info.Provides.begin(); i != info.Provides.end(); ++i) { std::string proxy = stamp_dir; proxy += "/"; proxy += *i; proxy += ".mod.proxy"; - proxy = this->LocalGenerator->Convert(proxy.c_str(), + proxy = this->LocalGenerator->Convert(proxy, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE); - makeDepends << proxy << ": " << obj << ".provides" << std::endl; + cmLocalGenerator::MAKERULE); + makeDepends << proxy << ": " << obj_m << ".provides" << std::endl; } // If any modules are provided then they must be converted to stamp files. @@ -537,8 +542,8 @@ cmDependsFortran { // Create a target to copy the module after the object file // changes. - makeDepends << obj << ".provides.build:\n"; - for(std::set<cmStdString>::const_iterator i = info.Provides.begin(); + makeDepends << obj_m << ".provides.build:\n"; + for(std::set<std::string>::const_iterator i = info.Provides.begin(); i != info.Provides.end(); ++i) { // Include this module in the set provided by this target. @@ -552,7 +557,7 @@ cmDependsFortran modFile += "/"; modFile += *i; modFile = - this->LocalGenerator->Convert(modFile.c_str(), + this->LocalGenerator->Convert(modFile, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::SHELL); std::string stampFile = stamp_dir; @@ -560,7 +565,7 @@ cmDependsFortran stampFile += m; stampFile += ".mod.stamp"; stampFile = - this->LocalGenerator->Convert(stampFile.c_str(), + this->LocalGenerator->Convert(stampFile, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::SHELL); makeDepends << "\t$(CMAKE_COMMAND) -E cmake_copy_f90_mod " @@ -575,17 +580,17 @@ cmDependsFortran } // After copying the modules update the timestamp file so that // copying will not be done again until the source rebuilds. - makeDepends << "\t$(CMAKE_COMMAND) -E touch " << obj + makeDepends << "\t$(CMAKE_COMMAND) -E touch " << obj_m << ".provides.build\n"; // Make sure the module timestamp rule is evaluated by the time // the target finishes building. std::string driver = this->TargetDirectory; driver += "/build"; - driver = this->LocalGenerator->Convert(driver.c_str(), + driver = this->LocalGenerator->Convert(driver, cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE); - makeDepends << driver << ": " << obj << ".provides.build\n"; + cmLocalGenerator::MAKERULE); + makeDepends << driver << ": " << obj_m << ".provides.build\n"; } return true; @@ -666,7 +671,7 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args) if(!cmSystemTools::CopyFileAlways(mod_upper.c_str(), stamp.c_str())) { std::cerr << "Error copying Fortran module from \"" - << mod_upper.c_str() << "\" to \"" << stamp.c_str() + << mod_upper << "\" to \"" << stamp << "\".\n"; return false; } @@ -681,7 +686,7 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args) if(!cmSystemTools::CopyFileAlways(mod_lower.c_str(), stamp.c_str())) { std::cerr << "Error copying Fortran module from \"" - << mod_lower.c_str() << "\" to \"" << stamp.c_str() + << mod_lower << "\" to \"" << stamp << "\".\n"; return false; } @@ -689,9 +694,9 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args) return true; } - std::cerr << "Error copying Fortran module \"" << args[2].c_str() - << "\". Tried \"" << mod_upper.c_str() - << "\" and \"" << mod_lower.c_str() << "\".\n"; + std::cerr << "Error copying Fortran module \"" << args[2] + << "\". Tried \"" << mod_upper + << "\" and \"" << mod_lower << "\".\n"; return false; } |