summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-19 19:36:00 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-20 12:48:41 (GMT)
commit7b5f85677c8aa067a5fef1cc68f4d8c8600693fa (patch)
tree1f5d9a419980bb89df73afae0d44aba8c731b314 /Source/cmMakefileTargetGenerator.cxx
parent1777570fe5eb194d930f6716865bc909269da57e (diff)
downloadCMake-7b5f85677c8aa067a5fef1cc68f4d8c8600693fa.zip
CMake-7b5f85677c8aa067a5fef1cc68f4d8c8600693fa.tar.gz
CMake-7b5f85677c8aa067a5fef1cc68f4d8c8600693fa.tar.bz2
Fortran: Use module dir flag if needed for default module directory
Our buildsystem model says that the default Fortran module output directory is the build tree directory corresponding to the source tree `CMakeLists.txt` file adding the current target. Extend `cmGeneratorTarget::GetFortranModuleDirectory` to allow generators to pass in the compiler working directory. If the working directory does not match the default Fortran module output directory then we need an explicit module directory flag (e.g. `-J`) to tell the compiler to put/use modules in the latter. This does not affect the Makefile generator but will be useful for future introduction of Fortran support to the Ninja generator.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 014feb9..e0d9fda 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -993,12 +993,16 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
*this->InfoFileStream << " )\n";
}
+ std::string const& working_dir =
+ this->LocalGenerator->GetCurrentBinaryDirectory();
+
/* clang-format off */
*this->InfoFileStream
<< "\n"
<< "# Fortran module output directory.\n"
<< "set(CMAKE_Fortran_TARGET_MODULE_DIR \""
- << this->GeneratorTarget->GetFortranModuleDirectory() << "\")\n";
+ << this->GeneratorTarget->GetFortranModuleDirectory(working_dir)
+ << "\")\n";
/* clang-format on */
// and now write the rule to use it