cmInstallFilesGenerator: Add reference to calling cmMakefile

Add a Makefile member to the cmInstallFilesGenerator class and
populate it on construction.  This will be useful in a following
change to evaluate generator expressions with proper context.
This commit is contained in:
Brad King 2014-02-21 16:45:26 -05:00
parent e190236c74
commit f11f7b34a8
5 changed files with 21 additions and 10 deletions

View File

@ -32,10 +32,12 @@ static cmInstallTargetGenerator* CreateInstallTargetGenerator(cmTarget& target,
} }
static cmInstallFilesGenerator* CreateInstallFilesGenerator( static cmInstallFilesGenerator* CreateInstallFilesGenerator(
cmMakefile* mf,
const std::vector<std::string>& absFiles, const std::vector<std::string>& absFiles,
const cmInstallCommandArguments& args, bool programs) const cmInstallCommandArguments& args, bool programs)
{ {
return new cmInstallFilesGenerator(absFiles, args.GetDestination().c_str(), return new cmInstallFilesGenerator(mf,
absFiles, args.GetDestination().c_str(),
programs, args.GetPermissions().c_str(), programs, args.GetPermissions().c_str(),
args.GetConfigurations(), args.GetComponent().c_str(), args.GetConfigurations(), args.GetComponent().c_str(),
args.GetRename().c_str(), args.GetOptional()); args.GetRename().c_str(), args.GetOptional());
@ -668,7 +670,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
if (!privateHeaderArgs.GetDestination().empty()) if (!privateHeaderArgs.GetDestination().empty())
{ {
privateHeaderGenerator = privateHeaderGenerator =
CreateInstallFilesGenerator(absFiles, privateHeaderArgs, false); CreateInstallFilesGenerator(this->Makefile, absFiles,
privateHeaderArgs, false);
} }
else else
{ {
@ -694,7 +697,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
if (!publicHeaderArgs.GetDestination().empty()) if (!publicHeaderArgs.GetDestination().empty())
{ {
publicHeaderGenerator = publicHeaderGenerator =
CreateInstallFilesGenerator(absFiles, publicHeaderArgs, false); CreateInstallFilesGenerator(this->Makefile, absFiles,
publicHeaderArgs, false);
} }
else else
{ {
@ -719,8 +723,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
// Create the files install generator. // Create the files install generator.
if (!resourceArgs.GetDestination().empty()) if (!resourceArgs.GetDestination().empty())
{ {
resourceGenerator = CreateInstallFilesGenerator(absFiles, resourceGenerator = CreateInstallFilesGenerator(
resourceArgs, false); this->Makefile, absFiles, resourceArgs, false);
} }
else else
{ {
@ -888,7 +892,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
// Create the files install generator. // Create the files install generator.
this->Makefile->AddInstallGenerator( this->Makefile->AddInstallGenerator(
CreateInstallFilesGenerator(absFiles, ica, programs)); CreateInstallFilesGenerator(this->Makefile, absFiles, ica, programs));
//Tell the global generator about any installation component names specified. //Tell the global generator about any installation component names specified.
this->Makefile->GetLocalGenerator()->GetGlobalGenerator() this->Makefile->GetLocalGenerator()->GetGlobalGenerator()

View File

@ -133,7 +133,7 @@ void cmInstallFilesCommand::CreateInstallGenerator() const
"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"); "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
std::vector<std::string> no_configurations; std::vector<std::string> no_configurations;
this->Makefile->AddInstallGenerator( this->Makefile->AddInstallGenerator(
new cmInstallFilesGenerator(this->Files, new cmInstallFilesGenerator(this->Makefile, this->Files,
destination.c_str(), false, destination.c_str(), false,
no_permissions, no_configurations, no_permissions, no_configurations,
no_component.c_str(), no_rename)); no_component.c_str(), no_rename));

View File

@ -13,7 +13,8 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmInstallFilesGenerator cmInstallFilesGenerator
::cmInstallFilesGenerator(std::vector<std::string> const& files, ::cmInstallFilesGenerator(cmMakefile* mf,
std::vector<std::string> const& files,
const char* dest, bool programs, const char* dest, bool programs,
const char* file_permissions, const char* file_permissions,
std::vector<std::string> const& configurations, std::vector<std::string> const& configurations,
@ -21,6 +22,7 @@ cmInstallFilesGenerator
const char* rename, const char* rename,
bool optional): bool optional):
cmInstallGenerator(dest, configurations, component), cmInstallGenerator(dest, configurations, component),
Makefile(mf),
Files(files), Programs(programs), Files(files), Programs(programs),
FilePermissions(file_permissions), FilePermissions(file_permissions),
Rename(rename), Optional(optional) Rename(rename), Optional(optional)

View File

@ -14,13 +14,16 @@
#include "cmInstallGenerator.h" #include "cmInstallGenerator.h"
class cmMakefile;
/** \class cmInstallFilesGenerator /** \class cmInstallFilesGenerator
* \brief Generate file installation rules. * \brief Generate file installation rules.
*/ */
class cmInstallFilesGenerator: public cmInstallGenerator class cmInstallFilesGenerator: public cmInstallGenerator
{ {
public: public:
cmInstallFilesGenerator(std::vector<std::string> const& files, cmInstallFilesGenerator(cmMakefile* mf,
std::vector<std::string> const& files,
const char* dest, bool programs, const char* dest, bool programs,
const char* file_permissions, const char* file_permissions,
std::vector<std::string> const& configurations, std::vector<std::string> const& configurations,
@ -31,6 +34,8 @@ public:
protected: protected:
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
cmMakefile* Makefile;
std::vector<std::string> Files; std::vector<std::string> Files;
bool Programs; bool Programs;
std::string FilePermissions; std::string FilePermissions;

View File

@ -94,7 +94,7 @@ void cmInstallProgramsCommand::FinalPass()
"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"); "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
std::vector<std::string> no_configurations; std::vector<std::string> no_configurations;
this->Makefile->AddInstallGenerator( this->Makefile->AddInstallGenerator(
new cmInstallFilesGenerator(this->Files, new cmInstallFilesGenerator(this->Makefile, this->Files,
destination.c_str(), true, destination.c_str(), true,
no_permissions, no_configurations, no_permissions, no_configurations,
no_component.c_str(), no_rename)); no_component.c_str(), no_rename));