diff options
author | Brad King <brad.king@kitware.com> | 2007-10-12 13:51:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2007-10-12 13:51:28 (GMT) |
commit | 48762a51dd157400a4dc5cb357d3f0e9e337b5cd (patch) | |
tree | 095390b96abfb37d6cb1d9fc0340cbaa9c753997 /Source/cmDependsFortran.cxx | |
parent | 9f1eea193ec103041dbf3cf2159eb1ff847e554e (diff) | |
download | CMake-48762a51dd157400a4dc5cb357d3f0e9e337b5cd.zip CMake-48762a51dd157400a4dc5cb357d3f0e9e337b5cd.tar.gz CMake-48762a51dd157400a4dc5cb357d3f0e9e337b5cd.tar.bz2 |
ENH: When an object file requires a module add the file-level dependency between the object file and the module timestamp file. Create a dummy timestamp file in case nothing in the project actually creates the module. See bug#5809.
Diffstat (limited to 'Source/cmDependsFortran.cxx')
-rw-r--r-- | Source/cmDependsFortran.cxx | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 27ec340..9a42664 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -17,6 +17,8 @@ #include "cmDependsFortran.h" #include "cmSystemTools.h" +#include "cmLocalGenerator.h" +#include "cmMakefile.h" #include "cmDependsFortranParser.h" /* Interface to parser object. */ @@ -119,6 +121,10 @@ bool cmDependsFortran::WriteDependencies(const char *src, const char *obj, return false; } + // Get the directory in which stamp files will be stored. + std::string stamp_dir = + this->LocalGenerator->GetMakefile()->GetCurrentOutputDirectory(); + // Create the parser object. cmDependsFortranParser parser(this); @@ -157,6 +163,38 @@ bool cmDependsFortran::WriteDependencies(const char *src, const char *obj, // create an empty proxy in case no other source provides it makeDepends << i->c_str() << ".mod.proxy:" << std::endl; + + // The object file should depend on timestamped files for the + // modules it uses. + std::string m = cmSystemTools::LowerCase(*i); + makeDepends << obj << ": " << m.c_str() << ".mod.stamp\n"; + + // Create a dummy timestamp file for the module. + std::string fullPath = stamp_dir; + fullPath += "/"; + fullPath += m; + fullPath += ".mod.stamp"; + if(!cmSystemTools::FileExists(fullPath.c_str())) + { + std::ofstream dummy(fullPath.c_str()); + dummy + << "This is a fake module timestamp file created by CMake because\n" + << " " << src << "\n" + << "requires the module and\n" + << " " << obj << "\n" + << "depends on this timestamp file.\n" + << "\n" + << "If another source in the same directory provides the module\n" + << "this file will be overwritten with a real module timestamp that\n" + << "is updated when the module is rebuilt.\n" + << "\n" + << "If no source in the directory provides the module at least the\n" + << "project will build without failing to find the module timestamp.\n" + << "\n" + << "In the future CMake may be able to locate modules in other directories\n" + << "or outside the project and update this timestamp file as necessary.\n" + ; + } } } |