summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx15
1 files changed, 12 insertions, 3 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index bed0b11..f181cf6 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3883,22 +3883,31 @@ void cmGeneratorTarget::GetTargetVersion(bool soversion, int& major,
}
}
-std::string cmGeneratorTarget::GetFortranModuleDirectory() const
+std::string cmGeneratorTarget::GetFortranModuleDirectory(
+ std::string const& working_dir) const
{
if (!this->FortranModuleDirectoryCreated) {
this->FortranModuleDirectory = true;
- this->FortranModuleDirectory = this->CreateFortranModuleDirectory();
+ this->FortranModuleDirectory =
+ this->CreateFortranModuleDirectory(working_dir);
}
return this->FortranModuleDirectory;
}
-std::string cmGeneratorTarget::CreateFortranModuleDirectory() const
+std::string cmGeneratorTarget::CreateFortranModuleDirectory(
+ std::string const& working_dir) const
{
std::string mod_dir;
std::string target_mod_dir;
if (const char* prop = this->GetProperty("Fortran_MODULE_DIRECTORY")) {
target_mod_dir = prop;
+ } else {
+ std::string const& default_mod_dir =
+ this->LocalGenerator->GetCurrentBinaryDirectory();
+ if (default_mod_dir != working_dir) {
+ target_mod_dir = default_mod_dir;
+ }
}
const char* moddir_flag =
this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG");