From 9ebfec08a00c88f12fdb8aa3213f209d01a168cd Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Thu, 23 May 2002 10:34:36 -0400 Subject: only add test target if testing is enabled and ctest is found --- Source/cmDSWWriter.cxx | 19 +++++++++++++++++-- Source/cmMSDotNETGenerator.cxx | 19 +++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/Source/cmDSWWriter.cxx b/Source/cmDSWWriter.cxx index eeff7c1..147ac0b 100644 --- a/Source/cmDSWWriter.cxx +++ b/Source/cmDSWWriter.cxx @@ -112,8 +112,23 @@ void cmDSWWriter::WriteDSWFile(std::ostream& fout) ctest += "ctest"; ctest += cmSystemTools::GetExecutableExtension(); } - m_Makefile->AddUtilityCommand("RUN_TESTS", ctest.c_str(), "-D $(IntDir)", - false); + // if we found ctest + if (cmSystemTools::FileExists(ctest.c_str())) + { + // Create a full path filename for output Testfile + std::string fname; + fname = m_Makefile->GetStartOutputDirectory(); + fname += "/"; + fname += "DartTestfile.txt"; + + // If the file doesn't exist, then ENABLE_TESTING hasn't been run + if (cmSystemTools::FileExists(fname.c_str())) + { + m_Makefile->AddUtilityCommand("RUN_TESTS", ctest.c_str(), "-D $(IntDir)", + false); + } + } + m_Makefile->FindSubDirectoryCMakeListsFiles(allListFiles); // For each cmMakefile, create a DSP for it, and // add it to this DSW file diff --git a/Source/cmMSDotNETGenerator.cxx b/Source/cmMSDotNETGenerator.cxx index a4937c9..4839bf8 100644 --- a/Source/cmMSDotNETGenerator.cxx +++ b/Source/cmMSDotNETGenerator.cxx @@ -182,8 +182,23 @@ void cmMSDotNETGenerator::WriteSLNFile(std::ostream& fout) ctest += "ctest"; ctest += cmSystemTools::GetExecutableExtension(); } - m_Makefile->AddUtilityCommand("RUN_TESTS", ctest.c_str(), "-D $(IntDir)", - false); + // if we found ctest + if (cmSystemTools::FileExists(ctest.c_str())) + { + // Create a full path filename for output Testfile + std::string fname; + fname = m_Makefile->GetStartOutputDirectory(); + fname += "/"; + fname += "DartTestfile.txt"; + + // If the file doesn't exist, then ENABLE_TESTING hasn't been run + if (cmSystemTools::FileExists(fname.c_str())) + { + m_Makefile->AddUtilityCommand("RUN_TESTS", ctest.c_str(), "-D $(IntDir)", + false); + } + } + m_Makefile->FindSubDirectoryCMakeListsFiles(allListFiles); // For each cmMakefile, create a VCProj for it, and // add it to this SLN file -- cgit v0.12