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.

This commit is contained in:
Brad King 2007-06-28 16:11:18 -04:00
parent 33e9becd6f
commit fdf7b203af
7 changed files with 264 additions and 259 deletions

View File

@ -44,18 +44,15 @@ cmInstallDirectoryGenerator
void cmInstallDirectoryGenerator::GenerateScript(std::ostream& os) void cmInstallDirectoryGenerator::GenerateScript(std::ostream& os)
{ {
// Write code to install the directories. // Write code to install the directories.
for(std::vector<std::string>::const_iterator di = this->Directories.begin(); bool not_optional = false;
di != this->Directories.end(); ++di) const char* no_properties = 0;
{ const char* no_rename = 0;
bool not_optional = false; this->AddInstallRule(os, this->Destination.c_str(),
const char* no_properties = 0; cmTarget::INSTALL_DIRECTORY,
const char* no_rename = 0; this->Directories,
this->AddInstallRule(os, this->Destination.c_str(), not_optional, no_properties,
cmTarget::INSTALL_DIRECTORY, di->c_str(), this->FilePermissions.c_str(),
not_optional, no_properties, this->DirPermissions.c_str(),
this->FilePermissions.c_str(), this->Configurations, this->Component.c_str(),
this->DirPermissions.c_str(), no_rename, this->LiteralArguments.c_str());
this->Configurations, this->Component.c_str(),
no_rename, this->LiteralArguments.c_str());
}
} }

View File

@ -222,8 +222,10 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
} }
// install rule for the file created above // 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->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, this->FilePermissions.c_str(), 0, this->Configurations,
0, this->Filename.c_str(), 0); 0, this->Filename.c_str(), 0);

View File

@ -43,19 +43,16 @@ cmInstallFilesGenerator
void cmInstallFilesGenerator::GenerateScript(std::ostream& os) void cmInstallFilesGenerator::GenerateScript(std::ostream& os)
{ {
// Write code to install the files. // Write code to install the files.
for(std::vector<std::string>::const_iterator fi = this->Files.begin(); const char* no_properties = 0;
fi != this->Files.end(); ++fi) const char* no_dir_permissions = 0;
{ this->AddInstallRule(os, this->Destination.c_str(),
const char* no_properties = 0; (this->Programs
const char* no_dir_permissions = 0; ? cmTarget::INSTALL_PROGRAMS
this->AddInstallRule(os, this->Destination.c_str(), : cmTarget::INSTALL_FILES),
(this->Programs this->Files,
? cmTarget::INSTALL_PROGRAMS this->Optional, no_properties,
: cmTarget::INSTALL_FILES), fi->c_str(), this->FilePermissions.c_str(), no_dir_permissions,
this->Optional, no_properties, this->Configurations,
this->FilePermissions.c_str(), no_dir_permissions, this->Component.c_str(),
this->Configurations, this->Rename.c_str());
this->Component.c_str(),
this->Rename.c_str());
}
} }

View File

