summaryrefslogtreecommitdiffstats
path: root/Source/cmInstallTargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmInstallTargetGenerator.cxx')
-rw-r--r--Source/cmInstallTargetGenerator.cxx84
1 files changed, 52 insertions, 32 deletions
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 5115788..30cf175 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -16,26 +16,30 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmGeneratorTarget.h"
#include "cmake.h"
+#include "cmGeneratorTarget.h"
#include <assert.h>
//----------------------------------------------------------------------------
cmInstallTargetGenerator
-::cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib,
+::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 optional):
- cmInstallGenerator(dest, configurations, component, message), Target(&t),
+ cmInstallGenerator(dest, configurations, component, message),
+ TargetName(targetName),
+ Target(0),
FilePermissions(file_permissions),
ImportLibrary(implib),
Optional(optional)
{
this->ActionsPerConfig = true;
this->NamelinkMode = NamelinkModeNone;
- this->Target->SetHaveInstallRule(true);
}
//----------------------------------------------------------------------------
@@ -71,13 +75,15 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
std::string fromDirConfig;
if(this->Target->NeedRelinkBeforeInstall(config))
{
- fromDirConfig = this->Target->GetMakefile()->GetCurrentBinaryDirectory();
+ fromDirConfig =
+ this->Target->Target->GetMakefile()->GetCurrentBinaryDirectory();
fromDirConfig += cmake::GetCMakeFilesDirectory();
fromDirConfig += "/CMakeRelink.dir/";
}
else
{
- fromDirConfig = this->Target->GetDirectory(config, this->ImportLibrary);
+ fromDirConfig =
+ this->Target->Target->GetDirectory(config, this->ImportLibrary);
fromDirConfig += "/";
}
std::string toDir =
@@ -88,7 +94,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
std::vector<std::string> filesFrom;
std::vector<std::string> filesTo;
std::string literal_args;
- cmTarget::TargetType targetType = this->Target->GetType();
+ cmTarget::TargetType targetType =
+ static_cast<cmTarget::TargetType>(this->Target->GetType());
cmInstallType type = cmInstallType();
switch(targetType)
{
@@ -105,7 +112,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
case cmTarget::UTILITY:
case cmTarget::GLOBAL_TARGET:
case cmTarget::UNKNOWN_LIBRARY:
- this->Target->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR,
+ this->Target->Target->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR,
"cmInstallTargetGenerator created with non-installable target.");
return;
}
@@ -128,7 +135,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
filesFrom.push_back(from1);
filesTo.push_back(to1);
std::string targetNameImportLib;
- if(this->Target->GetImplibGNUtoMS(targetNameImport,
+ if(this->Target->Target->GetImplibGNUtoMS(targetNameImport,
targetNameImportLib))
{
filesFrom.push_back(fromDirConfig + targetNameImportLib);
@@ -144,7 +151,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
std::string to1 = toDir + targetName;
// Handle OSX Bundles.
- if(this->Target->IsAppBundleOnApple())
+ if(this->Target->Target->IsAppBundleOnApple())
{
// Install the whole app bundle directory.
type = cmInstallType_DIRECTORY;
@@ -178,7 +185,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
std::string targetNameReal;
std::string targetNameImport;
std::string targetNamePDB;
- this->Target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
+ this->Target->GetLibraryNames(targetName, targetNameSO,
+ targetNameReal,
targetNameImport, targetNamePDB,
config);
if(this->ImportLibrary)
@@ -191,7 +199,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
filesFrom.push_back(from1);
filesTo.push_back(to1);
std::string targetNameImportLib;
- if(this->Target->GetImplibGNUtoMS(targetNameImport,
+ if(this->Target->Target->GetImplibGNUtoMS(targetNameImport,
targetNameImportLib))
{
filesFrom.push_back(fromDirConfig + targetNameImportLib);
@@ -201,7 +209,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
// An import library looks like a static library.
type = cmInstallType_STATIC_LIBRARY;
}
- else if(this->Target->IsFrameworkOnApple())
+ else if(this->Target->Target->IsFrameworkOnApple())
{
// There is a bug in cmInstallCommand if this fails.
assert(this->NamelinkMode == NamelinkModeNone);
@@ -219,7 +227,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
filesFrom.push_back(from1);
filesTo.push_back(to1);
}
- else if(this->Target->IsCFBundleOnApple())
+ else if(this->Target->Target->IsCFBundleOnApple())
{
// Install the whole app bundle directory.
type = cmInstallType_DIRECTORY;
@@ -343,7 +351,7 @@ cmInstallTargetGenerator::GetDestination(std::string const& config) const
{
cmGeneratorExpression ge;
return ge.Parse(this->Destination)
- ->Evaluate(this->Target->GetMakefile(), config);
+ ->Evaluate(this->Target->Target->GetMakefile(), config);
}
//----------------------------------------------------------------------------
@@ -352,7 +360,7 @@ cmInstallTargetGenerator::GetInstallFilename(const std::string& config) const
{
NameType nameType = this->ImportLibrary? NameImplib : NameNormal;
return
- cmInstallTargetGenerator::GetInstallFilename(this->Target, config,
+ cmInstallTargetGenerator::GetInstallFilename(this->Target->Target, config,
nameType);
}
@@ -364,13 +372,16 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
{
std::string fname;
// Compute the name of the library.
+ cmGeneratorTarget *gtgt = target->GetMakefile()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
if(target->GetType() == cmTarget::EXECUTABLE)
{
std::string targetName;
std::string targetNameReal;
std::string targetNameImport;
std::string targetNamePDB;
- target->GetExecutableNames(targetName, targetNameReal,
+ gtgt->GetExecutableNames(targetName, targetNameReal,
targetNameImport, targetNamePDB,
config);
if(nameType == NameImplib)
@@ -400,7 +411,7 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
std::string targetNameReal;
std::string targetNameImport;
std::string targetNamePDB;
- target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
+ gtgt->GetLibraryNames(targetName, targetNameSO, targetNameReal,
targetNameImport, targetNamePDB, config);
if(nameType == NameImplib)
{
@@ -431,6 +442,12 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
return fname;
}
+void cmInstallTargetGenerator::Compute(cmLocalGenerator* lg)
+{
+ this->Target = lg->GetGlobalGenerator()->GetGeneratorTarget(
+ lg->GetMakefile()->FindTarget(this->TargetName));
+}
+
//----------------------------------------------------------------------------
void
cmInstallTargetGenerator
@@ -533,8 +550,8 @@ cmInstallTargetGenerator
}
// Fix the install_name settings in installed binaries.
- std::string installNameTool =
- this->Target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL");
+ std::string installNameTool = this->Target->Target->GetMakefile()
+ ->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL");
if(installNameTool.empty())
{
@@ -559,11 +576,14 @@ cmInstallTargetGenerator
continue;
}
+ cmGeneratorTarget *gtgt = tgt->GetMakefile()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(tgt);
// 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.
- std::string for_build = tgt->GetInstallNameDirForBuildTree(config);
- std::string for_install = tgt->GetInstallNameDirForInstallTree();
+ std::string for_build = gtgt->GetInstallNameDirForBuildTree(config);
+ std::string for_install = gtgt->GetInstallNameDirForInstallTree();
if(for_build != for_install)
{
// The directory portions differ. Append the filename to
@@ -592,7 +612,7 @@ cmInstallTargetGenerator
std::string for_install =
this->Target->GetInstallNameDirForInstallTree();
- if(this->Target->IsFrameworkOnApple() && for_install.empty())
+ if(this->Target->Target->IsFrameworkOnApple() && for_install.empty())
{
// Frameworks seem to have an id corresponding to their own full
// path.
@@ -606,7 +626,7 @@ cmInstallTargetGenerator
{
// Prepare to refer to the install-tree install_name.
new_id = for_install;
- new_id += this->GetInstallFilename(this->Target, config, NameSO);
+ new_id += this->GetInstallFilename(this->Target->Target, config, NameSO);
}
}
@@ -643,9 +663,9 @@ cmInstallTargetGenerator
{
return;
}
-
// Skip if on Apple
- if(this->Target->GetMakefile()->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
+ if(this->Target->Target->GetMakefile()
+ ->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
return;
}
@@ -690,7 +710,7 @@ cmInstallTargetGenerator
return;
}
- cmMakefile* mf = this->Target->GetMakefile();
+ cmMakefile* mf = this->Target->Target->GetMakefile();
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
@@ -802,20 +822,20 @@ cmInstallTargetGenerator::AddStripRule(std::ostream& os,
}
// Don't handle OSX Bundles.
- if(this->Target->GetMakefile()->IsOn("APPLE") &&
- this->Target->GetPropertyAsBool("MACOSX_BUNDLE"))
+ if(this->Target->Target->GetMakefile()->IsOn("APPLE") &&
+ this->Target->Target->GetPropertyAsBool("MACOSX_BUNDLE"))
{
return;
}
- if(! this->Target->GetMakefile()->IsSet("CMAKE_STRIP"))
+ if(! this->Target->Target->GetMakefile()->IsSet("CMAKE_STRIP"))
{
return;
}
os << indent << "if(CMAKE_INSTALL_DO_STRIP)\n";
os << indent << " execute_process(COMMAND \""
- << this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP")
+ << this->Target->Target->GetMakefile()->GetDefinition("CMAKE_STRIP")
<< "\" \"" << toDestDirPath << "\")\n";
os << indent << "endif()\n";
}
@@ -834,13 +854,13 @@ cmInstallTargetGenerator::AddRanlibRule(std::ostream& os,
// Perform post-installation processing on the file depending
// on its type.
- if(!this->Target->GetMakefile()->IsOn("APPLE"))
+ if(!this->Target->Target->GetMakefile()->IsOn("APPLE"))
{
return;
}
std::string ranlib =
- this->Target->GetMakefile()->GetRequiredDefinition("CMAKE_RANLIB");
+ this->Target->Target->GetMakefile()->GetRequiredDefinition("CMAKE_RANLIB");
if(ranlib.empty())
{
return;