2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2006-02-19 23:25:27 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2006-02-19 23:25:27 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2006-02-19 23:25:27 +03:00
|
|
|
#include "cmInstallTargetGenerator.h"
|
|
|
|
|
2008-01-29 23:07:33 +03:00
|
|
|
#include "cmComputeLinkInformation.h"
|
2015-02-11 22:02:45 +03:00
|
|
|
#include "cmGeneratorExpression.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmGeneratorTarget.h"
|
|
|
|
#include "cmGeneratorTarget.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>
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
cmInstallTargetGenerator::cmInstallTargetGenerator(
|
|
|
|
const std::string& targetName, const char* dest, bool implib,
|
|
|
|
const char* file_permissions, std::vector<std::string> const& configurations,
|
|
|
|
const char* component, MessageLevel message, bool exclude_from_all,
|
|
|
|
bool optional)
|
|
|
|
: cmInstallGenerator(dest, configurations, component, message,
|
|
|
|
exclude_from_all)
|
|
|
|
, TargetName(targetName)
|
|
|
|
, Target(0)
|
|
|
|
, FilePermissions(file_permissions)
|
|
|
|
, ImportLibrary(implib)
|
|
|
|
, Optional(optional)
|
2006-02-19 23:25:27 +03:00
|
|
|
{
|
2009-03-16 17:39:56 +03:00
|
|
|
this->ActionsPerConfig = true;
|
2008-02-05 01:03:48 +03:00
|
|
|
this->NamelinkMode = NamelinkModeNone;
|
2006-02-19 23:25:27 +03:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
cmInstallTargetGenerator::~cmInstallTargetGenerator()
|
2006-02-19 23:25:27 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
|
|
|
|
{
|
2007-08-04 00:31:08 +04:00
|
|
|
// Warn if installing an exclude-from-all target.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->Target->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
|
2015-01-05 22:31:31 +03:00
|
|
|
std::ostringstream msg;
|
2007-08-04 00:31:08 +04:00
|
|
|
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");
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-08-04 00:31:08 +04:00
|
|
|
|
2008-10-03 18:11:47 +04:00
|
|
|
// Perform the main install script generation.
|
|
|
|
this->cmInstallGenerator::GenerateScript(os);
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmInstallTargetGenerator::GenerateScriptForConfig(
|
|
|
|
std::ostream& os, const std::string& config, Indent const& indent)
|
2007-06-29 00:11:18 +04:00
|
|
|
{
|
2009-07-03 16:40:28 +04:00
|
|
|
// Compute the build tree directory from which to copy the target.
|
|
|
|
std::string fromDirConfig;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->Target->NeedRelinkBeforeInstall(config)) {
|
2015-07-28 20:58:52 +03:00
|
|
|
fromDirConfig =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->Target->GetLocalGenerator()->GetCurrentBinaryDirectory();
|
2009-07-03 16:40:28 +04:00
|
|
|
fromDirConfig += cmake::GetCMakeFilesDirectory();
|
|
|
|
fromDirConfig += "/CMakeRelink.dir/";
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
|
|
|
fromDirConfig = this->Target->GetDirectory(config, this->ImportLibrary);
|
2009-07-03 16:40:28 +04:00
|
|
|
fromDirConfig += "/";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-02-11 19:48:02 +03:00
|
|
|
std::string toDir =
|
2015-02-11 22:02:45 +03:00
|
|
|
this->ConvertToAbsoluteDestination(this->GetDestination(config));
|
2009-10-21 21:10:51 +04:00
|
|
|
toDir += "/";
|
2007-07-02 19:31:10 +04:00
|
|
|
|
2007-06-29 00:11:18 +04:00
|
|
|
// Compute the list of files to install for this target.
|
2009-10-21 21:10:51 +04:00
|
|
|
std::vector<std::string> filesFrom;
|
|
|
|
std::vector<std::string> filesTo;
|
2007-06-29 00:11:18 +04:00
|
|
|
std::string literal_args;
|
2015-10-15 00:44:21 +03:00
|
|
|
cmState::TargetType targetType = this->Target->GetType();
|
2012-02-27 20:26:38 +04:00
|
|
|
cmInstallType type = cmInstallType();
|
2016-05-16 17:34:04 +03:00
|
|
|
switch (targetType) {
|
|
|
|
case cmState::EXECUTABLE:
|
|
|
|
type = cmInstallType_EXECUTABLE;
|
|
|
|
break;
|
|
|
|
case cmState::STATIC_LIBRARY:
|
|
|
|
type = cmInstallType_STATIC_LIBRARY;
|
|
|
|
break;
|
|
|
|
case cmState::SHARED_LIBRARY:
|
|
|
|
type = cmInstallType_SHARED_LIBRARY;
|
|
|
|
break;
|
|
|
|
case cmState::MODULE_LIBRARY:
|
|
|
|
type = cmInstallType_MODULE_LIBRARY;
|
|
|
|
break;
|
2015-10-08 01:21:51 +03:00
|
|
|
case cmState::INTERFACE_LIBRARY:
|
2012-11-02 18:47:40 +04:00
|
|
|
// Not reachable. We never create a cmInstallTargetGenerator for
|
|
|
|
// an INTERFACE_LIBRARY.
|
2014-12-12 20:21:54 +03:00
|
|
|
assert(0 && "INTERFACE_LIBRARY targets have no installable outputs.");
|
2012-11-02 18:47:40 +04:00
|
|
|
break;
|
2015-10-08 01:21:51 +03:00
|
|
|
case cmState::OBJECT_LIBRARY:
|
|
|
|
case cmState::UTILITY:
|
|
|
|
case cmState::GLOBAL_TARGET:
|
|
|
|
case cmState::UNKNOWN_LIBRARY:
|
2016-05-16 17:34:04 +03:00
|
|
|
this->Target->GetLocalGenerator()->IssueMessage(
|
|
|
|
cmake::INTERNAL_ERROR,
|
2012-02-27 20:26:38 +04:00
|
|
|
"cmInstallTargetGenerator created with non-installable target.");
|
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (targetType == cmState::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;
|
2015-08-04 20:19:44 +03:00
|
|
|
this->Target->GetExecutableNames(targetName, targetNameReal,
|
2016-05-16 17:34:04 +03:00
|
|
|
targetNameImport, targetNamePDB, config);
|
|
|
|
if (this->ImportLibrary) {
|
2009-10-21 21:10:51 +04:00
|
|
|
std::string from1 = fromDirConfig + targetNameImport;
|
|
|
|
std::string to1 = toDir + targetNameImport;
|
|
|
|
filesFrom.push_back(from1);
|
|
|
|
filesTo.push_back(to1);
|
2011-12-06 01:39:07 +04:00
|
|
|
std::string targetNameImportLib;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->Target->GetImplibGNUtoMS(targetNameImport,
|
|
|
|
targetNameImportLib)) {
|
2011-12-06 01:39:07 +04:00
|
|
|
filesFrom.push_back(fromDirConfig + targetNameImportLib);
|
|
|
|
filesTo.push_back(toDir + targetNameImportLib);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-06-29 00:11:18 +04:00
|
|
|
|
|
|
|
// An import library looks like a static library.
|
2012-02-27 20:26:38 +04:00
|
|
|
type = cmInstallType_STATIC_LIBRARY;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2009-10-21 21:10:51 +04:00
|
|
|
std::string from1 = fromDirConfig + targetName;
|
|
|
|
std::string to1 = toDir + targetName;
|
2006-02-19 23:25:27 +03:00
|
|
|
|
|
|
|
// Handle OSX Bundles.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->Target->IsAppBundleOnApple()) {
|
2015-12-10 22:43:33 +03:00
|
|
|
cmMakefile const* mf = this->Target->Target->GetMakefile();
|
|
|
|
|
2009-10-21 21:10:51 +04:00
|
|
|
// Install the whole app bundle directory.
|
2012-02-27 20:26:38 +04:00
|
|
|
type = cmInstallType_DIRECTORY;
|
2006-08-22 00:55:03 +04:00
|
|
|
literal_args += " USE_SOURCE_PERMISSIONS";
|
2009-10-21 21:10:51 +04:00
|
|
|
from1 += ".app";
|
|
|
|
|
|
|
|
// Tweaks apply to the binary inside the bundle.
|
2015-12-10 22:43:33 +03:00
|
|
|
to1 += ".app/";
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!mf->PlatformIsAppleIos()) {
|
2015-12-10 22:43:33 +03:00
|
|
|
to1 += "Contents/MacOS/";
|
2007-06-29 00:11:18 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
to1 += targetName;
|
|
|
|
} else {
|
2009-10-21 21:10:51 +04:00
|
|
|
// Tweaks apply to the real file, so list it first.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (targetNameReal != targetName) {
|
2009-10-21 21:10:51 +04:00
|
|
|
std::string from2 = fromDirConfig + targetNameReal;
|
|
|
|
std::string to2 = toDir += targetNameReal;
|
|
|
|
filesFrom.push_back(from2);
|
|
|
|
filesTo.push_back(to2);
|
2006-02-19 23:25:27 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-10-21 21:10:51 +04:00
|
|
|
|
|
|
|
filesFrom.push_back(from1);
|
|
|
|
filesTo.push_back(to1);
|
2006-02-19 23:25:27 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2007-06-29 00:11:18 +04:00
|
|
|
std::string targetName;
|
|
|
|
std::string targetNameSO;
|
|
|
|
std::string targetNameReal;
|
|
|
|
std::string targetNameImport;
|
|
|
|
std::string targetNamePDB;
|
2016-05-16 17:34:04 +03:00
|
|
|
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);
|
|
|
|
|
2009-10-21 21:10:51 +04:00
|
|
|
std::string from1 = fromDirConfig + targetNameImport;
|
|
|
|
std::string to1 = toDir + targetNameImport;
|
|
|
|
filesFrom.push_back(from1);
|
|
|
|
filesTo.push_back(to1);
|
2011-12-06 01:39:07 +04:00
|
|
|
std::string targetNameImportLib;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->Target->GetImplibGNUtoMS(targetNameImport,
|
|
|
|
targetNameImportLib)) {
|
2011-12-06 01:39:07 +04:00
|
|
|
filesFrom.push_back(fromDirConfig + targetNameImportLib);
|
|
|
|
filesTo.push_back(toDir + targetNameImportLib);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-06-29 00:11:18 +04:00
|
|
|
|
|
|
|
// An import library looks like a static library.
|
2012-02-27 20:26:38 +04:00
|
|
|
type = cmInstallType_STATIC_LIBRARY;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (this->Target->IsFrameworkOnApple()) {
|
2008-02-05 01:03:48 +03:00
|
|
|
// There is a bug in cmInstallCommand if this fails.
|
|
|
|
assert(this->NamelinkMode == NamelinkModeNone);
|
|
|
|
|
2009-10-21 21:10:51 +04:00
|
|
|
// Install the whole framework directory.
|
2012-02-27 20:26:38 +04:00
|
|
|
type = cmInstallType_DIRECTORY;
|
2009-10-21 21:10:51 +04:00
|
|
|
literal_args += " USE_SOURCE_PERMISSIONS";
|
2013-05-06 06:19:05 +04:00
|
|
|
|
|
|
|
std::string from1 = fromDirConfig + targetName;
|
|
|
|
from1 = cmSystemTools::GetFilenamePath(from1);
|
2007-08-24 21:30:41 +04:00
|
|
|
|
2009-10-21 21:10:51 +04:00
|
|
|
// Tweaks apply to the binary inside the bundle.
|
2013-05-06 06:19:05 +04:00
|
|
|
std::string to1 = toDir + targetNameReal;
|
2007-08-24 21:30:41 +04:00
|
|
|
|
2009-10-21 21:10:51 +04:00
|
|
|
filesFrom.push_back(from1);
|
2014-07-09 22:01:11 +04:00
|
|
|
filesTo.push_back(to1);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (this->Target->IsCFBundleOnApple()) {
|
2014-07-09 22:01:11 +04:00
|
|
|
// Install the whole app bundle directory.
|
|
|
|
type = cmInstallType_DIRECTORY;
|
|
|
|
literal_args += " USE_SOURCE_PERMISSIONS";
|
|
|
|
|
|
|
|
std::string targetNameBase = targetName.substr(0, targetName.find('/'));
|
|
|
|
|
|
|
|
std::string from1 = fromDirConfig + targetNameBase;
|
|
|
|
std::string to1 = toDir + targetName;
|
|
|
|
|
2009-10-21 21:10:51 +04:00
|
|
|
filesFrom.push_back(from1);
|
|
|
|
filesTo.push_back(to1);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2008-02-05 01:03:48 +03:00
|
|
|
bool haveNamelink = false;
|
2009-10-21 21:10:51 +04:00
|
|
|
|
|
|
|
// Library link name.
|
|
|
|
std::string fromName = fromDirConfig + targetName;
|
|
|
|
std::string toName = toDir + targetName;
|
|
|
|
|
|
|
|
// Library interface name.
|
2008-02-05 01:03:48 +03:00
|
|
|
std::string fromSOName;
|
2009-10-21 21:10:51 +04:00
|
|
|
std::string toSOName;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (targetNameSO != targetName) {
|
2008-02-05 01:03:48 +03:00
|
|
|
haveNamelink = true;
|
2009-10-21 21:10:51 +04:00
|
|
|
fromSOName = fromDirConfig + targetNameSO;
|
|
|
|
toSOName = toDir + targetNameSO;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-10-21 21:10:51 +04:00
|
|
|
|
|
|
|
// Library implementation name.
|
|
|
|
std::string fromRealName;
|
|
|
|
std::string toRealName;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (targetNameReal != targetName && targetNameReal != targetNameSO) {
|
2008-02-05 01:03:48 +03:00
|
|
|
haveNamelink = true;
|
2009-10-21 21:10:51 +04:00
|
|
|
fromRealName = fromDirConfig + targetNameReal;
|
|
|
|
toRealName = toDir + targetNameReal;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2008-02-05 01:03:48 +03:00
|
|
|
|
|
|
|
// Add the names based on the current namelink mode.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (haveNamelink) {
|
2008-02-05 01:03:48 +03:00
|
|
|
// With a namelink we need to check the mode.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->NamelinkMode == NamelinkModeOnly) {
|
2008-02-05 01:03:48 +03:00
|
|
|
// Install the namelink only.
|
2009-10-21 21:10:51 +04:00
|
|
|
filesFrom.push_back(fromName);
|
|
|
|
filesTo.push_back(toName);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2008-02-05 01:03:48 +03:00
|
|
|
// Install the real file if it has its own name.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!fromRealName.empty()) {
|
2009-10-21 21:10:51 +04:00
|
|
|
filesFrom.push_back(fromRealName);
|
|
|
|
filesTo.push_back(toRealName);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2008-02-05 01:03:48 +03:00
|
|
|
|
|
|
|
// Install the soname link if it has its own name.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!fromSOName.empty()) {
|
2009-10-21 21:10:51 +04:00
|
|
|
filesFrom.push_back(fromSOName);
|
|
|
|
filesTo.push_back(toSOName);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2008-02-05 01:03:48 +03:00
|
|
|
|
|
|
|
// Install the namelink if it is not to be skipped.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->NamelinkMode != NamelinkModeSkip) {
|
2009-10-21 21:10:51 +04:00
|
|
|
filesFrom.push_back(fromName);
|
|
|
|
filesTo.push_back(toName);
|
2008-02-05 01:03:48 +03:00
|
|
|
}
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2008-02-05 01:03:48 +03:00
|
|
|
// Without a namelink there will be only one file. Install it
|
|
|
|
// if this is not a namelink-only rule.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->NamelinkMode != NamelinkModeOnly) {
|
2009-10-21 21:10:51 +04:00
|
|
|
filesFrom.push_back(fromName);
|
|
|
|
filesTo.push_back(toName);
|
2007-06-29 00:11:18 +04:00
|
|
|
}
|
|
|
|
}
|
2006-02-20 00:10:23 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2006-02-20 00:10:23 +03:00
|
|
|
|
2009-10-21 21:10:51 +04:00
|
|
|
// If this fails the above code is buggy.
|
|
|
|
assert(filesFrom.size() == filesTo.size());
|
|
|
|
|
2008-02-05 01:03:48 +03:00
|
|
|
// Skip this rule if no files are to be installed for the target.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (filesFrom.empty()) {
|
2008-02-05 01:03:48 +03:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2008-02-05 01:03:48 +03:00
|
|
|
|
2008-04-14 23:02:44 +04:00
|
|
|
// Add pre-installation tweaks.
|
2009-10-21 21:11:42 +04:00
|
|
|
this->AddTweak(os, indent, config, filesTo,
|
|
|
|
&cmInstallTargetGenerator::PreReplacementTweaks);
|
2008-04-14 23:02:44 +04:00
|
|
|
|
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
|
|
|
bool optional = this->Optional || this->ImportLibrary;
|
2016-05-16 17:34:04 +03:00
|
|
|
this->AddInstallRule(os, this->GetDestination(config), type, filesFrom,
|
|
|
|
optional, this->FilePermissions.c_str(),
|
|
|
|
no_dir_permissions, no_rename, literal_args.c_str(),
|
2007-07-02 19:02:52 +04:00
|
|
|
indent);
|
2006-02-24 21:13:14 +03:00
|
|
|
|
2008-04-14 23:02:44 +04:00
|
|
|
// Add post-installation tweaks.
|
2009-10-21 21:11:42 +04:00
|
|
|
this->AddTweak(os, indent, config, filesTo,
|
|
|
|
&cmInstallTargetGenerator::PostReplacementTweaks);
|
2006-02-19 23:25:27 +03:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string cmInstallTargetGenerator::GetDestination(
|
|
|
|
std::string const& config) const
|
2015-02-11 22:02:45 +03:00
|
|
|
{
|
|
|
|
cmGeneratorExpression ge;
|
|
|
|
return ge.Parse(this->Destination)
|
2015-07-25 17:56:52 +03:00
|
|
|
->Evaluate(this->Target->GetLocalGenerator(), config);
|
2015-02-11 22:02:45 +03:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string cmInstallTargetGenerator::GetInstallFilename(
|
|
|
|
const std::string& config) const
|
2007-06-19 19:11:06 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
NameType nameType = this->ImportLibrary ? NameImplib : NameNormal;
|
|
|
|
return cmInstallTargetGenerator::GetInstallFilename(this->Target, config,
|
|
|
|
nameType);
|
2007-06-19 19:11:06 +04:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string cmInstallTargetGenerator::GetInstallFilename(
|
|
|
|
cmGeneratorTarget const* target, const std::string& config,
|
|
|
|
NameType nameType)
|
2007-06-15 22:27:33 +04:00
|
|
|
{
|
|
|
|
std::string fname;
|
|
|
|
// Compute the name of the library.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (target->GetType() == cmState::EXECUTABLE) {
|
2007-06-15 22:27:33 +04:00
|
|
|
std::string targetName;
|
|
|
|
std::string targetNameReal;
|
|
|
|
std::string targetNameImport;
|
|
|
|
std::string targetNamePDB;
|
2016-05-16 17:34:04 +03:00
|
|
|
target->GetExecutableNames(targetName, targetNameReal, targetNameImport,
|
|
|
|
targetNamePDB, config);
|
|
|
|
if (nameType == NameImplib) {
|
2007-06-15 22:27:33 +04:00
|
|
|
// Use the import library name.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!target->GetImplibGNUtoMS(targetNameImport, fname,
|
|
|
|
"${CMAKE_IMPORT_LIBRARY_SUFFIX}")) {
|
2011-12-06 01:39:07 +04:00
|
|
|
fname = targetNameImport;
|
2007-06-15 22:27:33 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (nameType == NameReal) {
|
2008-02-06 22:20:36 +03:00
|
|
|
// Use the canonical name.
|
|
|
|
fname = targetNameReal;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2007-06-15 22:27:33 +04:00
|
|
|
// Use the canonical name.
|
|
|
|
fname = targetName;
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2007-06-15 22:27:33 +04:00
|
|
|
std::string targetName;
|
|
|
|
std::string targetNameSO;
|
|
|
|
std::string targetNameReal;
|
|
|
|
std::string targetNameImport;
|
|
|
|
std::string targetNamePDB;
|
2015-10-17 15:54:15 +03:00
|
|
|
target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
|
2007-06-15 22:27:33 +04:00
|
|
|
targetNameImport, targetNamePDB, config);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (nameType == NameImplib) {
|
2007-06-15 22:27:33 +04:00
|
|
|
// Use the import library name.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!target->GetImplibGNUtoMS(targetNameImport, fname,
|
|
|
|
"${CMAKE_IMPORT_LIBRARY_SUFFIX}")) {
|
2011-12-06 01:39:07 +04:00
|
|
|
fname = targetNameImport;
|
2007-06-15 22:27:33 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (nameType == NameSO) {
|
2007-06-15 22:27:33 +04:00
|
|
|
// Use the soname.
|
|
|
|
fname = targetNameSO;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (nameType == NameReal) {
|
2008-02-06 22:20:36 +03:00
|
|
|
// Use the real name.
|
|
|
|
fname = targetNameReal;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2007-06-15 22:27:33 +04:00
|
|
|
// Use the canonical name.
|
|
|
|
fname = targetName;
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-06-15 22:27:33 +04:00
|
|
|
|
|
|
|
return fname;
|
|
|
|
}
|
|
|
|
|
2015-07-28 20:32:03 +03:00
|
|
|
void cmInstallTargetGenerator::Compute(cmLocalGenerator* lg)
|
|
|
|
{
|
2016-04-01 17:26:08 +03:00
|
|
|
this->Target = lg->FindLocalNonAliasGeneratorTarget(this->TargetName);
|
2015-07-28 20:32:03 +03:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent const& indent,
|
|
|
|
const std::string& config,
|
|
|
|
std::string const& file,
|
|
|
|
TweakMethod tweak)
|
2009-10-21 21:11:42 +04:00
|
|
|
{
|
2015-01-05 22:31:31 +03:00
|
|
|
std::ostringstream tw;
|
2009-10-21 21:11:42 +04:00
|
|
|
(this->*tweak)(tw, indent.Next(), config, file);
|
|
|
|
std::string tws = tw.str();
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!tws.empty()) {
|
2013-08-22 13:30:19 +04:00
|
|
|
os << indent << "if(EXISTS \"" << file << "\" AND\n"
|
2009-10-21 21:11:42 +04:00
|
|
|
<< indent << " NOT IS_SYMLINK \"" << file << "\")\n";
|
|
|
|
os << tws;
|
2013-08-22 13:30:19 +04:00
|
|
|
os << indent << "endif()\n";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-10-21 21:11:42 +04:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent const& indent,
|
|
|
|
const std::string& config,
|
|
|
|
std::vector<std::string> const& files,
|
|
|
|
TweakMethod tweak)
|
2009-10-21 21:11:42 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (files.size() == 1) {
|
2009-10-21 21:11:42 +04:00
|
|
|
// Tweak a single file.
|
|
|
|
this->AddTweak(os, indent, config, this->GetDestDirPath(files[0]), tweak);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2009-10-21 21:11:42 +04:00
|
|
|
// Generate a foreach loop to tweak multiple files.
|
2015-01-05 22:31:31 +03:00
|
|
|
std::ostringstream tw;
|
2009-10-21 21:11:42 +04:00
|
|
|
this->AddTweak(tw, indent.Next(), config, "${file}", tweak);
|
|
|
|
std::string tws = tw.str();
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!tws.empty()) {
|
2009-10-21 21:11:42 +04:00
|
|
|
Indent indent2 = indent.Next().Next();
|
2013-08-22 13:30:19 +04:00
|
|
|
os << indent << "foreach(file\n";
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator i = files.begin();
|
|
|
|
i != files.end(); ++i) {
|
2009-10-21 21:11:42 +04:00
|
|
|
os << indent2 << "\"" << this->GetDestDirPath(*i) << "\"\n";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-10-21 21:11:42 +04:00
|
|
|
os << indent2 << ")\n";
|
|
|
|
os << tws;
|
2013-08-22 13:30:19 +04:00
|
|
|
os << indent << "endforeach()\n";
|
2009-10-21 21:11:42 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-10-21 21:11:42 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string cmInstallTargetGenerator::GetDestDirPath(std::string const& file)
|
|
|
|
{
|
|
|
|
// Construct the path of the file on disk after installation on
|
|
|
|
// which tweaks may be performed.
|
|
|
|
std::string toDestDirPath = "$ENV{DESTDIR}";
|
2016-05-16 17:34:04 +03:00
|
|
|
if (file[0] != '/' && file[0] != '$') {
|
2009-10-21 21:11:42 +04:00
|
|
|
toDestDirPath += "/";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-10-21 21:11:42 +04:00
|
|
|
toDestDirPath += file;
|
|
|
|
return toDestDirPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmInstallTargetGenerator::PreReplacementTweaks(std::ostream& os,
|
|
|
|
Indent const& indent,
|
2014-02-10 07:48:34 +04:00
|
|
|
const std::string& config,
|
2009-10-21 21:11:42 +04:00
|
|
|
std::string const& file)
|
|
|
|
{
|
|
|
|
this->AddRPathCheckRule(os, indent, config, file);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os,
|
2016-05-16 17:34:04 +03:00
|
|
|
Indent const& indent,
|
|
|
|
const std::string& config,
|
|
|
|
std::string const& file)
|
2009-10-21 21:11:42 +04:00
|
|
|
{
|
|
|
|
this->AddInstallNamePatchRule(os, indent, config, file);
|
|
|
|
this->AddChrpathPatchRule(os, indent, config, file);
|
2015-10-08 03:09:34 +03:00
|
|
|
this->AddUniversalInstallRule(os, indent, file);
|
2009-10-21 21:11:42 +04:00
|
|
|
this->AddRanlibRule(os, indent, file);
|
|
|
|
this->AddStripRule(os, indent, file);
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmInstallTargetGenerator::AddInstallNamePatchRule(
|
|
|
|
std::ostream& os, Indent const& indent, const std::string& config,
|
|
|
|
std::string const& toDestDirPath)
|
2006-02-19 23:25:27 +03:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->ImportLibrary ||
|
|
|
|
!(this->Target->GetType() == cmState::SHARED_LIBRARY ||
|
|
|
|
this->Target->GetType() == cmState::MODULE_LIBRARY ||
|
|
|
|
this->Target->GetType() == cmState::EXECUTABLE)) {
|
2007-06-29 00:11:18 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +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.
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string installNameTool =
|
|
|
|
this->Target->Target->GetMakefile()->GetSafeDefinition(
|
|
|
|
"CMAKE_INSTALL_NAME_TOOL");
|
2007-08-24 21:30:41 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (installNameTool.empty()) {
|
2007-05-18 01:21:52 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-05-18 01:21:52 +04:00
|
|
|
|
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.
|
2014-02-10 09:21:34 +04:00
|
|
|
std::map<std::string, std::string> install_name_remap;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (cmComputeLinkInformation* cli =
|
|
|
|
this->Target->GetLinkInformation(config)) {
|
|
|
|
std::set<cmGeneratorTarget const*> const& sharedLibs =
|
|
|
|
cli->GetSharedLibrariesLinked();
|
|
|
|
for (std::set<cmGeneratorTarget const*>::const_iterator j =
|
|
|
|
sharedLibs.begin();
|
|
|
|
j != sharedLibs.end(); ++j) {
|
2015-10-08 01:51:05 +03:00
|
|
|
cmGeneratorTarget const* tgt = *j;
|
2008-11-26 00:50:48 +03:00
|
|
|
|
|
|
|
// The install_name of an imported target does not change.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (tgt->IsImported()) {
|
2008-11-26 00:50:48 +03:00
|
|
|
continue;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2008-11-26 00:50:48 +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.
|
2015-10-08 01:51:05 +03:00
|
|
|
std::string for_build = tgt->GetInstallNameDirForBuildTree(config);
|
|
|
|
std::string for_install = tgt->GetInstallNameDirForInstallTree();
|
2016-05-16 17:34:04 +03:00
|
|
|
if (for_build != for_install) {
|
2008-02-01 21:08:12 +03:00
|
|
|
// The directory portions differ. Append the filename to
|
|
|
|
// create the mapping.
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string fname = 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
|
|
|
}
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2006-02-24 21:13:14 +03:00
|
|
|
|
|
|
|
// Edit the install_name of the target itself if necessary.
|
|
|
|
std::string new_id;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->Target->GetType() == cmState::SHARED_LIBRARY) {
|
2008-02-01 21:08:12 +03:00
|
|
|
std::string for_build =
|
2015-08-04 20:19:47 +03:00
|
|
|
this->Target->GetInstallNameDirForBuildTree(config);
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string for_install = this->Target->GetInstallNameDirForInstallTree();
|
2008-02-01 21:08:12 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->Target->IsFrameworkOnApple() && for_install.empty()) {
|
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;
|
2016-05-16 17:34:04 +03: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.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (for_build != for_install) {
|
2006-02-24 21:13:14 +03:00
|
|
|
// Prepare to refer to the install-tree install_name.
|
|
|
|
new_id = for_install;
|
2015-10-17 15:54:15 +03:00
|
|
|
new_id += this->GetInstallFilename(this->Target, config, NameSO);
|
2006-02-24 21:13:14 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!new_id.empty() || !install_name_remap.empty()) {
|
2013-08-22 13:30:19 +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 << "\"";
|
2016-05-16 17:34:04 +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
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::map<std::string, std::string>::const_iterator i =
|
|
|
|
install_name_remap.begin();
|
|
|
|
i != install_name_remap.end(); ++i) {
|
|
|
|
os << "\n"
|
|
|
|
<< indent << " -change \"" << i->first << "\" \"" << i->second
|
|
|
|
<< "\"";
|
|
|
|
}
|
|
|
|
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
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmInstallTargetGenerator::AddRPathCheckRule(
|
|
|
|
std::ostream& os, Indent const& indent, const std::string& config,
|
|
|
|
std::string const& toDestDirPath)
|
2008-04-14 23:02:44 +04:00
|
|
|
{
|
|
|
|
// Skip the chrpath if the target does not need it.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->ImportLibrary || !this->Target->IsChrpathUsed(config)) {
|
2008-04-14 23:02:44 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2013-04-27 08:04:44 +04:00
|
|
|
// Skip if on Apple
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->Target->Target->GetMakefile()->IsOn(
|
|
|
|
"CMAKE_PLATFORM_HAS_INSTALLNAME")) {
|
2013-04-27 08:04:44 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2013-04-27 08:04:44 +04:00
|
|
|
|
2008-04-14 23:02:44 +04:00
|
|
|
// Get the link information for this target.
|
|
|
|
// It can provide the RPATH.
|
2015-08-04 20:19:42 +03:00
|
|
|
cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!cli) {
|
2008-04-14 23:02:44 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2008-04-14 23:02:44 +04:00
|
|
|
|
|
|
|
// 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.
|
2016-05-06 21:19:04 +03:00
|
|
|
/* clang-format off */
|
2013-08-22 13:30:19 +04:00
|
|
|
os << indent << "file(RPATH_CHECK\n"
|
2008-04-14 23:02:44 +04:00
|
|
|
<< indent << " FILE \"" << toDestDirPath << "\"\n"
|
|
|
|
<< indent << " RPATH \"" << newRpath << "\")\n";
|
2016-05-06 21:19:04 +03:00
|
|
|
/* clang-format on */
|
2008-04-14 23:02:44 +04:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmInstallTargetGenerator::AddChrpathPatchRule(
|
|
|
|
std::ostream& os, Indent const& indent, const std::string& 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.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->ImportLibrary || !this->Target->IsChrpathUsed(config)) {
|
2007-12-19 01:50:27 +03:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-12-19 01:50:27 +03:00
|
|
|
|
2008-01-29 23:07:33 +03:00
|
|
|
// Get the link information for this target.
|
|
|
|
// It can provide the RPATH.
|
2015-08-04 20:19:42 +03:00
|
|
|
cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!cli) {
|
2007-12-19 01:50:27 +03:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-12-19 01:50:27 +03:00
|
|
|
|
2015-07-28 20:58:52 +03:00
|
|
|
cmMakefile* mf = this->Target->Target->GetMakefile();
|
2014-10-07 08:24:10 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) {
|
2013-04-27 08:04:44 +04:00
|
|
|
// If using install_name_tool, set up the rules to modify the rpaths.
|
|
|
|
std::string installNameTool =
|
2014-10-07 08:24:10 +04:00
|
|
|
mf->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL");
|
2013-04-27 08:04:44 +04:00
|
|
|
|
|
|
|
std::vector<std::string> oldRuntimeDirs, newRuntimeDirs;
|
|
|
|
cli->GetRPath(oldRuntimeDirs, false);
|
|
|
|
cli->GetRPath(newRuntimeDirs, true);
|
|
|
|
|
2014-10-07 08:24:10 +04:00
|
|
|
std::string darwin_major_version_s =
|
|
|
|
mf->GetSafeDefinition("DARWIN_MAJOR_VERSION");
|
2014-02-02 08:18:04 +04:00
|
|
|
|
2014-10-07 08:24:10 +04:00
|
|
|
std::stringstream ss(darwin_major_version_s);
|
|
|
|
int darwin_major_version;
|
|
|
|
ss >> darwin_major_version;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!ss.fail() && darwin_major_version <= 9 &&
|
|
|
|
(!oldRuntimeDirs.empty() || !newRuntimeDirs.empty())) {
|
2015-01-05 22:31:31 +03:00
|
|
|
std::ostringstream msg;
|
2016-05-16 17:34:04 +03:00
|
|
|
msg
|
|
|
|
<< "WARNING: Target \"" << this->Target->GetName()
|
2014-10-07 08:24:10 +04:00
|
|
|
<< "\" has runtime paths which cannot be changed during install. "
|
|
|
|
<< "To change runtime paths, OS X version 10.6 or newer is required. "
|
|
|
|
<< "Therefore, runtime paths will not be changed when installing. "
|
|
|
|
<< "CMAKE_BUILD_WITH_INSTALL_RPATH may be used to work around"
|
|
|
|
" this limitation.";
|
|
|
|
mf->IssueMessage(cmake::WARNING, msg.str());
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2014-10-07 08:24:10 +04:00
|
|
|
// Note: These paths are kept unique to avoid
|
|
|
|
// install_name_tool corruption.
|
|
|
|
std::set<std::string> runpaths;
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator i = oldRuntimeDirs.begin();
|
|
|
|
i != oldRuntimeDirs.end(); ++i) {
|
2014-10-07 08:24:10 +04:00
|
|
|
std::string runpath =
|
2015-05-03 12:10:30 +03:00
|
|
|
mf->GetGlobalGenerator()->ExpandCFGIntDir(*i, config);
|
2014-10-07 08:24:10 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (runpaths.find(runpath) == runpaths.end()) {
|
2014-10-07 08:24:10 +04:00
|
|
|
runpaths.insert(runpath);
|
2016-05-16 17:34:04 +03:00
|
|
|
os << indent << "execute_process(COMMAND " << installNameTool
|
|
|
|
<< "\n";
|
2014-10-07 08:24:10 +04:00
|
|
|
os << indent << " -delete_rpath \"" << runpath << "\"\n";
|
|
|
|
os << indent << " \"" << toDestDirPath << "\")\n";
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-02-02 08:18:04 +04:00
|
|
|
|
2014-10-07 08:24:10 +04:00
|
|
|
runpaths.clear();
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator i = newRuntimeDirs.begin();
|
|
|
|
i != newRuntimeDirs.end(); ++i) {
|
2014-10-07 08:24:10 +04:00
|
|
|
std::string runpath =
|
2015-05-03 12:10:30 +03:00
|
|
|
mf->GetGlobalGenerator()->ExpandCFGIntDir(*i, config);
|
2014-10-07 08:24:10 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (runpaths.find(runpath) == runpaths.end()) {
|
|
|
|
os << indent << "execute_process(COMMAND " << installNameTool
|
|
|
|
<< "\n";
|
2014-10-07 08:24:10 +04:00
|
|
|
os << indent << " -add_rpath \"" << runpath << "\"\n";
|
|
|
|
os << indent << " \"" << toDestDirPath << "\")\n";
|
2014-02-02 08:18:04 +04:00
|
|
|
}
|
2013-04-27 08:04:44 +04:00
|
|
|
}
|
2008-04-14 23:02:44 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2013-04-27 08:04:44 +04:00
|
|
|
// Construct the original rpath string to be replaced.
|
|
|
|
std::string oldRpath = cli->GetRPathString(false);
|
|
|
|
|
|
|
|
// Get the install RPATH from the link information.
|
|
|
|
std::string newRpath = cli->GetChrpathString();
|
|
|
|
|
|
|
|
// Skip the rule if the paths are identical
|
2016-05-16 17:34:04 +03:00
|
|
|
if (oldRpath == newRpath) {
|
2013-04-27 08:04:44 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2013-04-27 08:04:44 +04:00
|
|
|
|
|
|
|
// Write a rule to run chrpath to set the install-tree RPATH
|
2015-12-25 16:08:51 +03:00
|
|
|
os << indent << "file(RPATH_CHANGE\n"
|
|
|
|
<< indent << " FILE \"" << toDestDirPath << "\"\n"
|
|
|
|
<< indent << " OLD_RPATH \"" << oldRpath << "\"\n"
|
|
|
|
<< indent << " NEW_RPATH \"" << newRpath << "\")\n";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-12-19 01:50:27 +03:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmInstallTargetGenerator::AddStripRule(std::ostream& os,
|
|
|
|
Indent const& indent,
|
|
|
|
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
|
|
|
{
|
|
|
|
|
2013-06-28 23:06:57 +04:00
|
|
|
// don't strip static and import libraries, because it removes the only
|
|
|
|
// symbol table they have so you can't link to them anymore
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->Target->GetType() == cmState::STATIC_LIBRARY ||
|
|
|
|
this->ImportLibrary) {
|
2007-06-15 21:00:54 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-06-15 21:00:54 +04: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
|
|
|
// Don't handle OSX Bundles.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->Target->Target->GetMakefile()->IsOn("APPLE") &&
|
|
|
|
this->Target->GetPropertyAsBool("MACOSX_BUNDLE")) {
|
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;
|
2016-05-16 17:34:04 +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
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!this->Target->Target->GetMakefile()->IsSet("CMAKE_STRIP")) {
|
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;
|
2016-05-16 17:34:04 +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
|
|
|
|
2013-08-22 13:30:19 +04:00
|
|
|
os << indent << "if(CMAKE_INSTALL_DO_STRIP)\n";
|
|
|
|
os << indent << " execute_process(COMMAND \""
|
2015-07-28 20:58:52 +03:00
|
|
|
<< this->Target->Target->GetMakefile()->GetDefinition("CMAKE_STRIP")
|
2007-08-24 21:30:41 +04:00
|
|
|
<< "\" \"" << toDestDirPath << "\")\n";
|
2013-08-22 13:30:19 +04:00
|
|
|
os << indent << "endif()\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
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os,
|
|
|
|
Indent const& indent,
|
|
|
|
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.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->Target->GetType() != cmState::STATIC_LIBRARY) {
|
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;
|
2016-05-16 17:34:04 +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
|
|
|
|
|
|
|
// Perform post-installation processing on the file depending
|
|
|
|
// on its type.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!this->Target->Target->GetMakefile()->IsOn("APPLE")) {
|
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;
|
2016-05-16 17:34:04 +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
|
|
|
|
2007-06-29 00:11:18 +04:00
|
|
|
std::string ranlib =
|
2015-07-28 20:58:52 +03:00
|
|
|
this->Target->Target->GetMakefile()->GetRequiredDefinition("CMAKE_RANLIB");
|
2016-05-16 17:34:04 +03:00
|
|
|
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;
|
2016-05-16 17:34:04 +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
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
os << indent << "execute_process(COMMAND \"" << 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
|
|
|
}
|
2015-10-08 03:09:34 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmInstallTargetGenerator::AddUniversalInstallRule(
|
|
|
|
std::ostream& os, Indent const& indent, const std::string& toDestDirPath)
|
2015-10-08 03:09:34 +03:00
|
|
|
{
|
|
|
|
cmMakefile const* mf = this->Target->Target->GetMakefile();
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!mf->PlatformIsAppleIos() || !mf->IsOn("XCODE")) {
|
2015-10-08 03:09:34 +03:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-10-08 03:09:34 +03:00
|
|
|
|
|
|
|
const char* xcodeVersion = mf->GetDefinition("XCODE_VERSION");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!xcodeVersion ||
|
|
|
|
cmSystemTools::VersionCompareGreater("6", xcodeVersion)) {
|
2015-10-08 03:09:34 +03:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-10-08 03:09:34 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
switch (this->Target->GetType()) {
|
2015-10-08 03:09:34 +03:00
|
|
|
case cmState::EXECUTABLE:
|
|
|
|
case cmState::STATIC_LIBRARY:
|
|
|
|
case cmState::SHARED_LIBRARY:
|
|
|
|
case cmState::MODULE_LIBRARY:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-10-08 03:09:34 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!this->Target->Target->GetPropertyAsBool("IOS_INSTALL_COMBINED")) {
|
|
|
|
return;
|
|
|
|
}
|
2015-10-08 03:09:34 +03:00
|
|
|
|
|
|
|
os << indent << "include(CMakeIOSInstallCombined)\n";
|
|
|
|
os << indent << "ios_install_combined("
|
2016-05-16 17:34:04 +03:00
|
|
|
<< "\"" << this->Target->Target->GetName() << "\" "
|
|
|
|
<< "\"" << toDestDirPath << "\")\n";
|
2015-10-08 03:09:34 +03:00
|
|
|
}
|