瀏覽代碼

better ctest support

Ken Martin 24 年之前
父節點
當前提交
ab0ef5b6a0
共有 1 個文件被更改,包括 14 次插入5 次删除
  1. 14 5
      Source/cmUnixMakefileGenerator.cxx

+ 14 - 5
Source/cmUnixMakefileGenerator.cxx

@@ -1153,11 +1153,6 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
                        "all",
                        "cmake.depends ${TARGETS} ${SUBDIR_BUILD} ${CMAKE_COMMAND}",
                        0);
-  this->OutputMakeRule(fout, 
-                       "run any tests",
-                       "test",
-                       "",
-                       "ctest");
   this->OutputMakeRule(fout, 
                        "remove generated files",
                        "clean",
@@ -1224,6 +1219,20 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
                          0,
                          "echo \"cmake might be out of date\"");
     }
+
+  // find ctest
+  std::string ctest = m_Makefile->GetDefinition("CMAKE_COMMAND");
+  ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
+  ctest += "/";
+  ctest += "ctest";
+  if (cmSystemTools::FileExists(ctest.c_str()))
+    {
+    this->OutputMakeRule(fout, 
+                         "run any tests",
+                         "test",
+                         "",
+                         ctest.c_str());
+    }
 }