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.
const char* no_rename = 0;
this->AddInstallRule(os, cmInstallType_DIRECTORY,
this->AddInstallRule(os,
this->Destination,
cmInstallType_DIRECTORY,
this->Directories,
this->Optional,
this->FilePermissions.c_str(),

View File

@ -185,7 +185,8 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
files.push_back(i->second);
std::string config_test = this->CreateConfigTest(i->first);
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,
indent.Next());
os << indent << "endif()\n";
@ -224,6 +225,7 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
// Install the main export file.
std::vector<std::string> files;
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);
}

View File

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

View File

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

View File

@ -40,7 +40,9 @@ public:
virtual ~cmInstallGenerator();
void AddInstallRule(
std::ostream& os, cmInstallType type,
std::ostream& os,
std::string const& dest,
cmInstallType type,
std::vector<std::string> const& files,
bool optional = false,
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_rename = 0;
bool optional = this->Optional || this->ImportLibrary;
this->AddInstallRule(os, type, filesFrom,
optional,
this->AddInstallRule(os, this->Destination,
type, filesFrom, optional,
this->FilePermissions.c_str(), no_dir_permissions,
no_rename, literal_args.c_str(),
indent);