浏览代码

BUG: Fix OS X AppBundle/FW byproducts dependencies

App Bundle and Framework directories, symlinks, and Info.plist files we
create during generation are byproducts, not outputs.  We should re-run
CMake only when they are missing, not when they are old.
See issue #8465.
Brad King 16 年之前
父节点
当前提交
2282748907
共有 2 个文件被更改,包括 38 次插入9 次删除
  1. 17 9
      Source/cmGlobalUnixMakefileGenerator3.cxx
  2. 21 0
      Source/cmake.cxx

+ 17 - 9
Source/cmGlobalUnixMakefileGenerator3.cxx

@@ -352,18 +352,26 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
     cmakefileStream << "  \"" << 
     cmakefileStream << "  \"" << 
       lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str() 
       lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str() 
                     << "\"\n";
                     << "\"\n";
-    const std::vector<std::string>& outfiles = 
-      lg->GetMakefile()->GetOutputFiles();
-    for(std::vector<std::string>::const_iterator k= outfiles.begin();
-        k != outfiles.end(); ++k)
-      {
-      cmakefileStream << "  \"" << 
-        lg->Convert(k->c_str(),cmLocalGenerator::HOME_OUTPUT).c_str() 
-                      << "\"\n";
-      }
     }
     }
   cmakefileStream << "  )\n\n";
   cmakefileStream << "  )\n\n";
 
 
+  // CMake must rerun if a byproduct is missing.
+  {
+  cmakefileStream
+    << "# Byproducts of CMake generate step:\n"
+    << "SET(CMAKE_MAKEFILE_PRODUCTS\n";
+  const std::vector<std::string>& outfiles =
+    lg->GetMakefile()->GetOutputFiles();
+  for(std::vector<std::string>::const_iterator k = outfiles.begin();
+      k != outfiles.end(); ++k)
+    {
+    cmakefileStream << "  \"" <<
+      lg->Convert(k->c_str(),cmLocalGenerator::HOME_OUTPUT).c_str()
+                    << "\"\n";
+    }
+  cmakefileStream << "  )\n\n";
+  }
+
   this->WriteMainCMakefileLanguageRules(cmakefileStream, 
   this->WriteMainCMakefileLanguageRules(cmakefileStream, 
                                         this->LocalGenerators);
                                         this->LocalGenerators);
 }
 }

+ 21 - 0
Source/cmake.cxx

@@ -2657,6 +2657,27 @@ int cmake::CheckBuildSystem()
       }
       }
     }
     }
 
 
+  // If any byproduct of makefile generation is missing we must re-run.
+  std::vector<std::string> products;
+  if(const char* productStr = mf->GetDefinition("CMAKE_MAKEFILE_PRODUCTS"))
+    {
+    cmSystemTools::ExpandListArgument(productStr, products);
+    }
+  for(std::vector<std::string>::const_iterator pi = products.begin();
+      pi != products.end(); ++pi)
+    {
+    if(!cmSystemTools::FileExists(pi->c_str()))
+      {
+      if(verbose)
+        {
+        cmOStringStream msg;
+        msg << "Re-run cmake, missing byproduct: " << *pi << "\n";
+        cmSystemTools::Stdout(msg.str().c_str());
+        }
+      return 1;
+      }
+    }
+
   // Get the set of dependencies and outputs.
   // Get the set of dependencies and outputs.
   std::vector<std::string> depends;
   std::vector<std::string> depends;
   std::vector<std::string> outputs;
   std::vector<std::string> outputs;