cmInstallGenerator: Pass destination explicitly to AddInstallRule

This will allow specific invocations to transform the destination
before AddInstallRule uses it.
This commit is contained in:
Brad King 2015-02-11 11:48:13 -05:00
parent ebd556caa9
commit 7607c3d16a
6 changed files with 14 additions and 7 deletions

View File

@ -44,7 +44,9 @@ cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os,
{ {
// Write code to install the directories. // Write code to install the directories.
const char* no_rename = 0; const char* no_rename = 0;
this->AddInstallRule(os, cmInstallType_DIRECTORY, this->AddInstallRule(os,
this->Destination,
cmInstallType_DIRECTORY,
this->Directories, this->Directories,
this->Optional, this->Optional,
this->FilePermissions.c_str(), this->FilePermissions.c_str(),

View File

@ -185,7 +185,8 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
files.push_back(i->second); files.push_back(i->second);
std::string config_test = this->CreateConfigTest(i->first); std::string config_test = this->CreateConfigTest(i->first);
os << indent << "if(" << config_test << ")\n"; os << indent << "if(" << config_test << ")\n";
this->AddInstallRule(os, cmInstallType_FILES, files, false, this->AddInstallRule(os, this->Destination,
cmInstallType_FILES, files, false,
this->FilePermissions.c_str(), 0, 0, 0, this->FilePermissions.c_str(), 0, 0, 0,
indent.Next()); indent.Next());
os << indent << "endif()\n"; os << indent << "endif()\n";
@ -224,6 +225,7 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
// Install the main export file. // Install the main export file.
std::vector<std::string> files; std::vector<std::string> files;
files.push_back(this->MainImportFile); files.push_back(this->MainImportFile);
this->AddInstallRule(os, cmInstallType_FILES, files, false, this->AddInstallRule(os, this->Destination,
cmInstallType_FILES, files, false,
this->FilePermissions.c_str(), 0, 0, 0, indent); this->FilePermissions.c_str(), 0, 0, 0, indent);
} }

View File

@ -57,6 +57,7 @@ void cmInstallFilesGenerator::AddFilesInstallRule(
// Write code to install the files. // Write code to install the files.
const char* no_dir_permissions = 0; const char* no_dir_permissions = 0;
this->AddInstallRule(os, this->AddInstallRule(os,
this->Destination,
(this->Programs (this->Programs
? cmInstallType_PROGRAMS ? cmInstallType_PROGRAMS
: cmInstallType_FILES), : cmInstallType_FILES),

View File

@ -37,6 +37,7 @@ cmInstallGenerator
void cmInstallGenerator void cmInstallGenerator
::AddInstallRule( ::AddInstallRule(
std::ostream& os, std::ostream& os,
std::string const& dest,
cmInstallType type, cmInstallType type,
std::vector<std::string> const& files, std::vector<std::string> const& files,
bool optional /* = false */, bool optional /* = false */,
@ -60,7 +61,6 @@ void cmInstallGenerator
case cmInstallType_FILES: stype = "FILE"; break; case cmInstallType_FILES: stype = "FILE"; break;
} }
os << indent; os << indent;
std::string const& dest = this->Destination;
if (cmSystemTools::FileIsFullPath(dest.c_str())) if (cmSystemTools::FileIsFullPath(dest.c_str()))
{ {
os << "list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES\n"; os << "list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES\n";

View File

@ -40,7 +40,9 @@ public:
virtual ~cmInstallGenerator(); virtual ~cmInstallGenerator();
void AddInstallRule( void AddInstallRule(
std::ostream& os, cmInstallType type, std::ostream& os,
std::string const& dest,
cmInstallType type,
std::vector<std::string> const& files, std::vector<std::string> const& files,
bool optional = false, bool optional = false,
const char* permissions_file = 0, const char* permissions_file = 0,

View File

@ -323,8 +323,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
const char* no_dir_permissions = 0; const char* no_dir_permissions = 0;
const char* no_rename = 0; const char* no_rename = 0;
bool optional = this->Optional || this->ImportLibrary; bool optional = this->Optional || this->ImportLibrary;
this->AddInstallRule(os, type, filesFrom, this->AddInstallRule(os, this->Destination,
optional, type, filesFrom, optional,
this->FilePermissions.c_str(), no_dir_permissions, this->FilePermissions.c_str(), no_dir_permissions,
no_rename, literal_args.c_str(), no_rename, literal_args.c_str(),
indent); indent);