diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 61f5e23a6..d12054790 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -90,8 +90,9 @@ cmDependsFortran::cmDependsFortran(): } //---------------------------------------------------------------------------- -cmDependsFortran::cmDependsFortran(std::vector const& includes): - IncludePath(&includes) +cmDependsFortran::cmDependsFortran(std::vector const& includes, + std::string const& targetDirectory): + IncludePath(&includes), TargetDirectory(targetDirectory) { } @@ -267,8 +268,12 @@ bool cmDependsFortran::WriteDependencies(const char *src, const char *obj, // Make sure the module timestamp rule is evaluated by the time // the target finishes building. - makeDepends << cmSystemTools::GetFilenamePath(obj) << "/build: " - << obj << ".provides.build\n"; + std::string driver = this->TargetDirectory; + driver += "/build"; + driver = this->LocalGenerator->Convert(driver.c_str(), + cmLocalGenerator::HOME_OUTPUT, + cmLocalGenerator::MAKEFILE); + makeDepends << driver << ": " << obj << ".provides.build\n"; } /* diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index e00681ef7..3b35315a4 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -31,9 +31,10 @@ public: /** Scanning need to know the build directory name, the relative path from the build directory to the target file, the source - file from which to start scanning, and the include file search - path. */ - cmDependsFortran(std::vector const& includes); + file from which to start scanning, the include file search + path, and the target directory. */ + cmDependsFortran(std::vector const& includes, + std::string const& targetDirectory); /** Virtual destructor to cleanup subclasses properly. */ virtual ~cmDependsFortran(); @@ -61,6 +62,9 @@ protected: // The include file search path. std::vector const* IncludePath; + // The full path to the target's build directory. + std::string TargetDirectory; + private: cmDependsFortran(cmDependsFortran const&); // Purposely not implemented. void operator=(cmDependsFortran const&); // Purposely not implemented. diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f6c091abb..f113987cd 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1367,7 +1367,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(const char* tgtInfo) #ifdef CMAKE_BUILD_WITH_CMAKE else if(lang == "Fortran") { - scanner = new cmDependsFortran(includes); + scanner = new cmDependsFortran(includes, dir); } else if(lang == "Java") {