Browse Source

better ctest support

Ken Martin 24 years ago
parent
commit
ab0ef5b6a0
1 changed files with 14 additions and 5 deletions
  1. 14 5
      Source/cmUnixMakefileGenerator.cxx

+ 14 - 5
Source/cmUnixMakefileGenerator.cxx

@@ -1153,11 +1153,6 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
                        "all",
                        "all",
                        "cmake.depends ${TARGETS} ${SUBDIR_BUILD} ${CMAKE_COMMAND}",
                        "cmake.depends ${TARGETS} ${SUBDIR_BUILD} ${CMAKE_COMMAND}",
                        0);
                        0);
-  this->OutputMakeRule(fout, 
-                       "run any tests",
-                       "test",
-                       "",
-                       "ctest");
   this->OutputMakeRule(fout, 
   this->OutputMakeRule(fout, 
                        "remove generated files",
                        "remove generated files",
                        "clean",
                        "clean",
@@ -1224,6 +1219,20 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
                          0,
                          0,
                          "echo \"cmake might be out of date\"");
                          "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());
+    }
 }
 }