瀏覽代碼

Merge branch 'user-override-try-compile'

Brad King 15 年之前
父節點
當前提交
a5d67513a2
共有 1 個文件被更改,包括 17 次插入0 次删除
  1. 17 0
      Source/cmCoreTryCompile.cxx

+ 17 - 0
Source/cmCoreTryCompile.cxx

@@ -175,6 +175,23 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
       {
       {
       fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def);
       fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def);
       }
       }
+
+    const char* rulesOverrideBase = "CMAKE_USER_MAKE_RULES_OVERRIDE";
+    std::string rulesOverrideLang =
+      rulesOverrideBase + (lang ? std::string("_") + lang : std::string(""));
+    if(const char* rulesOverridePath =
+       this->Makefile->GetDefinition(rulesOverrideLang.c_str()))
+      {
+      fprintf(fout, "SET(%s \"%s\")\n",
+              rulesOverrideLang.c_str(), rulesOverridePath);
+      }
+    else if(const char* rulesOverridePath2 =
+            this->Makefile->GetDefinition(rulesOverrideBase))
+      {
+      fprintf(fout, "SET(%s \"%s\")\n",
+              rulesOverrideBase, rulesOverridePath2);
+      }
+
     if(lang)
     if(lang)
       {
       {
       fprintf(fout, "PROJECT(CMAKE_TRY_COMPILE %s)\n", lang);
       fprintf(fout, "PROJECT(CMAKE_TRY_COMPILE %s)\n", lang);