2006-02-19 23:25:27 +03:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
|
|
|
|
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
PURPOSE. See the above copyright notices for more information.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
#include "cmInstallTargetGenerator.h"
|
|
|
|
|
2008-01-29 23:07:33 +03:00
|
|
|
#include "cmComputeLinkInformation.h"
|
2006-02-20 03:29:30 +03:00
|
|
|
#include "cmGlobalGenerator.h"
|
|
|
|
#include "cmLocalGenerator.h"
|
2006-02-19 23:25:27 +03:00
|
|
|
#include "cmMakefile.h"
|
2006-06-14 20:28:32 +04:00
|
|
|
#include "cmake.h"
|
2006-02-19 23:25:27 +03:00
|
|
|
|
2008-02-05 03:00:33 +03:00
|
|
|
#include <assert.h>
|
|
|
|
|
2006-02-19 23:25:27 +03:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
cmInstallTargetGenerator
|
2006-03-04 03:29:35 +03:00
|
|
|
::cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib,
|
2006-08-17 22:48:54 +04:00
|
|
|
const char* file_permissions,
|
2006-05-05 22:57:19 +04:00
|
|
|
std::vector<std::string> const& configurations,
|
2006-10-05 19:31:57 +04:00
|
|
|
const char* component, bool optional):
|
2007-07-02 22:56:57 +04:00
|
|
|
cmInstallGenerator(dest, configurations, component), Target(&t),
|
|
|
|
ImportLibrary(implib), FilePermissions(file_permissions), Optional(optional)
|
2006-02-19 23:25:27 +03:00
|
|
|
{
|
2008-02-05 01:03:48 +03:00
|
|
|
this->NamelinkMode = NamelinkModeNone;
|
2006-02-20 01:27:47 +03:00
|
|
|
this->Target->SetHaveInstallRule(true);
|
2006-02-19 23:25:27 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
cmInstallTargetGenerator
|
|
|
|
::~cmInstallTargetGenerator()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
|
|
|
|
{
|
2007-08-04 00:31:08 +04:00
|
|
|
// Warn if installing an exclude-from-all target.
|
|
|
|
if(this->Target->GetPropertyAsBool("EXCLUDE_FROM_ALL"))
|
|
|
|
{
|
|
|
|
cmOStringStream msg;
|
|
|
|
msg << "WARNING: Target \"" << this->Target->GetName()
|
|
|
|
<< "\" has EXCLUDE_FROM_ALL set and will not be built by default "
|
|
|
|
<< "but an install rule has been provided for it. CMake does "
|
|
|
|
<< "not define behavior for this case.";
|
|
|
|
cmSystemTools::Message(msg.str().c_str(), "Warning");
|
|
|
|
}
|
|
|
|
|
2006-02-19 23:25:27 +03:00
|
|
|
// Compute the build tree directory from which to copy the target.
|
2008-10-03 18:11:47 +04:00
|
|
|
std::string& fromDir = this->FromDir;
|
2006-02-19 23:25:27 +03:00
|
|
|
if(this->Target->NeedRelinkBeforeInstall())
|
|
|
|
{
|
|
|
|
fromDir = this->Target->GetMakefile()->GetStartOutputDirectory();
|
2006-06-14 20:28:32 +04:00
|
|
|
fromDir += cmake::GetCMakeFilesDirectory();
|
|
|
|
fromDir += "/CMakeRelink.dir/";
|
2006-02-19 23:25:27 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-03-09 17:30:16 +03:00
|
|
|
fromDir = this->Target->GetDirectory(0, this->ImportLibrary);
|
2006-02-19 23:25:27 +03:00
|
|
|
fromDir += "/";
|
|
|
|
}
|
|
|
|
|
2008-10-03 18:11:47 +04:00
|
|
|
// Perform the main install script generation.
|
|
|
|
this->cmInstallGenerator::GenerateScript(os);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmInstallTargetGenerator::GenerateScriptConfigs(std::ostream& os,
|
|
|
|
Indent const& indent)
|
|
|
|
{
|
2007-06-29 00:11:18 +04:00
|
|
|
if(this->ConfigurationTypes->empty())
|
|
|
|
{
|
2008-10-03 18:11:47 +04:00
|
|
|
// In a single-configuration generator, only the install rule's
|
|
|
|
// configuration test is important. If that passes, the target is
|
|
|
|
// installed regardless of for what configuration it was built.
|
|
|
|
this->cmInstallGenerator::GenerateScriptConfigs(os, indent);
|
2007-06-29 00:11:18 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-10-03 18:11:47 +04:00
|
|
|
// In a multi-configuration generator, a separate rule is produced
|
|
|
|
// in a block for each configuration that is built. However, the
|
|
|
|
// list of configurations is restricted to those for which this
|
|
|
|
// install rule applies.
|
2007-06-29 00:11:18 +04:00
|
|
|
for(std::vector<std::string>::const_iterator i =
|
|
|
|
this->ConfigurationTypes->begin();
|
|
|
|
i != this->ConfigurationTypes->end(); ++i)
|
|
|
|
{
|
2008-10-03 18:11:47 +04:00
|
|
|
const char* config = i->c_str();
|
|
|
|
if(this->InstallsForConfig(config))
|
|
|
|
{
|
|
|
|
// Generate a per-configuration block.
|
|
|
|
std::string config_test = this->CreateConfigTest(config);
|
|
|
|
os << indent << "IF(" << config_test << ")\n";
|
|
|
|
this->GenerateScriptForConfig(os, config, indent.Next());
|
|
|
|
os << indent << "ENDIF(" << config_test << ")\n";
|
|
|
|
}
|
2007-06-29 00:11:18 +04:00
|
|
|
}
|
|
|
|
}
|
2008-10-03 18:11:47 +04:00
|
|
|
}
|
2006-02-19 23:25:27 +03:00
|
|
|
|
2008-10-03 18:11:47 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmInstallTargetGenerator::GenerateScriptActions(std::ostream& os,
|
|
|
|
Indent const& indent)
|
|
|
|
{
|
|
|
|
// This is reached for single-configuration generators only.
|
|
|
|
this->GenerateScriptForConfig(os, this->ConfigurationName, indent);
|
2007-07-02 19:02:52 +04:00
|
|
|
}
|
|
|
|
|
2007-06-29 00:11:18 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
|
2007-07-02 19:02:52 +04:00
|
|
|
const char* config,
|
|
|
|
Indent const& indent)
|
2007-06-29 00:11:18 +04:00
|
|
|
{
|
|
|
|
// Compute the per-configuration directory containing the files.
|
2008-10-03 18:11:47 +04:00
|
|
|
std::string fromDirConfig = this->FromDir;
|
2007-06-29 00:11:18 +04:00
|
|
|
this->Target->GetMakefile()->GetLocalGenerator()->GetGlobalGenerator()
|
|
|
|
->AppendDirectoryForConfig("", config, "/", fromDirConfig);
|
2006-03-03 20:58:48 +03:00
|
|
|
|
2007-07-02 19:31:10 +04:00
|
|
|
// Compute the full path to the main installed file for this target.
|
2008-02-06 22:20:36 +03:00
|
|
|
NameType nameType = this->ImportLibrary? NameImplib : NameNormal;
|
2008-01-28 16:38:36 +03:00
|
|
|
std::string toInstallPath = this->GetInstallDestination();
|
2007-08-24 21:30:41 +04:00
|
|
|
toInstallPath += "/";
|
2008-02-06 22:20:36 +03:00
|
|
|
toInstallPath += this->GetInstallFilename(this->Target, config, nameType);
|
2007-07-02 19:31:10 +04:00
|
|
|
|
2008-02-05 01:03:48 +03:00
|
|
|
// Track whether post-install operations should be added to the
|
|
|
|
// script.
|
|
|
|
bool tweakInstalledFile = true;
|
|
|
|
|
2007-06-29 00:11:18 +04:00
|
|
|
// 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)
|
|
|
|
{
|
2008-02-05 01:03:48 +03:00
|
|
|
// There is a bug in cmInstallCommand if this fails.
|
|
|
|
assert(this->NamelinkMode == NamelinkModeNone);
|
|
|
|
|
2007-06-29 00:11:18 +04:00
|
|
|
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
|
2006-02-19 23:25:27 +03:00
|
|
|
{
|
2007-06-29 00:11:18 +04:00
|
|
|
std::string from1 = fromDirConfig;
|
|
|
|
from1 += targetName;
|
2006-02-19 23:25:27 +03:00
|
|
|
|
|
|
|
// Handle OSX Bundles.
|
2008-01-28 22:46:16 +03:00
|
|
|
if(this->Target->IsAppBundleOnApple())
|
2006-02-19 23:25:27 +03:00
|
|
|
{
|
|
|
|
// Compute the source locations of the bundle executable and
|
|
|
|
// Info.plist file.
|
2007-06-29 00:11:18 +04:00
|
|
|
from1 += ".app";
|
|
|
|
files.push_back(from1);
|
2006-03-28 22:16:15 +04:00
|
|
|
type = cmTarget::INSTALL_DIRECTORY;
|
2007-07-02 22:56:57 +04:00
|
|
|
// Need to apply install_name_tool and stripping to binary
|
|
|
|
// inside bundle.
|
2007-08-24 21:30:41 +04:00
|
|
|
toInstallPath += ".app/Contents/MacOS/";
|
2008-02-06 22:20:36 +03:00
|
|
|
toInstallPath +=
|
|
|
|
this->GetInstallFilename(this->Target, config, nameType);
|
2006-08-22 00:55:03 +04:00
|
|
|
literal_args += " USE_SOURCE_PERMISSIONS";
|
2007-06-29 00:11:18 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-05-27 18:21:21 +04:00
|
|
|
// Operations done at install time on the installed file should
|
|
|
|
// be done on the real file and not any of the symlinks.
|
|
|
|
toInstallPath = this->GetInstallDestination();
|
|
|
|
toInstallPath += "/";
|
|
|
|
toInstallPath += targetNameReal;
|
|
|
|
|
2007-06-29 00:11:18 +04:00
|
|
|
files.push_back(from1);
|
|
|
|
if(targetNameReal != targetName)
|
|
|
|
{
|
|
|
|
std::string from2 = fromDirConfig;
|
|
|
|
from2 += targetNameReal;
|
|
|
|
files.push_back(from2);
|
|
|
|
}
|
2006-02-19 23:25:27 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-06-29 00:11:18 +04:00
|
|
|
else
|
2006-02-20 00:10:23 +03:00
|
|
|
{
|
2007-06-29 00:11:18 +04:00
|
|
|
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)
|
|
|
|
{
|
2008-02-05 01:03:48 +03:00
|
|
|
// There is a bug in cmInstallCommand if this fails.
|
|
|
|
assert(this->NamelinkMode == NamelinkModeNone);
|
|
|
|
|
2007-06-29 00:11:18 +04:00
|
|
|
std::string from1 = fromDirConfig;
|
|
|
|
from1 += targetNameImport;
|
|
|
|
files.push_back(from1);
|
|
|
|
|
|
|
|
// An import library looks like a static library.
|
|
|
|
type = cmTarget::STATIC_LIBRARY;
|
|
|
|
}
|
2008-01-28 21:05:58 +03:00
|
|
|
else if(this->Target->IsFrameworkOnApple())
|
2007-08-24 21:30:41 +04:00
|
|
|
{
|
2008-02-05 01:03:48 +03:00
|
|
|
// There is a bug in cmInstallCommand if this fails.
|
|
|
|
assert(this->NamelinkMode == NamelinkModeNone);
|
|
|
|
|
2007-08-24 21:30:41 +04:00
|
|
|
// Compute the build tree location of the framework directory
|
|
|
|
std::string from1 = fromDirConfig;
|
2008-04-08 08:06:47 +04:00
|
|
|
from1 += targetName;
|
|
|
|
from1 += ".framework";
|
2007-08-24 21:30:41 +04:00
|
|
|
files.push_back(from1);
|
|
|
|
|
|
|
|
type = cmTarget::INSTALL_DIRECTORY;
|
|
|
|
|
|
|
|
// Need to apply install_name_tool and stripping to binary
|
|
|
|
// inside framework.
|
2008-04-08 08:06:47 +04:00
|
|
|
toInstallPath += ".framework/Versions/";
|
|
|
|
toInstallPath += this->Target->GetFrameworkVersion();
|
|
|
|
toInstallPath += "/";
|
2007-08-24 21:30:41 +04:00
|
|
|
toInstallPath += this->GetInstallFilename(this->Target, config,
|
2008-02-06 22:20:36 +03:00
|
|
|
NameNormal);
|
2007-08-24 21:30:41 +04:00
|
|
|
|
|
|
|
literal_args += " USE_SOURCE_PERMISSIONS";
|
|
|
|
}
|
2007-06-29 00:11:18 +04:00
|
|
|
else
|
|
|
|
{
|
2008-02-05 01:03:48 +03:00
|
|
|
// Operations done at install time on the installed file should
|
|
|
|
// be done on the real file and not any of the symlinks.
|
|
|
|
toInstallPath = this->GetInstallDestination();
|
|
|
|
toInstallPath += "/";
|
|
|
|
toInstallPath += targetNameReal;
|
|
|
|
|
|
|
|
// Construct the list of file names to install for this library.
|
|
|
|
bool haveNamelink = false;
|
|
|
|
std::string fromName;
|
|
|
|
std::string fromSOName;
|
|
|
|
std::string fromRealName;
|
|
|
|
fromName = fromDirConfig;
|
|
|
|
fromName += targetName;
|
2007-06-29 00:11:18 +04:00
|
|
|
if(targetNameSO != targetName)
|
|
|
|
{
|
2008-02-05 01:03:48 +03:00
|
|
|
haveNamelink = true;
|
|
|
|
fromSOName = fromDirConfig;
|
|
|
|
fromSOName += targetNameSO;
|
2007-06-29 00:11:18 +04:00
|
|
|
}
|
|
|
|
if(targetNameReal != targetName &&
|
|
|
|
targetNameReal != targetNameSO)
|
|
|
|
{
|
2008-02-05 01:03:48 +03:00
|
|
|
haveNamelink = true;
|
|
|
|
fromRealName = fromDirConfig;
|
|
|
|
fromRealName += targetNameReal;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add the names based on the current namelink mode.
|
|
|
|
if(haveNamelink)
|
|
|
|
{
|
|
|
|
// With a namelink we need to check the mode.
|
|
|
|
if(this->NamelinkMode == NamelinkModeOnly)
|
|
|
|
{
|
|
|
|
// Install the namelink only.
|
|
|
|
files.push_back(fromName);
|
|
|
|
tweakInstalledFile = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Install the real file if it has its own name.
|
|
|
|
if(!fromRealName.empty())
|
|
|
|
{
|
|
|
|
files.push_back(fromRealName);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Install the soname link if it has its own name.
|
|
|
|
if(!fromSOName.empty())
|
|
|
|
{
|
|
|
|
files.push_back(fromSOName);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Install the namelink if it is not to be skipped.
|
|
|
|
if(this->NamelinkMode != NamelinkModeSkip)
|
|
|
|
{
|
|
|
|
files.push_back(fromName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Without a namelink there will be only one file. Install it
|
|
|
|
// if this is not a namelink-only rule.
|
|
|
|
if(this->NamelinkMode != NamelinkModeOnly)
|
|
|
|
{
|
|
|
|
files.push_back(fromName);
|
|
|
|
}
|
2007-06-29 00:11:18 +04:00
|
|
|
}
|
|
|
|
}
|
2006-02-20 00:10:23 +03:00
|
|
|
}
|
|
|
|
|
2008-02-05 01:03:48 +03:00
|
|
|
// Skip this rule if no files are to be installed for the target.
|
|
|
|
if(files.empty())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-04-14 23:02:44 +04:00
|
|
|
// Construct the path of the file on disk after installation on
|
|
|
|
// which tweaks may be performed.
|
|
|
|
std::string toDestDirPath = "$ENV{DESTDIR}";
|
|
|
|
if(toInstallPath[0] != '/' && toInstallPath[0] != '$')
|
|
|
|
{
|
|
|
|
toDestDirPath += "/";
|
|
|
|
}
|
|
|
|
toDestDirPath += toInstallPath;
|
|
|
|
|
|
|
|
// Add pre-installation tweaks.
|
|
|
|
if(tweakInstalledFile)
|
|
|
|
{
|
|
|
|
// Collect tweaking rules.
|
|
|
|
cmOStringStream tw;
|
|
|
|
this->AddRPathCheckRule(tw, indent.Next(), config, toDestDirPath);
|
|
|
|
std::string tws = tw.str();
|
|
|
|
|
|
|
|
// Add the rules, if any.
|
|
|
|
if(!tws.empty())
|
|
|
|
{
|
|
|
|
os << indent << "IF(EXISTS \"" << toDestDirPath << "\")\n";
|
|
|
|
os << tws;
|
|
|
|
os << indent << "ENDIF(EXISTS \"" << toDestDirPath << "\")\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-19 23:25:27 +03:00
|
|
|
// Write code to install the target file.
|
2006-08-17 22:48:54 +04:00
|
|
|
const char* no_dir_permissions = 0;
|
2006-08-22 00:55:03 +04:00
|
|
|
const char* no_rename = 0;
|
2007-06-29 00:11:18 +04:00
|
|
|
const char* no_properties = 0;
|
|
|
|
bool optional = this->Optional || this->ImportLibrary;
|
2008-01-28 16:38:36 +03:00
|
|
|
this->AddInstallRule(os, type, files,
|
2007-06-29 00:11:18 +04:00
|
|
|
optional, no_properties,
|
2006-08-17 22:48:54 +04:00
|
|
|
this->FilePermissions.c_str(), no_dir_permissions,
|
2007-07-02 19:02:52 +04:00
|
|
|
no_rename, literal_args.c_str(),
|
|
|
|
indent);
|
2006-02-24 21:13:14 +03:00
|
|
|
|
2008-04-14 23:02:44 +04:00
|
|
|
// Add post-installation tweaks.
|
2008-02-05 01:03:48 +03:00
|
|
|
if(tweakInstalledFile)
|
|
|
|
{
|
2008-04-14 23:02:44 +04:00
|
|
|
// Collect tweaking rules.
|
|
|
|
cmOStringStream tw;
|
|
|
|
this->AddInstallNamePatchRule(tw, indent.Next(), config, toDestDirPath);
|
|
|
|
this->AddChrpathPatchRule(tw, indent.Next(), config, toDestDirPath);
|
|
|
|
this->AddRanlibRule(tw, indent.Next(), type, toDestDirPath);
|
|
|
|
this->AddStripRule(tw, indent.Next(), type, toDestDirPath);
|
|
|
|
std::string tws = tw.str();
|
|
|
|
|
|
|
|
// Add the rules, if any.
|
|
|
|
if(!tws.empty())
|
|
|
|
{
|
|
|
|
os << indent << "IF(EXISTS \"" << toDestDirPath << "\")\n";
|
|
|
|
os << tws;
|
|
|
|
os << indent << "ENDIF(EXISTS \"" << toDestDirPath << "\")\n";
|
|
|
|
}
|
2008-02-05 01:03:48 +03:00
|
|
|
}
|
2006-02-19 23:25:27 +03:00
|
|
|
}
|
|
|
|
|
2007-06-29 00:11:18 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
std::string
|
|
|
|
cmInstallTargetGenerator::GetInstallFilename(const char* config) const
|
2007-06-19 19:11:06 +04:00
|
|
|
{
|
2008-02-06 22:20:36 +03:00
|
|
|
NameType nameType = this->ImportLibrary? NameImplib : NameNormal;
|
2007-06-29 00:11:18 +04:00
|
|
|
return
|
|
|
|
cmInstallTargetGenerator::GetInstallFilename(this->Target, config,
|
2008-02-06 22:20:36 +03:00
|
|
|
nameType);
|
2007-06-19 19:11:06 +04:00
|
|
|
}
|
|
|
|
|
2007-06-15 22:27:33 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
std::string cmInstallTargetGenerator::GetInstallFilename(cmTarget* target,
|
|
|
|
const char* config,
|
2008-02-06 22:20:36 +03:00
|
|
|
NameType nameType)
|
2007-06-15 22:27:33 +04:00
|
|
|
{
|
|
|
|
std::string fname;
|
|
|
|
// Compute the name of the library.
|
|
|
|
if(target->GetType() == cmTarget::EXECUTABLE)
|
|
|
|
{
|
|
|
|
std::string targetName;
|
|
|
|
std::string targetNameReal;
|
|
|
|
std::string targetNameImport;
|
|
|
|
std::string targetNamePDB;
|
|
|
|
target->GetExecutableNames(targetName, targetNameReal,
|
|
|
|
targetNameImport, targetNamePDB,
|
|
|
|
config);
|
2008-02-06 22:20:36 +03:00
|
|
|
if(nameType == NameImplib)
|
2007-06-15 22:27:33 +04:00
|
|
|
{
|
|
|
|
// Use the import library name.
|
|
|
|
fname = targetNameImport;
|
|
|
|
}
|
2008-02-06 22:20:36 +03:00
|
|
|
else if(nameType == NameReal)
|
|
|
|
{
|
|
|
|
// Use the canonical name.
|
|
|
|
fname = targetNameReal;
|
|
|
|
}
|
2007-06-15 22:27:33 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Use the canonical name.
|
|
|
|
fname = targetName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::string targetName;
|
|
|
|
std::string targetNameSO;
|
|
|
|
std::string targetNameReal;
|
|
|
|
std::string targetNameImport;
|
|
|
|
std::string targetNamePDB;
|
|
|
|
target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
|
|
|
|
targetNameImport, targetNamePDB, config);
|
2008-02-06 22:20:36 +03:00
|
|
|
if(nameType == NameImplib)
|
2007-06-15 22:27:33 +04:00
|
|
|
{
|
|
|
|
// Use the import library name.
|
|
|
|
fname = targetNameImport;
|
|
|
|
}
|
2008-02-06 22:20:36 +03:00
|
|
|
else if(nameType == NameSO)
|
2007-06-15 22:27:33 +04:00
|
|
|
{
|
|
|
|
// Use the soname.
|
|
|
|
fname = targetNameSO;
|
|
|
|
}
|
2008-02-06 22:20:36 +03:00
|
|
|
else if(nameType == NameReal)
|
|
|
|
{
|
|
|
|
// Use the real name.
|
|
|
|
fname = targetNameReal;
|
|
|
|
}
|
2007-06-15 22:27:33 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Use the canonical name.
|
|
|
|
fname = targetName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return fname;
|
|
|
|
}
|
|
|
|
|
2006-02-19 23:25:27 +03:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void
|
|
|
|
cmInstallTargetGenerator
|
2007-07-02 19:02:52 +04:00
|
|
|
::AddInstallNamePatchRule(std::ostream& os, Indent const& indent,
|
2007-08-24 21:30:41 +04:00
|
|
|
const char* config, std::string const& toDestDirPath)
|
2006-02-19 23:25:27 +03:00
|
|
|
{
|
2007-06-29 00:11:18 +04:00
|
|
|
if(this->ImportLibrary ||
|
|
|
|
!(this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
|
|
|
|
this->Target->GetType() == cmTarget::MODULE_LIBRARY ||
|
|
|
|
this->Target->GetType() == cmTarget::EXECUTABLE))
|
2006-02-19 23:25:27 +03:00
|
|
|
{
|
2007-06-29 00:11:18 +04:00
|
|
|
return;
|
2006-02-19 23:25:27 +03:00
|
|
|
}
|
2006-02-24 21:13:14 +03:00
|
|
|
|
2007-06-29 00:11:18 +04:00
|
|
|
// Fix the install_name settings in installed binaries.
|
2007-08-24 21:30:41 +04:00
|
|
|
std::string installNameTool =
|
2007-05-18 01:43:32 +04:00
|
|
|
this->Target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL");
|
2007-08-24 21:30:41 +04:00
|
|
|
|
2007-05-18 01:21:52 +04:00
|
|
|
if(!installNameTool.size())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-02-24 21:13:14 +03:00
|
|
|
// Build a map of build-tree install_name to install-tree install_name for
|
|
|
|
// shared libraries linked to this target.
|
|
|
|
std::map<cmStdString, cmStdString> install_name_remap;
|
2008-01-29 23:47:18 +03:00
|
|
|
if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config))
|
2006-02-24 21:13:14 +03:00
|
|
|
{
|
2008-01-29 23:47:18 +03:00
|
|
|
std::set<cmTarget*> const& sharedLibs = cli->GetSharedLibrariesLinked();
|
|
|
|
for(std::set<cmTarget*>::const_iterator j = sharedLibs.begin();
|
|
|
|
j != sharedLibs.end(); ++j)
|
2006-02-24 21:13:14 +03:00
|
|
|
{
|
2008-01-29 23:47:18 +03:00
|
|
|
// If the build tree and install tree use different path
|
|
|
|
// components of the install_name field then we need to create a
|
|
|
|
// mapping to be applied after installation.
|
|
|
|
cmTarget* tgt = *j;
|
|
|
|
std::string for_build = tgt->GetInstallNameDirForBuildTree(config);
|
|
|
|
std::string for_install = tgt->GetInstallNameDirForInstallTree(config);
|
2008-02-01 21:08:12 +03:00
|
|
|
if(for_build != for_install)
|
|
|
|
{
|
|
|
|
// The directory portions differ. Append the filename to
|
|
|
|
// create the mapping.
|
|
|
|
std::string fname =
|
2008-02-06 22:20:36 +03:00
|
|
|
this->GetInstallFilename(tgt, config, NameSO);
|
2008-01-29 23:47:18 +03:00
|
|
|
|
2008-02-01 21:08:12 +03:00
|
|
|
// Map from the build-tree install_name.
|
|
|
|
for_build += fname;
|
2008-01-29 23:47:18 +03:00
|
|
|
|
2008-02-01 21:08:12 +03:00
|
|
|
// Map to the install-tree install_name.
|
2008-01-29 23:47:18 +03:00
|
|
|
for_install += fname;
|
|
|
|
|
|
|
|
// Store the mapping entry.
|
|
|
|
install_name_remap[for_build] = for_install;
|
2006-02-24 21:13:14 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Edit the install_name of the target itself if necessary.
|
|
|
|
std::string new_id;
|
|
|
|
if(this->Target->GetType() == cmTarget::SHARED_LIBRARY)
|
|
|
|
{
|
2008-02-01 21:08:12 +03:00
|
|
|
std::string for_build =
|
2006-05-11 23:50:11 +04:00
|
|
|
this->Target->GetInstallNameDirForBuildTree(config);
|
2008-02-01 21:08:12 +03:00
|
|
|
std::string for_install =
|
2006-05-11 23:50:11 +04:00
|
|
|
this->Target->GetInstallNameDirForInstallTree(config);
|
2008-02-01 21:08:12 +03:00
|
|
|
|
|
|
|
if(this->Target->IsFrameworkOnApple() && for_install.empty())
|
2007-08-24 21:30:41 +04:00
|
|
|
{
|
2008-02-01 21:08:12 +03:00
|
|
|
// Frameworks seem to have an id corresponding to their own full
|
|
|
|
// path.
|
|
|
|
// ...
|
|
|
|
// for_install = fullDestPath_without_DESTDIR_or_name;
|
2007-08-24 21:30:41 +04:00
|
|
|
}
|
2008-02-01 21:08:12 +03:00
|
|
|
|
|
|
|
// If the install name will change on installation set the new id
|
|
|
|
// on the installed file.
|
2006-02-24 21:13:14 +03:00
|
|
|
if(for_build != for_install)
|
|
|
|
{
|
|
|
|
// Prepare to refer to the install-tree install_name.
|
|
|
|
new_id = for_install;
|
2008-02-06 22:20:36 +03:00
|
|
|
new_id += this->GetInstallFilename(this->Target, config, NameSO);
|
2006-02-24 21:13:14 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Write a rule to run install_name_tool to set the install-tree
|
|
|
|
// install_name value and references.
|
|
|
|
if(!new_id.empty() || !install_name_remap.empty())
|
|
|
|
{
|
2007-07-02 19:02:52 +04:00
|
|
|
os << indent << "EXECUTE_PROCESS(COMMAND \"" << installNameTool;
|
ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions
Alex
2007-05-17 21:20:44 +04:00
|
|
|
os << "\"";
|
2006-02-24 21:13:14 +03:00
|
|
|
if(!new_id.empty())
|
|
|
|
{
|
2007-07-02 19:02:52 +04:00
|
|
|
os << "\n" << indent << " -id \"" << new_id << "\"";
|
2006-02-24 21:13:14 +03:00
|
|
|
}
|
|
|
|
for(std::map<cmStdString, cmStdString>::const_iterator
|
|
|
|
i = install_name_remap.begin();
|
|
|
|
i != install_name_remap.end(); ++i)
|
|
|
|
{
|
2007-07-02 19:02:52 +04:00
|
|
|
os << "\n" << indent << " -change \""
|
|
|
|
<< i->first << "\" \"" << i->second << "\"";
|
2006-02-24 21:13:14 +03:00
|
|
|
}
|
2007-08-24 21:30:41 +04:00
|
|
|
os << "\n" << indent << " \"" << toDestDirPath << "\")\n";
|
2006-02-24 21:13:14 +03:00
|
|
|
}
|
|
|
|
}
|
ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions
Alex
2007-05-17 21:20:44 +04:00
|
|
|
|
2008-04-14 23:02:44 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void
|
|
|
|
cmInstallTargetGenerator
|
|
|
|
::AddRPathCheckRule(std::ostream& os, Indent const& indent,
|
|
|
|
const char* config, std::string const& toDestDirPath)
|
|
|
|
{
|
|
|
|
// Skip the chrpath if the target does not need it.
|
|
|
|
if(this->ImportLibrary || !this->Target->IsChrpathUsed())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the link information for this target.
|
|
|
|
// It can provide the RPATH.
|
|
|
|
cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config);
|
|
|
|
if(!cli)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the install RPATH from the link information.
|
|
|
|
std::string newRpath = cli->GetChrpathString();
|
|
|
|
|
|
|
|
// Write a rule to remove the installed file if its rpath is not the
|
|
|
|
// new rpath. This is needed for existing build/install trees when
|
|
|
|
// the installed rpath changes but the file is not rebuilt.
|
|
|
|
os << indent << "FILE(RPATH_CHECK\n"
|
|
|
|
<< indent << " FILE \"" << toDestDirPath << "\"\n"
|
|
|
|
<< indent << " RPATH \"" << newRpath << "\")\n";
|
|
|
|
}
|
|
|
|
|
2007-12-19 01:50:27 +03:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void
|
|
|
|
cmInstallTargetGenerator
|
|
|
|
::AddChrpathPatchRule(std::ostream& os, Indent const& indent,
|
2008-01-29 23:07:33 +03:00
|
|
|
const char* config, std::string const& toDestDirPath)
|
2007-12-19 01:50:27 +03:00
|
|
|
{
|
2008-03-02 22:35:23 +03:00
|
|
|
// Skip the chrpath if the target does not need it.
|
|
|
|
if(this->ImportLibrary || !this->Target->IsChrpathUsed())
|
2007-12-19 01:50:27 +03:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-01-29 23:07:33 +03:00
|
|
|
// Get the link information for this target.
|
|
|
|
// It can provide the RPATH.
|
|
|
|
cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config);
|
|
|
|
if(!cli)
|
2007-12-19 01:50:27 +03:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-03-02 22:35:23 +03:00
|
|
|
// Construct the original rpath string to be replaced.
|
|
|
|
std::string oldRpath = cli->GetRPathString(false);
|
|
|
|
|
2008-01-29 23:07:33 +03:00
|
|
|
// Get the install RPATH from the link information.
|
|
|
|
std::string newRpath = cli->GetChrpathString();
|
2007-12-19 01:50:27 +03:00
|
|
|
|
2008-03-03 00:48:50 +03:00
|
|
|
// Skip the rule if the paths are identical
|
|
|
|
if(oldRpath == newRpath)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-12-19 01:50:27 +03:00
|
|
|
// Write a rule to run chrpath to set the install-tree RPATH
|
2008-04-14 23:02:44 +04:00
|
|
|
if(newRpath.empty())
|
|
|
|
{
|
|
|
|
os << indent << "FILE(RPATH_REMOVE\n"
|
|
|
|
<< indent << " FILE \"" << toDestDirPath << "\")\n";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
os << indent << "FILE(RPATH_CHANGE\n"
|
|
|
|
<< indent << " FILE \"" << toDestDirPath << "\"\n"
|
|
|
|
<< indent << " OLD_RPATH \"" << oldRpath << "\"\n"
|
|
|
|
<< indent << " NEW_RPATH \"" << newRpath << "\")\n";
|
|
|
|
}
|
2007-12-19 01:50:27 +03:00
|
|
|
}
|
|
|
|
|
2007-06-29 00:11:18 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void
|
|
|
|
cmInstallTargetGenerator::AddStripRule(std::ostream& os,
|
2007-07-02 19:02:52 +04:00
|
|
|
Indent const& indent,
|
2007-06-29 00:11:18 +04:00
|
|
|
cmTarget::TargetType type,
|
2007-08-24 21:30:41 +04:00
|
|
|
const std::string& toDestDirPath)
|
ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions
Alex
2007-05-17 21:20:44 +04:00
|
|
|
{
|
|
|
|
|
2007-06-15 21:00:54 +04:00
|
|
|
// don't strip static libraries, because it removes the only symbol table
|
|
|
|
// they have so you can't link to them anymore
|
|
|
|
if(type == cmTarget::STATIC_LIBRARY)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions
Alex
2007-05-17 21:20:44 +04:00
|
|
|
// Don't handle OSX Bundles.
|
|
|
|
if(this->Target->GetMakefile()->IsOn("APPLE") &&
|
|
|
|
this->Target->GetPropertyAsBool("MACOSX_BUNDLE"))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(! this->Target->GetMakefile()->IsSet("CMAKE_STRIP"))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-07-02 19:02:52 +04:00
|
|
|
os << indent << "IF(CMAKE_INSTALL_DO_STRIP)\n";
|
|
|
|
os << indent << " EXECUTE_PROCESS(COMMAND \""
|
2007-06-15 19:12:07 +04:00
|
|
|
<< this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP")
|
2007-08-24 21:30:41 +04:00
|
|
|
<< "\" \"" << toDestDirPath << "\")\n";
|
2007-07-02 19:02:52 +04:00
|
|
|
os << indent << "ENDIF(CMAKE_INSTALL_DO_STRIP)\n";
|
ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions
Alex
2007-05-17 21:20:44 +04:00
|
|
|
}
|
|
|
|
|
2007-06-29 00:11:18 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void
|
|
|
|
cmInstallTargetGenerator::AddRanlibRule(std::ostream& os,
|
2007-07-02 19:02:52 +04:00
|
|
|
Indent const& indent,
|
2007-06-29 00:11:18 +04:00
|
|
|
cmTarget::TargetType type,
|
2007-08-24 21:30:41 +04:00
|
|
|
const std::string& toDestDirPath)
|
ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions
Alex
2007-05-17 21:20:44 +04:00
|
|
|
{
|
|
|
|
// Static libraries need ranlib on this platform.
|
|
|
|
if(type != cmTarget::STATIC_LIBRARY)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Perform post-installation processing on the file depending
|
|
|
|
// on its type.
|
|
|
|
if(!this->Target->GetMakefile()->IsOn("APPLE"))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-06-29 00:11:18 +04:00
|
|
|
std::string ranlib =
|
|
|
|
this->Target->GetMakefile()->GetRequiredDefinition("CMAKE_RANLIB");
|
|
|
|
if(ranlib.empty())
|
ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions
Alex
2007-05-17 21:20:44 +04:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-07-02 19:02:52 +04:00
|
|
|
os << indent << "EXECUTE_PROCESS(COMMAND \""
|
2007-08-24 21:30:41 +04:00
|
|
|
<< ranlib << "\" \"" << toDestDirPath << "\")\n";
|
ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions
Alex
2007-05-17 21:20:44 +04:00
|
|
|
}
|