[cmake-commits] king committed cmDependsFortran.cxx 1.38 1.39 cmDependsFortran.h 1.12 1.13 cmLocalUnixMakefileGenerator3.cxx 1.228 1.229

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Jan 2 11:04:54 EST 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv3218/Source

Modified Files:
	cmDependsFortran.cxx cmDependsFortran.h 
	cmLocalUnixMakefileGenerator3.cxx 
Log Message:
ENH: Make the Fortran compiler id available to cmDependsFortran at scanning and module timestamp copy time.


Index: cmDependsFortran.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsFortran.cxx,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- cmDependsFortran.cxx	31 Dec 2007 16:25:17 -0000	1.38
+++ cmDependsFortran.cxx	2 Jan 2008 16:04:52 -0000	1.39
@@ -536,7 +536,14 @@
                                       cmLocalGenerator::HOME_OUTPUT,
                                       cmLocalGenerator::SHELL);
       makeDepends << "\t$(CMAKE_COMMAND) -E cmake_copy_f90_mod "
-                  << modFile << " " << stampFile << "\n";
+                  << modFile << " " << stampFile;
+      cmMakefile* mf = this->LocalGenerator->GetMakefile();
+      const char* cid = mf->GetDefinition("CMAKE_Fortran_COMPILER_ID");
+      if(cid && *cid)
+        {
+        makeDepends << " " << cid;
+        }
+      makeDepends << "\n";
       }
     // After copying the modules update the timestamp file so that
     // copying will not be done again until the source rebuilds.
@@ -600,6 +607,7 @@
   // Implements
   //
   //   $(CMAKE_COMMAND) -E cmake_copy_f90_mod input.mod output.mod.stamp
+  //                                          [compiler-id]
   //
   // Note that the case of the .mod file depends on the compiler.  In
   // the future this copy could also account for the fact that some
@@ -608,6 +616,11 @@
 
   std::string mod = args[2];
   std::string stamp = args[3];
+  std::string compilerId;
+  if(args.size() >= 5)
+    {
+    compilerId = args[4];
+    }
   std::string mod_dir = cmSystemTools::GetFilenamePath(mod);
   if(!mod_dir.empty()) { mod_dir += "/"; }
   std::string mod_upper = mod_dir;
@@ -619,7 +632,8 @@
   mod_lower += ".mod";
   if(cmSystemTools::FileExists(mod_upper.c_str(), true))
     {
-    if(cmDependsFortran::ModulesDiffer(mod_upper.c_str(), stamp.c_str()))
+    if(cmDependsFortran::ModulesDiffer(mod_upper.c_str(), stamp.c_str(),
+                                       compilerId.c_str()))
       {
       if(!cmSystemTools::CopyFileAlways(mod_upper.c_str(), stamp.c_str()))
         {
@@ -633,7 +647,8 @@
     }
   else if(cmSystemTools::FileExists(mod_lower.c_str(), true))
     {
-    if(cmDependsFortran::ModulesDiffer(mod_lower.c_str(), stamp.c_str()))
+    if(cmDependsFortran::ModulesDiffer(mod_lower.c_str(), stamp.c_str(),
+                                       compilerId.c_str()))
       {
       if(!cmSystemTools::CopyFileAlways(mod_lower.c_str(), stamp.c_str()))
         {
@@ -654,8 +669,10 @@
 
 //----------------------------------------------------------------------------
 bool cmDependsFortran::ModulesDiffer(const char* modFile,
-                                     const char* stampFile)
+                                     const char* stampFile,
+                                     const char* compilerId)
 {
+  (void)compilerId;
   /*
   This following is valid for intel and gnu. For others this may be valid
   too, but has to be proven.

Index: cmLocalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v
retrieving revision 1.228
retrieving revision 1.229
diff -u -d -r1.228 -r1.229
--- cmLocalUnixMakefileGenerator3.cxx	28 Dec 2007 16:50:14 -0000	1.228
+++ cmLocalUnixMakefileGenerator3.cxx	2 Jan 2008 16:04:52 -0000	1.229
@@ -1780,6 +1780,18 @@
       cmakefileStream << "\"" << pi->first << "\"\n";
       }
     cmakefileStream << "  )\n";
+
+    // Tell the dependency scanner what compiler is used.
+    std::string cidVar = "CMAKE_";
+    cidVar += l->first;
+    cidVar += "_COMPILER_ID";
+    const char* cid = this->Makefile->GetDefinition(cidVar.c_str());
+    if(cid && *cid)
+      {
+      cmakefileStream
+        << "SET(CMAKE_" << l->first.c_str() << "_COMPILER_ID \""
+        << cid << "\")\n";
+      }
     }
 }
 

Index: cmDependsFortran.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsFortran.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cmDependsFortran.h	31 Dec 2007 16:25:17 -0000	1.12
+++ cmDependsFortran.h	2 Jan 2008 16:04:52 -0000	1.13
@@ -48,7 +48,8 @@
 
   /** Determine if a mod file and the corresponding mod.stamp file
       are representing  different module information. */
-  static bool  ModulesDiffer(const char* modFile, const char* stampFile);
+  static bool  ModulesDiffer(const char* modFile, const char* stampFile,
+                             const char* compilerId);
 
   /** Method to find an included file in the include path.  Fortran
       always searches the directory containing the including source



More information about the Cmake-commits mailing list