Просмотр исходного кода

BUG#427: Generated makefiles need to have targets with canonical names for each executable and library target in order for try-compiles to work correctly when specifying the target.

Brad King 21 лет назад
Родитель
Сommit
46418e70a3
2 измененных файлов с 12 добавлено и 9 удалено
  1. 0 9
      Source/cmGlobalGenerator.cxx
  2. 12 0
      Source/cmLocalUnixMakefileGenerator.cxx

+ 0 - 9
Source/cmGlobalGenerator.cxx

@@ -479,15 +479,6 @@ int cmGlobalGenerator::TryCompile(const char *, const char *bindir,
     {
     makeCommand += " ";
     makeCommand += target;
-#if defined(_WIN32) || defined(__CYGWIN__)
-    std::string tmp = target;
-    // if the target does not already end in . something 
-    // then assume .exe
-    if(tmp.size() < 4 || tmp[tmp.size()-4] != '.')
-      {
-      makeCommand += ".exe";
-      }
-#endif // WIN32
     }
   else
     {

+ 12 - 0
Source/cmLocalUnixMakefileGenerator.cxx

@@ -1261,6 +1261,9 @@ void cmLocalUnixMakefileGenerator::OutputLibraryRule(std::ostream& fout,
                          depend.c_str(),
                          commands);
     }
+
+  // Add a target with the canonical name (no prefix, suffix or path).
+  this->OutputMakeRule(fout, comment, name, tgt.c_str(), 0);
 }
 
 void cmLocalUnixMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,  
@@ -1537,6 +1540,15 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
                          depend.c_str(),
                          commands);
     }
+
+  // Add a target with the canonical name (no prefix, suffix or path).
+  // Note that on some platforms the "local target" added above will
+  // actually be the canonical name and will have set "target"
+  // correctly.  Do not duplicate this target.
+  if(target != name)
+    {
+    this->OutputMakeRule(fout, comment.c_str(), name, target.c_str(), 0);
+    }
 }