From ab0ef5b6a09fd03e340ed81f48a47f5615de7be0 Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Thu, 23 Aug 2001 11:32:56 -0400 Subject: [PATCH] better ctest support --- Source/cmUnixMakefileGenerator.cxx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx index 9a878e7105..209765bf10 100644 --- a/Source/cmUnixMakefileGenerator.cxx +++ b/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()); + } }