summaryrefslogtreecommitdiffstats
path: root/Source/cmInstallTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-07-31 13:21:45 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-07-31 13:21:45 (GMT)
commit82e77d74304707255265a564678b38ea372813dd (patch)
tree832e3d61d80bb5e6357cf28b4f52d60a8f352db7 /Source/cmInstallTargetGenerator.cxx
parent6e11703c6c9526724040f72c48e2f18616290080 (diff)
parenta23fcc9558f9f2788fc828f7473060ea1f035f55 (diff)
downloadCMake-82e77d74304707255265a564678b38ea372813dd.zip
CMake-82e77d74304707255265a564678b38ea372813dd.tar.gz
CMake-82e77d74304707255265a564678b38ea372813dd.tar.bz2
Merge topic 'refactor-install'
a23fcc95 cmInstallTargetGenerator: Port to cmGeneratorTarget. 4e41913f cmInstallCommand: Store only a targetName, not a cmTarget. e5e52970 cmInstallGenerator: Add a Compute() virtual hook. 3ef8aaaa cmInstallCommand: Move the SetHaveInstallRule invocation. 5f662b38 cmScriptGenerator: Remove unused method. 0368552d cmGlobalGenerator: Move QtAutogen handling to Compute(). 5edb3354 cmGlobalGenerator: Virtualize the Compute step and override it. ff1019bf cmGlobalGenerator: Move generation object creation to Compute(). aa2407d8 Xcode: Use allBuild target return value. 610572b7 cmMakefile: Simplify generate-time cmGeneratorTarget creation. 2e94cba3 cmGlobalGenerator: Move FinalizeTargetCompileInfo to Compute(). fb9355c5 cmGlobalGenerator: Return from Compute whether to generate. 29e8b7bf cmGlobalGenerator: Create a new Compute step before generation. 1ef9b2b6 cmGlobalGenerator: Remove the TargetManifest member. 5c14f780 cmGlobalGenerator: Remove unused manifest accessor. a1209be5 VisualStudio: Skip global targets when processing. ...
Diffstat (limited to 'Source/cmInstallTargetGenerator.cxx')
-rw-r--r--Source/cmInstallTargetGenerator.cxx89
1 files changed, 53 insertions, 36 deletions
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 5115788..01d4b77 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -16,26 +16,29 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmGeneratorTarget.h"
#include "cmake.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);
}
//----------------------------------------------------------------------------
@@ -69,15 +72,17 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
{
// Compute the build tree directory from which to copy the target.
std::string fromDirConfig;
- if(this->Target->NeedRelinkBeforeInstall(config))
+ if(this->Target->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 +93,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 +111,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;
}
@@ -118,7 +124,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
std::string targetNameReal;
std::string targetNameImport;
std::string targetNamePDB;
- this->Target->GetExecutableNames(targetName, targetNameReal,
+ this->Target->Target->GetExecutableNames(targetName, targetNameReal,
targetNameImport, targetNamePDB,
config);
if(this->ImportLibrary)
@@ -128,7 +134,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 +150,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 +184,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
std::string targetNameReal;
std::string targetNameImport;
std::string targetNamePDB;
- this->Target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
+ this->Target->Target->GetLibraryNames(targetName, targetNameSO,
+ targetNameReal,
targetNameImport, targetNamePDB,
config);
if(this->ImportLibrary)
@@ -191,7 +198,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 +208,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 +226,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 +350,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 +359,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);
}
@@ -431,6 +438,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 +546,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())
{
@@ -544,7 +557,8 @@ cmInstallTargetGenerator
// Build a map of build-tree install_name to install-tree install_name for
// shared libraries linked to this target.
std::map<std::string, std::string> install_name_remap;
- if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config))
+ if(cmComputeLinkInformation* cli =
+ this->Target->Target->GetLinkInformation(config))
{
std::set<cmTarget const*> const& sharedLibs
= cli->GetSharedLibrariesLinked();
@@ -588,11 +602,11 @@ cmInstallTargetGenerator
if(this->Target->GetType() == cmTarget::SHARED_LIBRARY)
{
std::string for_build =
- this->Target->GetInstallNameDirForBuildTree(config);
+ this->Target->Target->GetInstallNameDirForBuildTree(config);
std::string for_install =
- this->Target->GetInstallNameDirForInstallTree();
+ this->Target->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 +620,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);
}
}
@@ -639,20 +653,22 @@ cmInstallTargetGenerator
std::string const& toDestDirPath)
{
// Skip the chrpath if the target does not need it.
- if(this->ImportLibrary || !this->Target->IsChrpathUsed(config))
+ if(this->ImportLibrary || !this->Target->Target->IsChrpathUsed(config))
{
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;
}
// Get the link information for this target.
// It can provide the RPATH.
- cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config);
+ cmComputeLinkInformation* cli =
+ this->Target->Target->GetLinkInformation(config);
if(!cli)
{
return;
@@ -677,20 +693,21 @@ cmInstallTargetGenerator
std::string const& toDestDirPath)
{
// Skip the chrpath if the target does not need it.
- if(this->ImportLibrary || !this->Target->IsChrpathUsed(config))
+ if(this->ImportLibrary || !this->Target->Target->IsChrpathUsed(config))
{
return;
}
// Get the link information for this target.
// It can provide the RPATH.
- cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config);
+ cmComputeLinkInformation* cli =
+ this->Target->Target->GetLinkInformation(config);
if(!cli)
{
return;
}
- cmMakefile* mf = this->Target->GetMakefile();
+ cmMakefile* mf = this->Target->Target->GetMakefile();
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
@@ -802,20 +819,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 +851,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;