ENH: Two things. If there is CTestCustom.cmake in the toplevel directory read that file only. If there is CTestCustom.ctest in the toplevel directory, do the glob, if there is none, do nothing

This commit is contained in:
Andy Cedilnik 2006-03-21 16:39:50 -05:00
parent d41f97a5e6
commit 9a94d1144d
1 changed files with 38 additions and 15 deletions

View File

@ -1876,30 +1876,53 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir)
lg->SetGlobalGenerator(&gg); lg->SetGlobalGenerator(&gg);
cmMakefile *mf = lg->GetMakefile(); cmMakefile *mf = lg->GetMakefile();
std::string rexpr = dir; bool found = false;
rexpr += "/CTestCustom.ctest"; std::string fname = dir;
cmsys::Glob gl; fname += "/CTestCustom.cmake";
gl.RecurseOn(); if ( cmSystemTools::FileExists(fname.c_str()) )
gl.FindFiles(rexpr);
std::vector<std::string>& files = gl.GetFiles();
std::vector<std::string>::iterator fileIt;
for ( fileIt = files.begin(); fileIt != files.end();
++ fileIt )
{ {
cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: " cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: "
<< fileIt->c_str() << std::endl); << fname.c_str() << std::endl);
if ( !lg->GetMakefile()->ReadListFile(0, fileIt->c_str()) || if ( !lg->GetMakefile()->ReadListFile(0, fname.c_str()) ||
cmSystemTools::GetErrorOccuredFlag() ) cmSystemTools::GetErrorOccuredFlag() )
{ {
cmCTestLog(this, ERROR_MESSAGE, "Problem reading custom configuration: " cmCTestLog(this, ERROR_MESSAGE, "Problem reading custom configuration: "
<< fileIt->c_str() << std::endl); << fname.c_str() << std::endl);
} }
found = true;
} }
cmCTest::t_TestingHandlers::iterator it; std::string rexpr = dir;
for ( it = this->TestingHandlers.begin(); it != this->TestingHandlers.end(); ++ it ) rexpr += "/CTestCustom.ctest";
if ( !found && cmSystemTools::FileExists(fname.c_str()) )
{ {
it->second->PopulateCustomVectors(mf); cmsys::Glob gl;
gl.RecurseOn();
gl.FindFiles(rexpr);
std::vector<std::string>& files = gl.GetFiles();
std::vector<std::string>::iterator fileIt;
for ( fileIt = files.begin(); fileIt != files.end();
++ fileIt )
{
cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: "
<< fileIt->c_str() << std::endl);
if ( !lg->GetMakefile()->ReadListFile(0, fileIt->c_str()) ||
cmSystemTools::GetErrorOccuredFlag() )
{
cmCTestLog(this, ERROR_MESSAGE, "Problem reading custom configuration: "
<< fileIt->c_str() << std::endl);
}
}
found = true;
}
if ( found )
{
cmCTest::t_TestingHandlers::iterator it;
for ( it = this->TestingHandlers.begin(); it != this->TestingHandlers.end(); ++ it )
{
it->second->PopulateCustomVectors(mf);
}
} }
return 1; return 1;