diff options
-rw-r--r-- | Source/cmCommonTargetGenerator.cxx | 49 | ||||
-rw-r--r-- | Source/cmCommonTargetGenerator.h | 3 | ||||
-rw-r--r-- | Source/cmLocalCommonGenerator.cxx | 47 | ||||
-rw-r--r-- | Source/cmLocalCommonGenerator.h | 3 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 7 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 2 |
6 files changed, 62 insertions, 49 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index eb1216e..aa7f5c0 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -88,51 +88,6 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags) this->LocalGenerator->AppendFlags(flags, flag); } -void cmCommonTargetGenerator::AddFortranFlags(std::string& flags) -{ - // Enable module output if necessary. - if (const char* modout_flag = - this->Makefile->GetDefinition("CMAKE_Fortran_MODOUT_FLAG")) { - this->LocalGenerator->AppendFlags(flags, modout_flag); - } - - // Add a module output directory flag if necessary. - std::string mod_dir = this->GeneratorTarget->GetFortranModuleDirectory(); - if (!mod_dir.empty()) { - mod_dir = - this->Convert(mod_dir, this->LocalGenerator->GetWorkingDirectory(), - cmOutputConverter::SHELL); - } else { - mod_dir = - this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT"); - } - if (!mod_dir.empty()) { - const char* moddir_flag = - this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG"); - std::string modflag = moddir_flag; - modflag += mod_dir; - this->LocalGenerator->AppendFlags(flags, modflag); - } - - // If there is a separate module path flag then duplicate the - // include path with it. This compiler does not search the include - // path for modules. - if (const char* modpath_flag = - this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) { - std::vector<std::string> includes; - const std::string& config = this->ConfigName; - this->LocalGenerator->GetIncludeDirectories( - includes, this->GeneratorTarget, "C", config); - for (std::vector<std::string>::const_iterator idi = includes.begin(); - idi != includes.end(); ++idi) { - std::string flg = modpath_flag; - flg += - this->Convert(*idi, cmOutputConverter::NONE, cmOutputConverter::SHELL); - this->LocalGenerator->AppendFlags(flags, flg); - } - } -} - void cmCommonTargetGenerator::AppendFortranFormatFlags( std::string& flags, cmSourceFile const& source) { @@ -175,7 +130,9 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string& l) // Fortran-specific flags computed for this target. if (l == "Fortran") { - this->AddFortranFlags(flags); + this->LocalGenerator->AppendFlags( + flags, this->LocalGenerator->GetTargetFortranFlags( + this->GeneratorTarget, this->ConfigName)); } this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang, diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index dc4974c..0bafde9 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -53,9 +53,6 @@ protected: // The windows module definition source file (.def), if any. cmSourceFile const* ModuleDefinitionFile; - // Compute target-specific Fortran language flags. - void AddFortranFlags(std::string& flags); - std::string Convert( std::string const& source, cmOutputConverter::RelativeRoot relative, cmOutputConverter::OutputFormat output = cmOutputConverter::UNCHANGED); diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx index 6cfeb10..5502296 100644 --- a/Source/cmLocalCommonGenerator.cxx +++ b/Source/cmLocalCommonGenerator.cxx @@ -35,3 +35,50 @@ void cmLocalCommonGenerator::SetConfigName() this->ConfigName = ""; } } + +std::string cmLocalCommonGenerator::GetTargetFortranFlags( + cmGeneratorTarget const* target, std::string const& config) +{ + std::string flags; + + // Enable module output if necessary. + if (const char* modout_flag = + this->Makefile->GetDefinition("CMAKE_Fortran_MODOUT_FLAG")) { + this->AppendFlags(flags, modout_flag); + } + + // Add a module output directory flag if necessary. + std::string mod_dir = target->GetFortranModuleDirectory(); + if (!mod_dir.empty()) { + mod_dir = + this->Convert(mod_dir, this->WorkingDirectory, cmOutputConverter::SHELL); + } else { + mod_dir = + this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT"); + } + if (!mod_dir.empty()) { + const char* moddir_flag = + this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG"); + std::string modflag = moddir_flag; + modflag += mod_dir; + this->AppendFlags(flags, modflag); + } + + // If there is a separate module path flag then duplicate the + // include path with it. This compiler does not search the include + // path for modules. + if (const char* modpath_flag = + this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) { + std::vector<std::string> includes; + this->GetIncludeDirectories(includes, target, "C", config); + for (std::vector<std::string>::const_iterator idi = includes.begin(); + idi != includes.end(); ++idi) { + std::string flg = modpath_flag; + flg += + this->Convert(*idi, cmOutputConverter::NONE, cmOutputConverter::SHELL); + this->AppendFlags(flags, flg); + } + } + + return flags; +} diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h index 10380db..fd17ae3 100644 --- a/Source/cmLocalCommonGenerator.h +++ b/Source/cmLocalCommonGenerator.h @@ -33,6 +33,9 @@ public: return this->WorkingDirectory; } + std::string GetTargetFortranFlags(cmGeneratorTarget const* target, + std::string const& config); + protected: cmOutputConverter::RelativeRoot WorkingDirectory; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 2f50b7f..a0263e4 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1344,6 +1344,13 @@ void cmLocalGenerator::GetTargetDefines(cmGeneratorTarget const* target, this->AddCompileDefinitions(defines, target, config, lang.c_str()); } +std::string cmLocalGenerator::GetTargetFortranFlags(cmGeneratorTarget const*, + std::string const&) +{ + // Implemented by specific generators that override this. + return std::string(); +} + std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, OutputFormat format) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index af561f6..d04a723 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -321,6 +321,8 @@ public: std::string GetFrameworkFlags(std::string const& l, std::string const& config, cmGeneratorTarget* target); + virtual std::string GetTargetFortranFlags(cmGeneratorTarget const* target, + std::string const& config); virtual void ComputeObjectFilenames( std::map<cmSourceFile const*, std::string>& mapping, |