cmCPackPropertiesGenerator: Require cmLocalGenerator in API.

This commit is contained in:
Stephen Kelly 2015-07-25 17:55:34 +02:00
parent d568eefe10
commit a8e5d838ed
3 changed files with 13 additions and 8 deletions

View File

@ -1,13 +1,14 @@
#include "cmCPackPropertiesGenerator.h"
#include "cmOutputConverter.h"
#include "cmLocalGenerator.h"
cmCPackPropertiesGenerator::cmCPackPropertiesGenerator(
cmMakefile* mf,
cmLocalGenerator* lg,
cmInstalledFile const& installedFile,
std::vector<std::string> const& configurations):
cmScriptGenerator("CPACK_BUILD_CONFIG", configurations),
Makefile(mf),
LG(lg),
InstalledFile(installedFile)
{
this->ActionsPerConfig = true;
@ -17,7 +18,8 @@ void cmCPackPropertiesGenerator::GenerateScriptForConfig(std::ostream& os,
const std::string& config, Indent const& indent)
{
std::string const& expandedFileName =
this->InstalledFile.GetNameExpression().Evaluate(this->Makefile, config);
this->InstalledFile.GetNameExpression().Evaluate(this->LG->GetMakefile(),
config);
cmInstalledFile::PropertyMapType const& properties =
this->InstalledFile.GetProperties();
@ -36,7 +38,7 @@ void cmCPackPropertiesGenerator::GenerateScriptForConfig(std::ostream& os,
j = property.ValueExpressions.begin();
j != property.ValueExpressions.end(); ++j)
{
std::string value = (*j)->Evaluate(this->Makefile, config);
std::string value = (*j)->Evaluate(LG->GetMakefile(), config);
os << " " << cmOutputConverter::EscapeForCMake(value);
}

View File

@ -15,6 +15,8 @@
#include "cmScriptGenerator.h"
#include "cmInstalledFile.h"
class cmLocalGenerator;
/** \class cmCPackPropertiesGenerator
* \brief Support class for generating CPackProperties.cmake.
*
@ -23,7 +25,7 @@ class cmCPackPropertiesGenerator: public cmScriptGenerator
{
public:
cmCPackPropertiesGenerator(
cmMakefile* mf,
cmLocalGenerator* lg,
cmInstalledFile const& installedFile,
std::vector<std::string> const& configurations);
@ -31,7 +33,7 @@ protected:
virtual void GenerateScriptForConfig(std::ostream& os,
const std::string& config, Indent const& indent);
cmMakefile* Makefile;
cmLocalGenerator* LG;
cmInstalledFile const& InstalledFile;
};

View File

@ -3050,7 +3050,8 @@ bool cmGlobalGenerator::GenerateCPackPropertiesFile()
cmake::InstalledFilesMap const& installedFiles =
this->CMakeInstance->GetInstalledFiles();
cmMakefile* mf = this->LocalGenerators[0]->GetMakefile();
cmLocalGenerator* lg = this->LocalGenerators[0];
cmMakefile* mf = lg->GetMakefile();
std::vector<std::string> configs;
std::string config = mf->GetConfigurations(configs, false);
@ -3072,7 +3073,7 @@ bool cmGlobalGenerator::GenerateCPackPropertiesFile()
cmInstalledFile const& installedFile = i->second;
cmCPackPropertiesGenerator cpackPropertiesGenerator(
mf, installedFile, configs);
lg, installedFile, configs);
cpackPropertiesGenerator.Generate(file, config, configs);
}