[CMake] FORTRAN USE statement dependencies

Joseph Winston josephwinston at mac.com
Fri Nov 30 10:14:25 EST 2007


I'm using the CVS head version of cmake and I've run into the  
following problem with the FORTRAN dependency generator and the USE  
statement.  cmake now creates modname.mod.stamp files and enters them  
into the dependency calculation.  However, the path to the  
modname.mod.stamp is incorrect because it assumes that none of the  
FORTRAN code is in a subdirectory.  The fix to the problem is to add  
the path in the dependency.  Here's a patch that does this.  One  
shortcoming is the patch uses the full path rather than the relative  
paths that are used elsewhere in the depend.make files.

cvs diff -c cmDependsFortran.cxx
Index: cmDependsFortran.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsFortran.cxx,v
retrieving revision 1.25
diff -c -r1.25 cmDependsFortran.cxx
*** cmDependsFortran.cxx	16 Oct 2007 14:19:56 -0000	1.25
--- cmDependsFortran.cxx	30 Nov 2007 15:07:14 -0000
***************
*** 167,179 ****
         // 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());
--- 167,181 ----
         // The object file should depend on timestamped files for the
         // modules it uses.
         std::string m = cmSystemTools::LowerCase(*i);

         std::string fullPath = stamp_dir;
         fullPath += "/";
         fullPath += m;
         fullPath += ".mod.stamp";
+
+       makeDepends << obj << ": " << fullPath << std::endl;
+
+       // Create a dummy timestamp file for the module.
         if(!cmSystemTools::FileExists(fullPath.c_str()))
           {
           std::ofstream dummy(fullPath.c_str());



More information about the CMake mailing list