From 9a94d1144da4b6ceb1275c59ef1fb8acf17acade Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Tue, 21 Mar 2006 16:39:50 -0500 Subject: [PATCH] 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 --- Source/cmCTest.cxx | 53 +++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 4e941af0d..c9e7dfc50 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1876,30 +1876,53 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir) lg->SetGlobalGenerator(&gg); cmMakefile *mf = lg->GetMakefile(); - std::string rexpr = dir; - rexpr += "/CTestCustom.ctest"; - cmsys::Glob gl; - gl.RecurseOn(); - gl.FindFiles(rexpr); - std::vector& files = gl.GetFiles(); - std::vector::iterator fileIt; - for ( fileIt = files.begin(); fileIt != files.end(); - ++ fileIt ) + bool found = false; + std::string fname = dir; + fname += "/CTestCustom.cmake"; + if ( cmSystemTools::FileExists(fname.c_str()) ) { cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: " - << fileIt->c_str() << std::endl); - if ( !lg->GetMakefile()->ReadListFile(0, fileIt->c_str()) || + << fname.c_str() << std::endl); + if ( !lg->GetMakefile()->ReadListFile(0, fname.c_str()) || cmSystemTools::GetErrorOccuredFlag() ) { 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; - for ( it = this->TestingHandlers.begin(); it != this->TestingHandlers.end(); ++ it ) + std::string rexpr = dir; + rexpr += "/CTestCustom.ctest"; + if ( !found && cmSystemTools::FileExists(fname.c_str()) ) { - it->second->PopulateCustomVectors(mf); + cmsys::Glob gl; + gl.RecurseOn(); + gl.FindFiles(rexpr); + std::vector& files = gl.GetFiles(); + std::vector::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;