Commit fdf7b203 authored by Brad King's avatar Brad King 💬
Browse files

ENH: First step of install script generator cleanup. Each configuration to be...

ENH: First step of install script generator cleanup.  Each configuration to be installed is now separately handled instead of using variables to store per-configuration names.  For targets the component and configuration install-time tests are now done in the install script instead of in the FILE(INSTALL) command.  This cleans things up like not trying to strip a file that was optionally not installed.  It also simplifies the code for install_name adjustment on OSX.  This commit is surrounded by the tags CMake-InstallGeneratorCleanup1-pre and CMake-InstallGeneratorCleanup1-post.
parent 33e9becd
......@@ -44,18 +44,15 @@ cmInstallDirectoryGenerator
void cmInstallDirectoryGenerator::GenerateScript(std::ostream& os)
{
// Write code to install the directories.
for(std::vector<std::string>::const_iterator di = this->Directories.begin();
di != this->Directories.end(); ++di)
{
bool not_optional = false;
const char* no_properties = 0;
const char* no_rename = 0;
this->AddInstallRule(os, this->Destination.c_str(),
cmTarget::INSTALL_DIRECTORY, di->c_str(),
not_optional, no_properties,
this->FilePermissions.c_str(),
this->DirPermissions.c_str(),
this->Configurations, this->Component.c_str(),
no_rename, this->LiteralArguments.c_str());
}
bool not_optional = false;
const char* no_properties = 0;
const char* no_rename = 0;
this->AddInstallRule(os, this->Destination.c_str(),
cmTarget::INSTALL_DIRECTORY,
this->Directories,
not_optional, no_properties,
this->FilePermissions.c_str(),
this->DirPermissions.c_str(),
this->Configurations, this->Component.c_str(),
no_rename, this->LiteralArguments.c_str());
}
......@@ -222,8 +222,10 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
}
// install rule for the file created above
std::vector<std::string> exportFile;
exportFile.push_back(this->ExportFilename);
this->AddInstallRule(os, this->Destination.c_str(), cmTarget::INSTALL_FILES,
this->ExportFilename.c_str(), false, 0,
exportFile, false, 0,
this->FilePermissions.c_str(), 0, this->Configurations,
0, this->Filename.c_str(), 0);
......
......@@ -43,19 +43,16 @@ cmInstallFilesGenerator
void cmInstallFilesGenerator::GenerateScript(std::ostream& os)
{
// Write code to install the files.
for(std::vector<std::string>::const_iterator fi = this->Files.begin();
fi != this->Files.end(); ++fi)
{
const char* no_properties = 0;
const char* no_dir_permissions = 0;
this->AddInstallRule(os, this->Destination.c_str(),
(this->Programs
? cmTarget::INSTALL_PROGRAMS
: cmTarget::INSTALL_FILES), fi->c_str(),
this->Optional, no_properties,
this->FilePermissions.c_str(), no_dir_permissions,
this->Configurations,
this->Component.c_str(),
this->Rename.c_str());
}
const char* no_properties = 0;
const char* no_dir_permissions = 0;
this->AddInstallRule(os, this->Destination.c_str(),
(this->Programs
? cmTarget::INSTALL_PROGRAMS
: cmTarget::INSTALL_FILES),
this->Files,
this->Optional, no_properties,
this->FilePermissions.c_str(), no_dir_permissions,
this->Configurations,
this->Component.c_str(),
this->Rename.c_str());
}
......@@ -52,7 +52,7 @@ void cmInstallGenerator
std::ostream& os,
const char* dest,
int type,
const char* file,
std::vector<std::string> const& files,
bool optional /* = false */,
const char* properties /* = 0 */,
const char* permissions_file /* = 0 */,
......@@ -110,7 +110,24 @@ void cmInstallGenerator
{
os << " COMPONENTS \"" << component << "\"";
}
os << " FILES \"" << file << "\"";
os << " FILES";
if(files.size() == 1)
{
os << " \"" << files[0] << "\"";
}
else
{
for(std::vector<std::string>::const_iterator fi = files.begin();
fi != files.end(); ++fi)
{
os << "\n \"" << *fi << "\"";
}
os << "\n ";
if(!(literal_args && *literal_args))
{
os << " ";
}
}
if(literal_args && *literal_args)
{
os << literal_args;
......
......@@ -37,7 +37,8 @@ public:
static void AddInstallRule(
std::ostream& os, const char* dest, int type,
const char* file, bool optional = false,
std::vector<std::string> const& files,
bool optional = false,
const char* properties = 0,
const char* permissions_file = 0,
const char* permissions_dir = 0,
......
This diff is collapsed.
......@@ -44,19 +44,15 @@ public:
protected:
virtual void GenerateScript(std::ostream& os);
void PrepareScriptReference(std::ostream& os, cmTarget* target,
const char* place, bool useConfigDir,
bool implib, bool useSOName);
std::string GetScriptReference(cmTarget* target, const char* place,
bool implib, bool useSOName);
void AddInstallNamePatchRule(std::ostream& os, const char* destination);
void AddStripRule(std::ostream& os,
cmTarget::TargetType type,
const std::string& quotedFullDestinationFilename,
bool optional);
void AddRanlibRule(std::ostream& os,
cmTarget::TargetType type,
const std::string& quotedFullDestinationFilename);
void GenerateScriptForConfig(std::ostream& os,
const char* fromDir,
const char* config);
void AddInstallNamePatchRule(std::ostream& os, const char* config,
const std::string& toFullPath);
void AddStripRule(std::ostream& os, cmTarget::TargetType type,
const std::string& toFullPath);
void AddRanlibRule(std::ostream& os, cmTarget::TargetType type,
const std::string& toFullPath);
cmTarget* Target;
bool ImportLibrary;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment