summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-15 13:32:36 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-10-15 13:32:36 (GMT)
commit06491955ebe566e025b25abaa91977824811e282 (patch)
treec835e87d2cfc40b88617921c0738a8fe42af502f /Source/cmGlobalGenerator.cxx
parentebffbda4476aae1e89029f2e24fd76a22765205a (diff)
parenta4263c9f6447e526886d6af301b84c9097c097fa (diff)
downloadCMake-06491955ebe566e025b25abaa91977824811e282.zip
CMake-06491955ebe566e025b25abaa91977824811e282.tar.gz
CMake-06491955ebe566e025b25abaa91977824811e282.tar.bz2
Merge topic 'export-at-generate-time'
a4263c9 export(): Handle multiple dependent export sets. 66b290e export(): Process the export() command at generate time. 5fe5c32 export(): Set a Makefile on the cmExportBuildFileGenerator. e383555 cmExportInstallFileGenerator: Fix comment to match reality.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx56
1 files changed, 56 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index eacf85b..fb205be 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -27,6 +27,7 @@
#include "cmGeneratorTarget.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionEvaluationFile.h"
+#include "cmExportBuildFileGenerator.h"
#include <cmsys/Directory.hxx>
@@ -77,6 +78,12 @@ cmGlobalGenerator::~cmGlobalGenerator()
{
delete *li;
}
+ for(std::map<std::string, cmExportBuildFileGenerator*>::iterator
+ i = this->BuildExportSets.begin();
+ i != this->BuildExportSets.end(); ++i)
+ {
+ delete i->second;
+ }
this->LocalGenerators.clear();
if (this->ExtraGenerator)
@@ -183,6 +190,34 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
doc.c_str(), cmCacheManager::FILEPATH);
}
+void cmGlobalGenerator::AddBuildExportSet(cmExportBuildFileGenerator* gen)
+{
+ this->BuildExportSets[gen->GetMainExportFileName()] = gen;
+}
+
+bool cmGlobalGenerator::GenerateImportFile(const std::string &file)
+{
+ std::map<std::string, cmExportBuildFileGenerator*>::iterator it
+ = this->BuildExportSets.find(file);
+ if (it != this->BuildExportSets.end())
+ {
+ bool result = it->second->GenerateImportFile();
+ delete it->second;
+ it->second = 0;
+ this->BuildExportSets.erase(it);
+ return result;
+ }
+ return false;
+}
+
+bool
+cmGlobalGenerator::IsExportedTargetsFile(const std::string &filename) const
+{
+ const std::map<std::string, cmExportBuildFileGenerator*>::const_iterator it
+ = this->BuildExportSets.find(filename);
+ return it != this->BuildExportSets.end();
+}
+
// Find the make program for the generator, required for try compiles
void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
{
@@ -966,6 +1001,14 @@ void cmGlobalGenerator::Configure()
}
}
+cmExportBuildFileGenerator*
+cmGlobalGenerator::GetExportedTargetsFile(const std::string &filename) const
+{
+ std::map<std::string, cmExportBuildFileGenerator*>::const_iterator it
+ = this->BuildExportSets.find(filename);
+ return it == this->BuildExportSets.end() ? 0 : it->second;
+}
+
bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS()
{
// If the property is not enabled then okay.
@@ -1091,6 +1134,19 @@ void cmGlobalGenerator::Generate()
}
this->SetCurrentLocalGenerator(0);
+ for (std::map<std::string, cmExportBuildFileGenerator*>::iterator
+ it = this->BuildExportSets.begin(); it != this->BuildExportSets.end();
+ ++it)
+ {
+ if (!it->second->GenerateImportFile()
+ && !cmSystemTools::GetErrorOccuredFlag())
+ {
+ this->GetCMakeInstance()
+ ->IssueMessage(cmake::FATAL_ERROR, "Could not write export file.",
+ cmListFileBacktrace());
+ return;
+ }
+ }
// Update rule hashes.
this->CheckRuleHashes();