@ -52,7 +52,7 @@ void cmInstallGenerator
std::ostream& os, std::ostream& os,
const char* dest, const char* dest,
int type, int type,
const char* file, std::vector<std::string> const& files,
bool optional /* = false */, bool optional /* = false */,
const char* properties /* = 0 */, const char* properties /* = 0 */,
const char* permissions_file /* = 0 */, const char* permissions_file /* = 0 */,
@ -110,7 +110,24 @@ void cmInstallGenerator
{ {
os << " COMPONENTS \"" << component << "\""; 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) if(literal_args && *literal_args)
{ {
os << literal_args; os << literal_args;

View File

@ -37,7 +37,8 @@ public:
static void AddInstallRule( static void AddInstallRule(
std::ostream& os, const char* dest, int type, 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* properties = 0,
const char* permissions_file = 0, const char* permissions_file = 0,
const char* permissions_dir = 0, const char* permissions_dir = 0,

View File

@ -21,6 +21,12 @@
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmake.h" #include "cmake.h"
// TODO:
// - Fix indentation of generated code
// - Consolidate component/configuration checks across multiple
// install generators
// - Skip IF(EXISTS) checks if nothing is done with the installed file
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmInstallTargetGenerator cmInstallTargetGenerator
::cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib, ::cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib,
@ -43,6 +49,13 @@ cmInstallTargetGenerator
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmInstallTargetGenerator::GenerateScript(std::ostream& os) void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
{ {
// Begin this block of installation.
std::string component_test = "NOT CMAKE_INSTALL_COMPONENT OR "
"\"${CMAKE_INSTALL_COMPONENT}\" MATCHES \"^(";
component_test += this->Component;
component_test += ")$\"";
os << "IF(" << component_test << ")\n";
// Compute the build tree directory from which to copy the target. // Compute the build tree directory from which to copy the target.
std::string fromDir; std::string fromDir;
if(this->Target->NeedRelinkBeforeInstall()) if(this->Target->NeedRelinkBeforeInstall())
@ -57,78 +70,90 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
fromDir += "/"; fromDir += "/";
} }
// Write variable settings to do per-configuration references. // Generate a portion of the script for each configuration.
this->PrepareScriptReference(os, this->Target, "BUILD", true, this->ImportLibrary, false); if(this->ConfigurationTypes->empty())
// Create the per-configuration reference.
std::string fromName = this->GetScriptReference(this->Target, "BUILD",
this->ImportLibrary, false);
std::string fromFile = fromDir;
fromFile += fromName;
// Choose the final destination. This may be modified for certain
// target types.
std::string destination = this->Destination;
// Setup special properties for some target types.
std::string literal_args;
std::string props;
const char* properties = 0;
cmTarget::TargetType type = this->Target->GetType();
switch(type)
{ {
case cmTarget::SHARED_LIBRARY: this->GenerateScriptForConfig(os, fromDir.c_str(),
this->ConfigurationName);
}
else
{
for(std::vector<std::string>::const_iterator i =
this->ConfigurationTypes->begin();
i != this->ConfigurationTypes->end(); ++i)
{ {
// Add shared library installation properties if this platform this->GenerateScriptForConfig(os, fromDir.c_str(), i->c_str());
// supports them.
const char* lib_version = 0;
const char* lib_soversion = 0;
// Versioning is supported only for shared libraries and modules,
// and then only when the platform supports an soname flag.
cmGlobalGenerator* gg =
(this->Target->GetMakefile()
->GetLocalGenerator()->GetGlobalGenerator());
if(const char* linkLanguage = this->Target->GetLinkerLanguage(gg))
{
std::string sonameFlagVar = "CMAKE_SHARED_LIBRARY_SONAME_";
sonameFlagVar += linkLanguage;
sonameFlagVar += "_FLAG";
if(this->Target->GetMakefile()->GetDefinition(sonameFlagVar.c_str()))
{
lib_version = this->Target->GetProperty("VERSION");
lib_soversion = this->Target->GetProperty("SOVERSION");
}
}
if(lib_version)
{
props += " VERSION ";
props += lib_version;
}
if(lib_soversion)
{
props += " SOVERSION ";
props += lib_soversion;
}
properties = props.c_str();
} }
break; }
case cmTarget::EXECUTABLE:
// End this block of installation.
os << "ENDIF(" << component_test << ")\n";
}
//----------------------------------------------------------------------------
void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
const char* fromDir,
const char* config)
{
// Compute the per-configuration directory containing the files.
std::string fromDirConfig = fromDir;
this->Target->GetMakefile()->GetLocalGenerator()->GetGlobalGenerator()
->AppendDirectoryForConfig("", config, "/", fromDirConfig);
std::string config_test;
if(config && *config)
{
std::string config_upper = cmSystemTools::UpperCase(config);
// Skip this configuration for config-specific installation that
// does not match it.
if(!this->Configurations.empty())
{ {
// Add executable installation properties if this platform bool found = false;
// supports them. for(std::vector<std::string>::const_iterator i =
#if defined(_WIN32) && !defined(__CYGWIN__) this->Configurations.begin();
const char* exe_version = 0; !found && i != this->Configurations.end(); ++i)
#else
const char* exe_version = this->Target->GetProperty("VERSION");
#endif
if(exe_version)
{ {
props += " VERSION "; found = found || (cmSystemTools::UpperCase(*i) == config_upper);
props += exe_version;
properties = props.c_str();
} }
if(!found)
{
return;
}
}
// Begin this configuration block.
config_test = "\"${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^(";
config_test += config;
config_test += ")$\"";
os << " IF(" << config_test << ")\n";
}
// Compute the list of files to install for this target.
std::vector<std::string> files;
std::string literal_args;
cmTarget::TargetType type = this->Target->GetType();
if(type == cmTarget::EXECUTABLE)
{
std::string targetName;
std::string targetNameReal;
std::string targetNameImport;
std::string targetNamePDB;
this->Target->GetExecutableNames(targetName, targetNameReal,
targetNameImport, targetNamePDB,
config);
if(this->ImportLibrary)
{
std::string from1 = fromDirConfig;
from1 += targetNameImport;
files.push_back(from1);
// An import library looks like a static library.
type = cmTarget::STATIC_LIBRARY;
}
else
{
std::string from1 = fromDirConfig;
from1 += targetName;
// Handle OSX Bundles. // Handle OSX Bundles.
if(this->Target->GetMakefile()->IsOn("APPLE") && if(this->Target->GetMakefile()->IsOn("APPLE") &&
@ -136,62 +161,104 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
{ {
// Compute the source locations of the bundle executable and // Compute the source locations of the bundle executable and
// Info.plist file. // Info.plist file.
this->PrepareScriptReference(os, this->Target, "INSTALL", from1 += ".app";
false, this->ImportLibrary, false); files.push_back(from1);
fromFile += ".app";
type = cmTarget::INSTALL_DIRECTORY; type = cmTarget::INSTALL_DIRECTORY;
literal_args += " USE_SOURCE_PERMISSIONS"; literal_args += " USE_SOURCE_PERMISSIONS";
// TODO: Still need to apply install_name_tool and stripping
// to binaries inside bundle.
}
else
{
files.push_back(from1);
if(targetNameReal != targetName)
{
std::string from2 = fromDirConfig;
from2 += targetNameReal;
files.push_back(from2);
}
} }
} }
break;
case cmTarget::STATIC_LIBRARY:
case cmTarget::MODULE_LIBRARY:
// Nothing special for modules or static libraries.
break;
default:
break;
} }
else
// An import library looks like a static library.
if(this->ImportLibrary)
{ {
type = cmTarget::STATIC_LIBRARY; std::string targetName;
std::string targetNameSO;
std::string targetNameReal;
std::string targetNameImport;
std::string targetNamePDB;
this->Target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
targetNameImport, targetNamePDB,
config);
if(this->ImportLibrary)
{
std::string from1 = fromDirConfig;
from1 += targetNameImport;
files.push_back(from1);
// An import library looks like a static library.
type = cmTarget::STATIC_LIBRARY;
}
else
{
std::string from1 = fromDirConfig;
from1 += targetName;
files.push_back(from1);
if(targetNameSO != targetName)
{
std::string from2 = fromDirConfig;
from2 += targetNameSO;
files.push_back(from2);
}
if(targetNameReal != targetName &&
targetNameReal != targetNameSO)
{
std::string from3 = fromDirConfig;
from3 += targetNameReal;
files.push_back(from3);
}
}
} }
// Write code to install the target file. // Write code to install the target file.
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; const char* no_properties = 0;
this->AddInstallRule(os, destination.c_str(), type, fromFile.c_str(), const char* no_component = 0;
optional, properties, std::vector<std::string> no_configurations;
bool optional = this->Optional || this->ImportLibrary;
this->AddInstallRule(os, this->Destination.c_str(), type, files,
optional, no_properties,
this->FilePermissions.c_str(), no_dir_permissions, this->FilePermissions.c_str(), no_dir_permissions,
this->Configurations, no_configurations, no_component,
this->Component.c_str(),
no_rename, literal_args.c_str()); no_rename, literal_args.c_str());
// Fix the install_name settings in installed binaries. std::string toFullPath = "$ENV{DESTDIR}";
if((type == cmTarget::SHARED_LIBRARY || toFullPath += this->Destination;
type == cmTarget::MODULE_LIBRARY || toFullPath += "/";
type == cmTarget::EXECUTABLE)) toFullPath += this->GetInstallFilename(this->Target, config,
this->ImportLibrary, false);
os << " IF(EXISTS \"" << toFullPath << "\")\n";
this->AddInstallNamePatchRule(os, config, toFullPath);
this->AddRanlibRule(os, type, toFullPath);
this->AddStripRule(os, type, toFullPath);
os << " ENDIF(EXISTS \"" << toFullPath << "\")\n";
if(config && *config)
{ {
this->AddInstallNamePatchRule(os, destination.c_str()); // End this configuration block.
os << " ENDIF(" << config_test << ")\n";
} }
std::string quotedFullDestinationFilename = "\"$ENV{DESTDIR}";
quotedFullDestinationFilename += destination;
quotedFullDestinationFilename += "/";
quotedFullDestinationFilename += cmSystemTools::GetFilenameName(fromFile);
quotedFullDestinationFilename += "\"";
this->AddRanlibRule(os, type, quotedFullDestinationFilename);
this->AddStripRule(os, type, quotedFullDestinationFilename, optional);
} }
//----------------------------------------------------------------------------
std::string cmInstallTargetGenerator::GetInstallFilename(const char* config) const std::string
cmInstallTargetGenerator::GetInstallFilename(const char* config) const
{ {
return cmInstallTargetGenerator::GetInstallFilename(this->Target, config, this->ImportLibrary, false); return
cmInstallTargetGenerator::GetInstallFilename(this->Target, config,
this->ImportLibrary, false);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -254,76 +321,19 @@ std::string cmInstallTargetGenerator::GetInstallFilename(cmTarget* target,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmInstallTargetGenerator cmInstallTargetGenerator
::PrepareScriptReference(std::ostream& os, cmTarget* target, ::AddInstallNamePatchRule(std::ostream& os, const char* config,
const char* place, bool useConfigDir, std::string const& toFullPath)
bool implib, bool useSOName)
{ {
// If the target name may vary with the configuration type then if(this->ImportLibrary ||
// store all possible names ahead of time in variables. !(this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
std::string fname; this->Target->GetType() == cmTarget::MODULE_LIBRARY ||
for(std::vector<std::string>::const_iterator i = this->Target->GetType() == cmTarget::EXECUTABLE))
this->ConfigurationTypes->begin();
i != this->ConfigurationTypes->end(); ++i)
{ {
// Initialize the name. return;
fname = "";
if(useConfigDir)
{
// Start with the configuration's subdirectory.
target->GetMakefile()->GetLocalGenerator()->GetGlobalGenerator()->
AppendDirectoryForConfig("", i->c_str(), "/", fname);
}
fname += this->GetInstallFilename(target, i->c_str(),
implib, useSOName);
// Set a variable with the target name for this configuration.
os << "SET(" << target->GetName() << "_" << place
<< (implib? "_IMPNAME_" : "_NAME_") << *i
<< " \"" << fname << "\")\n";
} }
}
//---------------------------------------------------------------------------- // Fix the install_name settings in installed binaries.
std::string cmInstallTargetGenerator::GetScriptReference(cmTarget* target, std::string installNameTool =
const char* place,
bool implib, bool useSOName)
{
if(this->ConfigurationTypes->empty())
{
// Reference the target by its one configuration name.
return this->GetInstallFilename(target, this->ConfigurationName,
implib, useSOName);
}
else
{
// Reference the target using the per-configuration variable.
std::string ref = "${";
ref += target->GetName();
if(implib)
{
ref += "_";
ref += place;
ref += "_IMPNAME_";
}
else
{
ref += "_";
ref += place;
ref += "_NAME_";
}
ref += "${CMAKE_INSTALL_CONFIG_NAME}}";
return ref;
}
}
//----------------------------------------------------------------------------
void cmInstallTargetGenerator
::AddInstallNamePatchRule(std::ostream& os,
const char* destination)
{
std::string installNameTool =
this->Target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL"); this->Target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL");
if(!installNameTool.size()) if(!installNameTool.size())
@ -335,7 +345,6 @@ void cmInstallTargetGenerator
// shared libraries linked to this target. // shared libraries linked to this target.
std::map<cmStdString, cmStdString> install_name_remap; std::map<cmStdString, cmStdString> install_name_remap;
cmTarget::LinkLibraryType linkType = cmTarget::OPTIMIZED; cmTarget::LinkLibraryType linkType = cmTarget::OPTIMIZED;
const char* config = this->ConfigurationName;
if(config && cmSystemTools::UpperCase(config) == "DEBUG") if(config && cmSystemTools::UpperCase(config) == "DEBUG")
{ {
linkType = cmTarget::DEBUG; linkType = cmTarget::DEBUG;
@ -365,15 +374,13 @@ void cmInstallTargetGenerator
tgt->GetInstallNameDirForInstallTree(config); tgt->GetInstallNameDirForInstallTree(config);
if(for_build != for_install) if(for_build != for_install)
{ {
std::string fname =
this->GetInstallFilename(tgt, config, false, true);
// Map from the build-tree install_name. // Map from the build-tree install_name.
this->PrepareScriptReference(os, tgt, "REMAP_FROM", for_build += fname;
!for_build.empty(), false, true);
for_build += this->GetScriptReference(tgt, "REMAP_FROM", false, true);
// Map to the install-tree install_name. // Map to the install-tree install_name.
this->PrepareScriptReference(os, tgt, "REMAP_TO", for_install += fname;
false, false, true);
for_install += this->GetScriptReference(tgt, "REMAP_TO", false, true);
// Store the mapping entry. // Store the mapping entry.
install_name_remap[for_build] = for_install; install_name_remap[for_build] = for_install;
@ -384,7 +391,6 @@ void cmInstallTargetGenerator
} }
// Edit the install_name of the target itself if necessary. // Edit the install_name of the target itself if necessary.
this->PrepareScriptReference(os, this->Target, "REMAPPED", false, this->ImportLibrary, true);
std::string new_id; std::string new_id;
if(this->Target->GetType() == cmTarget::SHARED_LIBRARY) if(this->Target->GetType() == cmTarget::SHARED_LIBRARY)
{ {
@ -396,7 +402,8 @@ void cmInstallTargetGenerator
{ {
// Prepare to refer to the install-tree install_name. // Prepare to refer to the install-tree install_name.
new_id = for_install; new_id = for_install;
new_id += this->GetScriptReference(this->Target, "REMAPPED", this->ImportLibrary, true); new_id += this->GetInstallFilename(this->Target, config,
this->ImportLibrary, true);
} }
} }
@ -404,33 +411,27 @@ void cmInstallTargetGenerator
// install_name value and references. // install_name value and references.
if(!new_id.empty() || !install_name_remap.empty()) if(!new_id.empty() || !install_name_remap.empty())
{ {
std::string component_test = "NOT CMAKE_INSTALL_COMPONENT OR " os << " EXECUTE_PROCESS(COMMAND \"" << installNameTool;
"\"${CMAKE_INSTALL_COMPONENT}\" MATCHES \"^(";
component_test += this->Component;
component_test += ")$\"";
os << "IF(" << component_test << ")\n";
os << " EXECUTE_PROCESS(COMMAND \"" << installNameTool;
os << "\""; os << "\"";
if(!new_id.empty()) if(!new_id.empty())
{ {
os << "\n -id \"" << new_id << "\""; os << "\n -id \"" << new_id << "\"";
} }
for(std::map<cmStdString, cmStdString>::const_iterator for(std::map<cmStdString, cmStdString>::const_iterator
i = install_name_remap.begin(); i = install_name_remap.begin();
i != install_name_remap.end(); ++i) i != install_name_remap.end(); ++i)
{ {
os << "\n -change \"" << i->first << "\" \"" << i->second << "\""; os << "\n -change \"" << i->first << "\" \"" << i->second << "\"";
} }
os << "\n \"$ENV{DESTDIR}" << destination << "/" os << "\n \"" << toFullPath << "\")\n";
<< this->GetScriptReference(this->Target, "REMAPPED", this->ImportLibrary, true) << "\")\n";
os << "ENDIF(" << component_test << ")\n";
} }
} }
void cmInstallTargetGenerator::AddStripRule(std::ostream& os, //----------------------------------------------------------------------------
cmTarget::TargetType type, void
const std::string& quotedFullDestinationFilename, cmInstallTargetGenerator::AddStripRule(std::ostream& os,
bool optional) cmTarget::TargetType type,
const std::string& toFullPath)
{ {
// don't strip static libraries, because it removes the only symbol table // don't strip static libraries, because it removes the only symbol table
@ -452,23 +453,18 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os,
return; return;
} }
std::string optionalString; os << " IF(CMAKE_INSTALL_DO_STRIP)\n";
if (optional) os << " EXECUTE_PROCESS(COMMAND \""
{
optionalString = " AND EXISTS ";
optionalString += quotedFullDestinationFilename;
}
os << "IF(CMAKE_INSTALL_DO_STRIP" << optionalString << ")\n";
os << " EXECUTE_PROCESS(COMMAND \""
<< this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP") << this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP")
<< "\" " << quotedFullDestinationFilename << " )\n"; << "\" \"" << toFullPath << "\")\n";
os << "ENDIF(CMAKE_INSTALL_DO_STRIP" << optionalString << ")\n"; os << " ENDIF(CMAKE_INSTALL_DO_STRIP)\n";
} }
void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, //----------------------------------------------------------------------------
cmTarget::TargetType type, void
const std::string& quotedFullDestinationFilename) cmInstallTargetGenerator::AddRanlibRule(std::ostream& os,
cmTarget::TargetType type,
const std::string& toFullPath)
{ {
// Static libraries need ranlib on this platform. // Static libraries need ranlib on this platform.
if(type != cmTarget::STATIC_LIBRARY) if(type != cmTarget::STATIC_LIBRARY)
@ -483,14 +479,13 @@ void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os,
return; return;
} }
std::string ranlib = this->Target->GetMakefile()->GetRequiredDefinition( std::string ranlib =
"CMAKE_RANLIB"); this->Target->GetMakefile()->GetRequiredDefinition("CMAKE_RANLIB");
if (!ranlib.size()) if(ranlib.empty())
{ {
return; return;
} }
os << "EXECUTE_PROCESS(COMMAND \""; os << " EXECUTE_PROCESS(COMMAND \""
os << ranlib; << ranlib << "\" \"" << toFullPath << "\")\n";
os << "\" " << quotedFullDestinationFilename << " )\n";
} }

View File

@ -44,19 +44,15 @@ public:
protected: protected:
virtual void GenerateScript(std::ostream& os); virtual void GenerateScript(std::ostream& os);
void PrepareScriptReference(std::ostream& os, cmTarget* target, void GenerateScriptForConfig(std::ostream& os,
const char* place, bool useConfigDir, const char* fromDir,
bool implib, bool useSOName); const char* config);
std::string GetScriptReference(cmTarget* target, const char* place, void AddInstallNamePatchRule(std::ostream& os, const char* config,
bool implib, bool useSOName); const std::string& toFullPath);
void AddInstallNamePatchRule(std::ostream& os, const char* destination); void AddStripRule(std::ostream& os, cmTarget::TargetType type,
void AddStripRule(std::ostream& os, const std::string& toFullPath);
cmTarget::TargetType type, void AddRanlibRule(std::ostream& os, cmTarget::TargetType type,
const std::string& quotedFullDestinationFilename, const std::string& toFullPath);
bool optional);
void AddRanlibRule(std::ostream& os,
cmTarget::TargetType type,
const std::string& quotedFullDestinationFilename);
cmTarget* Target; cmTarget* Target;
bool ImportLibrary; bool ImportLibrary;