diff options
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2a30593..dba4f46 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -28,6 +28,7 @@ #include "cmGeneratorExpression.h" #include "cmGeneratorExpressionEvaluationFile.h" #include "cmExportBuildFileGenerator.h" +#include "cmCPackPropertiesGenerator.h" #include <cmsys/Directory.hxx> #include <cmsys/FStream.hxx> @@ -1269,6 +1270,13 @@ void cmGlobalGenerator::Generate() } this->SetCurrentLocalGenerator(0); + if(!this->GenerateCPackPropertiesFile()) + { + this->GetCMakeInstance()->IssueMessage( + cmake::FATAL_ERROR, "Could not write CPack properties file.", + cmListFileBacktrace()); + } + for (std::map<std::string, cmExportBuildFileGenerator*>::iterator it = this->BuildExportSets.begin(); it != this->BuildExportSets.end(); ++it) @@ -3014,3 +3022,39 @@ std::string cmGlobalGenerator::ExpandCFGIntDir(const std::string& str, { return str; } + +//---------------------------------------------------------------------------- +bool cmGlobalGenerator::GenerateCPackPropertiesFile() +{ + cmake::InstalledFilesMap const& installedFiles = + this->CMakeInstance->GetInstalledFiles(); + + cmMakefile* mf = this->LocalGenerators[0]->GetMakefile(); + + std::vector<std::string> configs; + std::string config = mf->GetConfigurations(configs, false); + + std::string path = this->CMakeInstance->GetStartOutputDirectory(); + path += "/CPackProperties.cmake"; + + if(!cmSystemTools::FileExists(path.c_str()) && installedFiles.empty()) + { + return true; + } + + cmGeneratedFileStream file(path.c_str()); + file << "# CPack properties\n"; + + for(cmake::InstalledFilesMap::const_iterator i = installedFiles.begin(); + i != installedFiles.end(); ++i) + { + cmInstalledFile const& installedFile = i->second; + + cmCPackPropertiesGenerator cpackPropertiesGenerator( + mf, installedFile, configs); + + cpackPropertiesGenerator.Generate(file, config, configs); + } + + return true; +} |