summaryrefslogtreecommitdiffstats
path: root/Source/cmCommonTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-06-16 15:14:18 (GMT)
committerBrad King <brad.king@kitware.com>2016-06-17 18:49:29 (GMT)
commit5467e7945d46f5f8540a6e11933c9b6b584036a2 (patch)
treee3a21119976015761066e4c9a3821b6b85bb1873 /Source/cmCommonTargetGenerator.cxx
parent49f10f0d24420f7d96c5153ba64a16b3f43c4736 (diff)
downloadCMake-5467e7945d46f5f8540a6e11933c9b6b584036a2.zip
CMake-5467e7945d46f5f8540a6e11933c9b6b584036a2.tar.gz
CMake-5467e7945d46f5f8540a6e11933c9b6b584036a2.tar.bz2
cmLocalGenerator: Add method to get Fortran-specific compiler flags
Add a cmLocalGenerator::GetTargetFortranFlags virtual method to get generator-specific generation of Fortran-specific flags. Implement it in cmLocalCommonGenerator by moving the implementation from cmCommonTargetGenerator::AddFortranFlags. This will allow it to be used without having a target generator available. Inspired-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'Source/cmCommonTargetGenerator.cxx')
-rw-r--r--Source/cmCommonTargetGenerator.cxx49
1 files changed, 3 insertions, 46 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,