summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-04-01 20:48:46 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-04-01 20:48:46 (GMT)
commit86cebea79a1934bbd03f08dba884a965b7ae3b5d (patch)
treef547bb2c7fcbb981e908271db6811e45eb6015bd /Source/cmGlobalGenerator.cxx
parent6cd36d16e518822fd95e7d044cfe265bddf3bb07 (diff)
downloadCMake-86cebea79a1934bbd03f08dba884a965b7ae3b5d.zip
CMake-86cebea79a1934bbd03f08dba884a965b7ae3b5d.tar.gz
CMake-86cebea79a1934bbd03f08dba884a965b7ae3b5d.tar.bz2
ENH: More ctest changes and move SetupTest to superclass
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx74
1 files changed, 74 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 24291e1..d63ff02 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -989,3 +989,77 @@ cmGlobalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
return relative;
}
+inline std::string removeQuotes(const std::string& s)
+{
+ if(s[0] == '\"' && s[s.size()-1] == '\"')
+ {
+ return s.substr(1, s.size()-2);
+ }
+ return s;
+}
+
+void cmGlobalGenerator::SetupTests()
+{
+ std::string ctest =
+ m_LocalGenerators[0]->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
+ ctest = removeQuotes(ctest);
+ ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
+ ctest += "/";
+ ctest += "ctest";
+ ctest += cmSystemTools::GetExecutableExtension();
+ if(!cmSystemTools::FileExists(ctest.c_str()))
+ {
+ ctest =
+ m_LocalGenerators[0]->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
+ ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
+ ctest += "/Debug/";
+ ctest += "ctest";
+ ctest += cmSystemTools::GetExecutableExtension();
+ }
+ if(!cmSystemTools::FileExists(ctest.c_str()))
+ {
+ ctest =
+ m_LocalGenerators[0]->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
+ ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
+ ctest += "/Release/";
+ ctest += "ctest";
+ ctest += cmSystemTools::GetExecutableExtension();
+ }
+ // if we found ctest
+ if (cmSystemTools::FileExists(ctest.c_str()))
+ {
+ // Create a full path filename for output Testfile
+ std::string fname;
+ fname = m_CMakeInstance->GetStartOutputDirectory();
+ fname += "/";
+ if ( m_LocalGenerators[0]->GetMakefile()->IsSet("DART_ROOT") )
+ {
+ fname += "DartTestfile.txt";
+ }
+ else
+ {
+ fname += "CTestTestfile.txt";
+ }
+
+ // If the file doesn't exist, then ENABLE_TESTING hasn't been run
+ if (cmSystemTools::FileExists(fname.c_str()))
+ {
+ const char* no_output = 0;
+ std::vector<std::string> no_depends;
+ std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
+ for(it = m_ProjectMap.begin(); it!= m_ProjectMap.end(); ++it)
+ {
+ std::vector<cmLocalGenerator*>& gen = it->second;
+ // add the ALL_BUILD to the first local generator of each project
+ if(gen.size())
+ {
+ gen[0]->GetMakefile()->
+ AddUtilityCommand("RUN_TESTS", false, no_output, no_depends,
+ ctest.c_str(), "-C", "$(IntDir)");
+ }
+ }
+ }
+ }
+}
+
+