summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-03-09 16:19:27 (GMT)
committerBrad King <brad.king@kitware.com>2009-03-09 16:19:27 (GMT)
commita86e81c3589d64a2a777b1b90490cb80b951d983 (patch)
treed704564ea129aa9b121bb1cd7c99b184700099d4
parentb9323d2dd6fd96505cca5132529e0e6b854bdf10 (diff)
downloadCMake-a86e81c3589d64a2a777b1b90490cb80b951d983.zip
CMake-a86e81c3589d64a2a777b1b90490cb80b951d983.tar.gz
CMake-a86e81c3589d64a2a777b1b90490cb80b951d983.tar.bz2
ENH: Generate a central list of target directories
This generalizes the previous CMakeFiles/LabelFiles.txt created at the top of the build tree to a CMakeFiles/TargetDirectories.txt file. It lists the target support directories for all targets in the project. Labels can still be loaded by looking for Labels.txt files in each target directory.
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx15
-rw-r--r--Source/CTest/cmCTestCoverageHandler.h4
-rw-r--r--Source/cmGlobalGenerator.cxx36
-rw-r--r--Source/cmGlobalGenerator.h4
4 files changed, 26 insertions, 33 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 1faf05a..fa9a220 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -1749,9 +1749,9 @@ void cmCTestCoverageHandler::LoadLabels()
{
std::string fileList = this->CTest->GetBinaryDir();
fileList += cmake::GetCMakeFilesDirectory();
- fileList += "/LabelFiles.txt";
+ fileList += "/TargetDirectories.txt";
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- " label file list [" << fileList << "]\n");
+ " target directory list [" << fileList << "]\n");
std::ifstream finList(fileList.c_str());
std::string line;
while(cmSystemTools::GetLineFromStream(finList, line))
@@ -1761,11 +1761,18 @@ void cmCTestCoverageHandler::LoadLabels()
}
//----------------------------------------------------------------------
-void cmCTestCoverageHandler::LoadLabels(const char* fname)
+void cmCTestCoverageHandler::LoadLabels(const char* dir)
{
+ std::string fname = dir;
+ fname += "/Labels.txt";
+ std::ifstream fin(fname.c_str());
+ if(!fin)
+ {
+ return;
+ }
+
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" loading labels from [" << fname << "]\n");
- std::ifstream fin(fname);
bool inTarget = true;
std::string source;
std::string line;
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index 48894fb..46bcec1 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -152,9 +152,9 @@ private:
std::vector<std::string> Labels;
int GetLabelId(std::string const& label);
- // Load reading and writing methods.
+ // Label reading and writing methods.
void LoadLabels();
- void LoadLabels(const char* fname);
+ void LoadLabels(const char* dir);
void WriteXMLLabels(std::ofstream& os, std::string const& source);
// Label-based filtering.
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 23bb1a2..8a184e0 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -901,7 +901,7 @@ void cmGlobalGenerator::Generate()
// Update rule hashes.
this->CheckRuleHashes();
- this->WriteTargetLabels();
+ this->WriteSummary();
if (this->ExtraGenerator != 0)
{
@@ -2137,44 +2137,32 @@ void cmGlobalGenerator::CheckRuleHashes()
}
//----------------------------------------------------------------------------
-void cmGlobalGenerator::WriteTargetLabels()
+void cmGlobalGenerator::WriteSummary()
{
cmMakefile* mf = this->LocalGenerators[0]->GetMakefile();
- // Record generated per-target label files in a central location.
+ // Record all target directories in a central location.
std::string fname = mf->GetHomeOutputDirectory();
fname += cmake::GetCMakeFilesDirectory();
- fname += "/LabelFiles.txt";
- bool opened = false;
- cmGeneratedFileStream fout;
+ fname += "/TargetDirectories.txt";
+ cmGeneratedFileStream fout(fname.c_str());
- // Generate a label file for each target.
- std::string file;
+ // Generate summary information files for each target.
+ std::string dir;
for(std::map<cmStdString,cmTarget *>::const_iterator ti =
this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti)
{
- if(this->WriteTargetLabels(ti->second, file))
- {
- if(!opened)
- {
- fout.Open(fname.c_str());
- opened = true;
- }
- fout << file << "\n";
- }
- }
- if(!opened)
- {
- cmSystemTools::RemoveFile(fname.c_str());
+ this->WriteSummary(ti->second);
+ fout << ti->second->GetSupportDirectory() << "\n";
}
}
//----------------------------------------------------------------------------
-bool cmGlobalGenerator::WriteTargetLabels(cmTarget* target, std::string& file)
+void cmGlobalGenerator::WriteSummary(cmTarget* target)
{
// Place the labels file in a per-target support directory.
std::string dir = target->GetSupportDirectory();
- file = dir;
+ std::string file = dir;
file += "/Labels.txt";
// Check whether labels are enabled for this target.
@@ -2216,11 +2204,9 @@ bool cmGlobalGenerator::WriteTargetLabels(cmTarget* target, std::string& file)
}
}
}
- return true;
}
else
{
cmSystemTools::RemoveFile(file.c_str());
- return false;
}
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index c3c2ef5..0eb27e4 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -336,8 +336,8 @@ private:
std::map<cmStdString, RuleHash> RuleHashes;
void CheckRuleHashes();
- void WriteTargetLabels();
- bool WriteTargetLabels(cmTarget* target, std::string& file);
+ void WriteSummary();
+ void WriteSummary(cmTarget* target);
cmExternalMakefileProjectGenerator* ExtraGenerator;