diff options
author | Brad King <brad.king@kitware.com> | 2009-11-03 17:25:20 -0500 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-11-03 17:25:20 -0500 |
commit | 86eac830b353b304fae635f91cebc888e1c37933 (patch) | |
tree | d6b403619a096729311c3921c09eda2870082066 /Source | |
parent | b4ae8bad4b8e7810a44e2f77363de3009260a473 (diff) | |
download | cmake-86eac830b353b304fae635f91cebc888e1c37933.tar.gz |
CMake 2.8.0-rc5
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/cmCPackTGZGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/CPack/cmCPackTarCompressGenerator.cxx | 7 | ||||
-rw-r--r-- | Source/CTest/cmCTestMemCheckHandler.cxx | 12 | ||||
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 51 | ||||
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.h | 2 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.cxx | 9 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 10 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 20 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 25 |
10 files changed, 112 insertions, 37 deletions
diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index 391093a6fe..99574b09f1 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -218,7 +218,7 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName, &mydata }; - // Ok, this libtar is not const safe. Make a non-const copy of outFileName + // This libtar is not const safe. Make a non-const copy of outFileName char* realName = new char[ strlen(outFileName) + 1 ]; strcpy(realName, outFileName); int flags = O_WRONLY | O_CREAT; @@ -241,6 +241,8 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName, return 0; } + delete [] realName; + std::vector<std::string>::const_iterator fileIt; for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt ) { @@ -256,7 +258,6 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName, << pathname << "\"): " << strerror(errno) << std::endl); tar_close(t); - delete [] realName; return 0; } } @@ -265,7 +266,6 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName, cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_append_eof(): " << strerror(errno) << std::endl); tar_close(t); - delete [] realName; return 0; } @@ -273,10 +273,8 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName, { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_close(): " << strerror(errno) << std::endl); - delete [] realName; return 0; } - delete [] realName; return 1; } diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx index d7513b6333..165c18122f 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.cxx +++ b/Source/CPack/cmCPackTarCompressGenerator.cxx @@ -23,7 +23,6 @@ #include <cmsys/SystemTools.hxx> #include <cmcompress/cmcompress.h> #include <libtar/libtar.h> -#include <memory> // auto_ptr #include <fcntl.h> #include <errno.h> @@ -165,9 +164,8 @@ int cmCPackTarCompressGenerator::CompressFiles(const char* outFileName, &mydata }; - // Ok, this libtar is not const safe. for now use auto_ptr hack + // This libtar is not const safe. Make a non-const copy of outFileName char* realName = new char[ strlen(outFileName) + 1 ]; - std::auto_ptr<char> realNamePtr(realName); strcpy(realName, outFileName); int flags = O_WRONLY | O_CREAT; int options = 0; @@ -185,9 +183,12 @@ int cmCPackTarCompressGenerator::CompressFiles(const char* outFileName, { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): " << strerror(errno) << std::endl); + delete [] realName; return 0; } + delete [] realName; + std::vector<std::string>::const_iterator fileIt; for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt ) { diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 0c63d833e8..47bb56aa5a 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -659,8 +659,12 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( "== .*Invalid free\\(\\) / delete / delete\\[\\]"); cmsys::RegularExpression vgFMM( "== .*Mismatched free\\(\\) / delete / delete \\[\\]"); - cmsys::RegularExpression vgMLK( + cmsys::RegularExpression vgMLK1( "== .*[0-9][0-9]* bytes in [0-9][0-9]* blocks are definitely lost" + " in loss record [0-9][0-9]* of [0-9]"); + cmsys::RegularExpression vgMLK2( + "== .*[0-9][0-9]* \\([0-9]*,?[0-9]* direct, [0-9]*,?[0-9]* indirect\\)" + " bytes in [0-9][0-9]* blocks are definitely lost" " in loss record [0-9][0-9]* of [0-9]"); cmsys::RegularExpression vgPAR( "== .*Syscall param .* contains unaddressable byte\\(s\\)"); @@ -705,7 +709,11 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( { failure = cmCTestMemCheckHandler::FMM; } - else if ( vgMLK.find(lines[cc]) ) + else if ( vgMLK1.find(lines[cc]) ) + { + failure = cmCTestMemCheckHandler::MLK; + } + else if ( vgMLK2.find(lines[cc]) ) { failure = cmCTestMemCheckHandler::MLK; } diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 024599ce9e..4f3a6057f6 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -15,6 +15,7 @@ #include "cmCTest.h" #include "cmSystemTools.h" #include <stdlib.h> +#include <stack> cmCTestMultiProcessHandler::cmCTestMultiProcessHandler() { @@ -56,6 +57,10 @@ void cmCTestMultiProcessHandler::SetParallelLevel(size_t level) void cmCTestMultiProcessHandler::RunTests() { this->CheckResume(); + if(!this->CheckCycles()) + { + return; + } this->TestHandler->SetMaxIndex(this->FindMaxIndex()); this->StartNextTests(); while(this->Tests.size() != 0) @@ -340,7 +345,7 @@ void cmCTestMultiProcessHandler::PrintTestList() this->TestHandler->SetMaxIndex(this->FindMaxIndex()); int count = 0; for (PropertiesMap::iterator it = this->Properties.begin(); - it != this->Properties.end(); it ++ ) + it != this->Properties.end(); ++it) { count++; cmCTestTestHandler::cmCTestTestProperties& p = *it->second; @@ -433,3 +438,47 @@ int cmCTestMultiProcessHandler::FindMaxIndex() } return max; } + +//Returns true if no cycles exist in the dependency graph +bool cmCTestMultiProcessHandler::CheckCycles() +{ + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Checking test dependency graph..." << std::endl); + for(TestMap::iterator it = this->Tests.begin(); + it != this->Tests.end(); ++it) + { + //DFS from each element to itself + std::stack<int> s; + std::vector<int> visited; + s.push(it->first); + visited.push_back(it->first); + + while(!s.empty()) + { + int test = s.top(); + s.pop(); + + for(TestSet::iterator d = this->Tests[test].begin(); + d != this->Tests[test].end(); ++d) + { + s.push(*d); + for(std::vector<int>::iterator v = visited.begin(); + v != visited.end(); ++v) + { + if(*v == *d) + { + //cycle exists + cmCTestLog(this->CTest, ERROR_MESSAGE, "Error: a cycle exists in " + "the test dependency graph for the test \"" + << this->Properties[*d]->Name << "\"." << std::endl + << "Please fix the cycle and run ctest again." << std::endl); + return false; + } + } + visited.push_back(*d); + } + visited.pop_back(); + } + } + return true; +} diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index c99eb3dac2..16591b043f 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -76,6 +76,8 @@ protected: void RemoveTest(int index); //Check if we need to resume an interrupted test set void CheckResume(); + //Check if there are any circular dependencies + bool CheckCycles(); int FindMaxIndex(); inline size_t GetProcessorsUsed(int index); // map from test number to set of depend tests diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index a3de4db434..eb82f2a913 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -294,7 +294,14 @@ void CMakeSetupDialog::doConfigure() { return; } - dir.mkpath("."); + if(!dir.mkpath(".")) + { + QMessageBox::information(this, tr("Create Directory Failed"), + QString(tr("Failed to create directory %1")).arg(dir.path()), + QMessageBox::Ok); + + return; + } } // if no generator, prompt for it and other setup stuff diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 7b27f3b75a..7240073144 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1281,7 +1281,10 @@ void cmGlobalXCodeGenerator ) { std::string makefileName=makefileBasename; - makefileName+=configName; + if(this->XcodeVersion > 20) + { + makefileName+=configName; + } cmGeneratedFileStream makefileStream(makefileName.c_str()); if(!makefileStream) { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 88c8c7b6f8..d09188ad20 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3388,14 +3388,20 @@ void cmMakefile::RaiseScope(const char *var, const char *varDef) // Now update the definition in the parent scope. up->Set(var, varDef); } - else if(cmMakefile* parent = - this->LocalGenerator->GetParent()->GetMakefile()) + else if(cmLocalGenerator* plg = this->LocalGenerator->GetParent()) { // Update the definition in the parent directory top scope. This // directory's scope was initialized by the closure of the parent // scope, so we do not need to localize the definition first. + cmMakefile* parent = plg->GetMakefile(); parent->Internal->VarStack.top().Set(var, varDef); } + else + { + cmOStringStream m; + m << "Cannot set \"" << var << "\": current scope has no parent."; + this->IssueMessage(cmake::AUTHOR_WARNING, m.str()); + } } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 219c1efcea..031bfc32bd 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -46,7 +46,6 @@ #if defined(CMAKE_BUILD_WITH_CMAKE) # include <libtar/libtar.h> -# include <memory> // auto_ptr # include <fcntl.h> # include <cm_zlib.h> # include <cmsys/MD5.h> @@ -1807,9 +1806,8 @@ bool cmSystemTools::CreateTar(const char* outFileName, &gzs }; - // Ok, this libtar is not const safe. for now use auto_ptr hack + // This libtar is not const safe. Make a non-const copy of outFileName char* realName = new char[ strlen(outFileName) + 1 ]; - std::auto_ptr<char> realNamePtr(realName); strcpy(realName, outFileName); int options = 0; if(verbose) @@ -1825,9 +1823,12 @@ bool cmSystemTools::CreateTar(const char* outFileName, options) == -1) { cmSystemTools::Error("Problem with tar_open(): ", strerror(errno)); + delete [] realName; return false; } + delete [] realName; + std::vector<cmStdString>::const_iterator it; for (it = files.begin(); it != files.end(); ++ it ) { @@ -1859,6 +1860,7 @@ bool cmSystemTools::CreateTar(const char* outFileName, cmSystemTools::Error("Problem with tar_close(): ", strerror(errno)); return false; } + return true; #else (void)outFileName; @@ -1886,9 +1888,8 @@ bool cmSystemTools::ExtractTar(const char* outFileName, &gzs }; - // Ok, this libtar is not const safe. for now use auto_ptr hack + // This libtar is not const safe. Make a non-const copy of outFileName char* realName = new char[ strlen(outFileName) + 1 ]; - std::auto_ptr<char> realNamePtr(realName); strcpy(realName, outFileName); if (tar_open(&t, realName, (gzip? &gztype : NULL), @@ -1901,9 +1902,12 @@ bool cmSystemTools::ExtractTar(const char* outFileName, | 0) == -1) { cmSystemTools::Error("Problem with tar_open(): ", strerror(errno)); + delete [] realName; return false; } + delete [] realName; + if (tar_extract_all(t, 0) != 0) { cmSystemTools::Error("Problem with tar_extract_all(): ", strerror(errno)); @@ -1940,9 +1944,8 @@ bool cmSystemTools::ListTar(const char* outFileName, &gzs }; - // Ok, this libtar is not const safe. for now use auto_ptr hack + // This libtar is not const safe. Make a non-const copy of outFileName char* realName = new char[ strlen(outFileName) + 1 ]; - std::auto_ptr<char> realNamePtr(realName); strcpy(realName, outFileName); if (tar_open(&t, realName, (gzip? &gztype : NULL), @@ -1955,9 +1958,12 @@ bool cmSystemTools::ListTar(const char* outFileName, | 0) == -1) { cmSystemTools::Error("Problem with tar_open(): ", strerror(errno)); + delete [] realName; return false; } + delete [] realName; + while ((th_read(t)) == 0) { const char* filename = th_get_pathname(t); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ccac68a560..f44fb6ba64 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -881,30 +881,25 @@ void cmTarget::DefineProperties(cmake *cm) "an archive target. " \ "All Windows-based systems including Cygwin are DLL platforms." +#define CM_TARGET_OUTDIR_DOC(TYPE, type) \ + "This property specifies the directory into which " #type " target " \ + "files should be built. " \ + CM_TARGET_FILE_TYPES_DOC " " \ + "This property is initialized by the value of the variable " \ + "CMAKE_" #TYPE "_OUTPUT_DIRECTORY if it is set when a target is created." + cm->DefineProperty ("ARCHIVE_OUTPUT_DIRECTORY", cmProperty::TARGET, "Output directory in which to build ARCHIVE target files.", - "This property specifies the directory into which archive target files " - "should be built. " - CM_TARGET_FILE_TYPES_DOC " " - "This property is initialized by the value of the variable " - "CMAKE_ARCHIVE_OUTPUT_DIRECTORY if it is set when a target is created."); + CM_TARGET_OUTDIR_DOC(ARCHIVE, archive)); cm->DefineProperty ("LIBRARY_OUTPUT_DIRECTORY", cmProperty::TARGET, "Output directory in which to build LIBRARY target files.", - "This property specifies the directory into which library target files " - "should be built. " - CM_TARGET_FILE_TYPES_DOC " " - "This property is initialized by the value of the variable " - "CMAKE_LIBRARY_OUTPUT_DIRECTORY if it is set when a target is created."); + CM_TARGET_OUTDIR_DOC(LIBRARY, library)); cm->DefineProperty ("RUNTIME_OUTPUT_DIRECTORY", cmProperty::TARGET, "Output directory in which to build RUNTIME target files.", - "This property specifies the directory into which runtime target files " - "should be built. " - CM_TARGET_FILE_TYPES_DOC " " - "This property is initialized by the value of the variable " - "CMAKE_RUNTIME_OUTPUT_DIRECTORY if it is set when a target is created."); + CM_TARGET_OUTDIR_DOC(RUNTIME, runtime)); cm->DefineProperty ("ARCHIVE_OUTPUT_NAME", cmProperty::TARGET, |