summaryrefslogtreecommitdiffstats
path: root/Source/cmDSWWriter.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2002-05-23 14:34:36 (GMT)
committerKen Martin <ken.martin@kitware.com>2002-05-23 14:34:36 (GMT)
commit9ebfec08a00c88f12fdb8aa3213f209d01a168cd (patch)
tree70c07bc66b4efb3f2f653a04704850a33098ad55 /Source/cmDSWWriter.cxx
parent92c5ff5b4082c1db7d8806f9f884130f3082614b (diff)
downloadCMake-9ebfec08a00c88f12fdb8aa3213f209d01a168cd.zip
CMake-9ebfec08a00c88f12fdb8aa3213f209d01a168cd.tar.gz
CMake-9ebfec08a00c88f12fdb8aa3213f209d01a168cd.tar.bz2
only add test target if testing is enabled and ctest is found
Diffstat (limited to 'Source/cmDSWWriter.cxx')
-rw-r--r--Source/cmDSWWriter.cxx19
1 files changed, 17 insertions, 2 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