Merge topic 'use-generator-target'

a309409e cmOrderDirectories: Port to cmGeneratorTarget.
f83e8402 cmGeneratorTarget: Move CompileInfoMap from cmTarget.
b3f0e353 cmGeneratorTarget: Move GetCompilePDBDirectory from cmTarget.
34c43741 cmGeneratorTarget: Move GetOutputName from cmTarget.
4329a71c cmComputeLinkDepends: Port to cmGeneratorTarget.
c93230ac cmComputeLinkInformation: Port to cmGeneratorTarget.
ee26add4 cmGeneratorTarget: Move IsBundleOnApple from cmTarget.
c8a5f5ae cmMakefileTargetGenerator: Add accessor for GeneratorTarget.
f8076644 cmGeneratorTarget: Move GetLinkClosure from cmTarget.
7c809fa2 cmGeneratorTarget: Move GetLinkerLanguage from cmTarget.
6da99de3 cmGeneratorTarget: Move GetFrameworkDirectory from cmTarget.
d6bb319b cmGeneratorTarget: Move GetFullName from cmTarget.
7a460852 cmGeneratorTarget: Move GetAppBundleDirectory from cmTarget.
d560bfd2 cmGeneratorTarget: Move GetInstallNameDir* from cmTarget.
89e2a080 cmGeneratorTarget: Move GetMacContentDirectory from cmTarget.
62720e44 cmGeneratorTarget: Move GetFullNameComponents from cmTarget.
...
This commit is contained in:
Brad King 2015-08-06 09:38:27 -04:00 committed by CMake Topic Stage
commit 55706506c7
38 changed files with 2463 additions and 2393 deletions

View File

@ -276,7 +276,8 @@ std::string cmCommonTargetGenerator::GetFrameworkFlags(std::string const& l)
std::string flags; std::string flags;
const char* cfg = this->LocalGenerator->GetConfigName().c_str(); const char* cfg = this->LocalGenerator->GetConfigName().c_str();
if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) if(cmComputeLinkInformation* cli =
this->GeneratorTarget->GetLinkInformation(cfg))
{ {
std::vector<std::string> const& frameworks = cli->GetFrameworkPaths(); std::vector<std::string> const& frameworks = cli->GetFrameworkPaths();
for(std::vector<std::string>::const_iterator i = frameworks.begin(); for(std::vector<std::string>::const_iterator i = frameworks.begin();
@ -384,7 +385,7 @@ cmCommonTargetGenerator::GetLinkedTargetDirectories() const
std::vector<std::string> dirs; std::vector<std::string> dirs;
std::set<cmTarget const*> emitted; std::set<cmTarget const*> emitted;
if (cmComputeLinkInformation* cli = if (cmComputeLinkInformation* cli =
this->Target->GetLinkInformation(this->ConfigName)) this->GeneratorTarget->GetLinkInformation(this->ConfigName))
{ {
cmComputeLinkInformation::ItemVector const& items = cli->GetItems(); cmComputeLinkInformation::ItemVector const& items = cli->GetItems();
for(cmComputeLinkInformation::ItemVector::const_iterator for(cmComputeLinkInformation::ItemVector::const_iterator

View File

@ -173,18 +173,19 @@ items that we know the linker will re-use automatically (shared libs).
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmComputeLinkDepends cmComputeLinkDepends
::cmComputeLinkDepends(cmTarget const* target, const std::string& config) ::cmComputeLinkDepends(const cmGeneratorTarget* target,
const std::string& config)
{ {
// Store context information. // Store context information.
this->Target = target; this->Target = target;
this->Makefile = this->Target->GetMakefile(); this->Makefile = this->Target->Target->GetMakefile();
this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); this->GlobalGenerator = this->Makefile->GetGlobalGenerator();
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
// The configuration being linked. // The configuration being linked.
this->HasConfig = !config.empty(); this->HasConfig = !config.empty();
this->Config = (this->HasConfig)? config : std::string(); this->Config = (this->HasConfig)? config : std::string();
this->LinkType = this->Target->ComputeLinkType(this->Config); this->LinkType = this->Target->Target->ComputeLinkType(this->Config);
// Enable debug mode if requested. // Enable debug mode if requested.
this->DebugMode = this->Makefile->IsOn("CMAKE_LINK_DEPENDS_DEBUG_MODE"); this->DebugMode = this->Makefile->IsOn("CMAKE_LINK_DEPENDS_DEBUG_MODE");
@ -363,7 +364,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
{ {
// Follow the target dependencies. // Follow the target dependencies.
if(cmTarget::LinkInterface const* iface = if(cmTarget::LinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config, this->Target)) entry.Target->GetLinkInterface(this->Config, this->Target->Target))
{ {
const bool isIface = const bool isIface =
entry.Target->GetType() == cmTarget::INTERFACE_LIBRARY; entry.Target->GetType() == cmTarget::INTERFACE_LIBRARY;
@ -461,7 +462,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
if(entry.Target) if(entry.Target)
{ {
if(cmTarget::LinkInterface const* iface = if(cmTarget::LinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config, this->Target)) entry.Target->GetLinkInterface(this->Config, this->Target->Target))
{ {
// Follow public and private dependencies transitively. // Follow public and private dependencies transitively.
this->FollowSharedDeps(index, iface, true); this->FollowSharedDeps(index, iface, true);
@ -552,7 +553,7 @@ void cmComputeLinkDepends::AddDirectLinkEntries()
{ {
// Add direct link dependencies in this configuration. // Add direct link dependencies in this configuration.
cmTarget::LinkImplementation const* impl = cmTarget::LinkImplementation const* impl =
this->Target->GetLinkImplementation(this->Config); this->Target->Target->GetLinkImplementation(this->Config);
this->AddLinkEntries(-1, impl->Libraries); this->AddLinkEntries(-1, impl->Libraries);
for(std::vector<cmLinkItem>::const_iterator for(std::vector<cmLinkItem>::const_iterator
wi = impl->WrongConfigLibraries.begin(); wi = impl->WrongConfigLibraries.begin();
@ -634,7 +635,7 @@ cmTarget const* cmComputeLinkDepends::FindTargetToLink(int depender_index,
const std::string& name) const std::string& name)
{ {
// Look for a target in the scope of the depender. // Look for a target in the scope of the depender.
cmTarget const* from = this->Target; cmTarget const* from = this->Target->Target;
if(depender_index >= 0) if(depender_index >= 0)
{ {
if(cmTarget const* depender = this->EntryList[depender_index].Target) if(cmTarget const* depender = this->EntryList[depender_index].Target)
@ -932,7 +933,7 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl)
if(cmTarget const* target = this->EntryList[*ni].Target) if(cmTarget const* target = this->EntryList[*ni].Target)
{ {
if(cmTarget::LinkInterface const* iface = if(cmTarget::LinkInterface const* iface =
target->GetLinkInterface(this->Config, this->Target)) target->GetLinkInterface(this->Config, this->Target->Target))
{ {
if(iface->Multiplicity > count) if(iface->Multiplicity > count)
{ {

View File

@ -22,6 +22,7 @@
class cmComputeComponentGraph; class cmComputeComponentGraph;
class cmGlobalGenerator; class cmGlobalGenerator;
class cmMakefile; class cmMakefile;
class cmGeneratorTarget;
class cmTarget; class cmTarget;
class cmake; class cmake;
@ -31,7 +32,8 @@ class cmake;
class cmComputeLinkDepends class cmComputeLinkDepends
{ {
public: public:
cmComputeLinkDepends(cmTarget const* target, const std::string& config); cmComputeLinkDepends(cmGeneratorTarget const* target,
const std::string& config);
~cmComputeLinkDepends(); ~cmComputeLinkDepends();
// Basic information about each link item. // Basic information about each link item.
@ -57,7 +59,7 @@ public:
private: private:
// Context information. // Context information.
cmTarget const* Target; cmGeneratorTarget const* Target;
cmMakefile* Makefile; cmMakefile* Makefile;
cmGlobalGenerator const* GlobalGenerator; cmGlobalGenerator const* GlobalGenerator;
cmake* CMakeInstance; cmake* CMakeInstance;

View File

@ -19,6 +19,7 @@
#include "cmOutputConverter.h" #include "cmOutputConverter.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmTarget.h" #include "cmTarget.h"
#include "cmGeneratorTarget.h"
#include "cmake.h" #include "cmake.h"
#include "cmAlgorithms.h" #include "cmAlgorithms.h"
@ -241,11 +242,12 @@ because this need be done only for shared libraries without soname-s.
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmComputeLinkInformation cmComputeLinkInformation
::cmComputeLinkInformation(cmTarget const* target, const std::string& config) ::cmComputeLinkInformation(const cmGeneratorTarget* target,
const std::string& config)
{ {
// Store context information. // Store context information.
this->Target = target; this->Target = target;
this->Makefile = this->Target->GetMakefile(); this->Makefile = this->Target->Target->GetMakefile();
this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); this->GlobalGenerator = this->Makefile->GetGlobalGenerator();
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
@ -280,14 +282,14 @@ cmComputeLinkInformation
// Check whether we should skip dependencies on shared library files. // Check whether we should skip dependencies on shared library files.
this->LinkDependsNoShared = this->LinkDependsNoShared =
this->Target->GetPropertyAsBool("LINK_DEPENDS_NO_SHARED"); this->Target->Target->GetPropertyAsBool("LINK_DEPENDS_NO_SHARED");
// On platforms without import libraries there may be a special flag // On platforms without import libraries there may be a special flag
// to use when creating a plugin (module) that obtains symbols from // to use when creating a plugin (module) that obtains symbols from
// the program that will load it. // the program that will load it.
this->LoaderFlag = 0; this->LoaderFlag = 0;
if(!this->UseImportLibrary && if(!this->UseImportLibrary &&
this->Target->GetType() == cmTarget::MODULE_LIBRARY) this->Target->Target->GetType() == cmTarget::MODULE_LIBRARY)
{ {
std::string loader_flag_var = "CMAKE_SHARED_MODULE_LOADER_"; std::string loader_flag_var = "CMAKE_SHARED_MODULE_LOADER_";
loader_flag_var += this->LinkLanguage; loader_flag_var += this->LinkLanguage;
@ -305,10 +307,10 @@ cmComputeLinkInformation
// Get options needed to specify RPATHs. // Get options needed to specify RPATHs.
this->RuntimeUseChrpath = false; this->RuntimeUseChrpath = false;
if(this->Target->GetType() != cmTarget::STATIC_LIBRARY) if(this->Target->Target->GetType() != cmTarget::STATIC_LIBRARY)
{ {
const char* tType = const char* tType =
((this->Target->GetType() == cmTarget::EXECUTABLE)? ((this->Target->Target->GetType() == cmTarget::EXECUTABLE)?
"EXECUTABLE" : "SHARED_LIBRARY"); "EXECUTABLE" : "SHARED_LIBRARY");
std::string rtVar = "CMAKE_"; std::string rtVar = "CMAKE_";
rtVar += tType; rtVar += tType;
@ -321,6 +323,7 @@ cmComputeLinkInformation
this->RuntimeAlways = this->RuntimeAlways =
(this->Makefile-> (this->Makefile->
GetSafeDefinition("CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH")); GetSafeDefinition("CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH"));
this->RuntimeUseChrpath = this->Target->IsChrpathUsed(config); this->RuntimeUseChrpath = this->Target->IsChrpathUsed(config);
// Get options needed to help find dependent libraries. // Get options needed to help find dependent libraries.
@ -373,9 +376,9 @@ cmComputeLinkInformation
// Add the search path entries requested by the user to path ordering. // Add the search path entries requested by the user to path ordering.
this->OrderLinkerSearchPath this->OrderLinkerSearchPath
->AddUserDirectories(this->Target->GetLinkDirectories()); ->AddUserDirectories(this->Target->Target->GetLinkDirectories());
this->OrderRuntimeSearchPath this->OrderRuntimeSearchPath
->AddUserDirectories(this->Target->GetLinkDirectories()); ->AddUserDirectories(this->Target->Target->GetLinkDirectories());
// Set up the implicit link directories. // Set up the implicit link directories.
this->LoadImplicitLinkInfo(); this->LoadImplicitLinkInfo();
@ -403,12 +406,13 @@ cmComputeLinkInformation
// order to support such projects we need to add the directories // order to support such projects we need to add the directories
// containing libraries linked with a full path to the -L path. // containing libraries linked with a full path to the -L path.
this->OldLinkDirMode = this->OldLinkDirMode =
this->Target->GetPolicyStatusCMP0003() != cmPolicies::NEW; this->Target->Target->GetPolicyStatusCMP0003() != cmPolicies::NEW;
if(this->OldLinkDirMode) if(this->OldLinkDirMode)
{ {
// Construct a mask to not bother with this behavior for link // Construct a mask to not bother with this behavior for link
// directories already specified by the user. // directories already specified by the user.
std::vector<std::string> const& dirs = this->Target->GetLinkDirectories(); std::vector<std::string> const& dirs =
this->Target->Target->GetLinkDirectories();
this->OldLinkDirMask.insert(dirs.begin(), dirs.end()); this->OldLinkDirMask.insert(dirs.begin(), dirs.end());
} }
@ -514,7 +518,8 @@ bool cmComputeLinkInformation::Compute()
// Restore the target link type so the correct system runtime // Restore the target link type so the correct system runtime
// libraries are found. // libraries are found.
const char* lss = this->Target->GetProperty("LINK_SEARCH_END_STATIC"); const char* lss =
this->Target->Target->GetProperty("LINK_SEARCH_END_STATIC");
if(cmSystemTools::IsOn(lss)) if(cmSystemTools::IsOn(lss))
{ {
this->SetCurrentLinkType(LinkStatic); this->SetCurrentLinkType(LinkStatic);
@ -567,7 +572,7 @@ bool cmComputeLinkInformation::Compute()
"name." "name."
; ;
this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
this->Target->GetBacktrace()); this->Target->Target->GetBacktrace());
} }
return true; return true;
@ -577,7 +582,8 @@ bool cmComputeLinkInformation::Compute()
void cmComputeLinkInformation::AddImplicitLinkInfo() void cmComputeLinkInformation::AddImplicitLinkInfo()
{ {
// The link closure lists all languages whose implicit info is needed. // The link closure lists all languages whose implicit info is needed.
cmTarget::LinkClosure const* lc=this->Target->GetLinkClosure(this->Config); cmGeneratorTarget::LinkClosure const* lc =
this->Target->GetLinkClosure(this->Config);
for(std::vector<std::string>::const_iterator li = lc->Languages.begin(); for(std::vector<std::string>::const_iterator li = lc->Languages.begin();
li != lc->Languages.end(); ++li) li != lc->Languages.end(); ++li)
{ {
@ -756,15 +762,16 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
return; return;
} }
cmGeneratorTarget *gtgt = 0;
// Get a full path to the dependent shared library. // Get a full path to the dependent shared library.
// Add it to the runtime path computation so that the target being // Add it to the runtime path computation so that the target being
// linked will be able to find it. // linked will be able to find it.
std::string lib; std::string lib;
if(tgt) if(tgt)
{ {
cmGeneratorTarget *gtgt = tgt->GetMakefile() gtgt = tgt->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(tgt);
->GetGlobalGenerator()
->GetGeneratorTarget(tgt);
lib = gtgt->GetFullPath(this->Config, this->UseImportLibrary); lib = gtgt->GetFullPath(this->Config, this->UseImportLibrary);
this->AddLibraryRuntimeInfo(lib, tgt); this->AddLibraryRuntimeInfo(lib, tgt);
} }
@ -790,9 +797,9 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
} }
if(order) if(order)
{ {
if(tgt) if(gtgt)
{ {
std::string soName = tgt->GetSOName(this->Config); std::string soName = gtgt->GetSOName(this->Config);
const char* soname = soName.empty()? 0 : soName.c_str(); const char* soname = soName.empty()? 0 : soName.c_str();
order->AddRuntimeLibrary(lib, soname); order->AddRuntimeLibrary(lib, soname);
} }
@ -854,7 +861,8 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo()
} }
// Lookup the starting link type from the target (linked statically?). // Lookup the starting link type from the target (linked statically?).
const char* lss = this->Target->GetProperty("LINK_SEARCH_START_STATIC"); const char* lss =
this->Target->Target->GetProperty("LINK_SEARCH_START_STATIC");
this->StartLinkType = cmSystemTools::IsOn(lss)? LinkStatic : LinkShared; this->StartLinkType = cmSystemTools::IsOn(lss)? LinkStatic : LinkShared;
this->CurrentLinkType = this->StartLinkType; this->CurrentLinkType = this->StartLinkType;
} }
@ -1140,7 +1148,7 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
// Full path libraries should specify a valid library file name. // Full path libraries should specify a valid library file name.
// See documentation of CMP0008. // See documentation of CMP0008.
std::string generator = this->GlobalGenerator->GetName(); std::string generator = this->GlobalGenerator->GetName();
if(this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW && if(this->Target->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW &&
(generator.find("Visual Studio") != generator.npos || (generator.find("Visual Studio") != generator.npos ||
generator.find("Xcode") != generator.npos)) generator.find("Xcode") != generator.npos))
{ {
@ -1221,7 +1229,7 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item)
} }
// Check the policy for whether we should use the approach below. // Check the policy for whether we should use the approach below.
switch (this->Target->GetPolicyStatusCMP0060()) switch (this->Target->Target->GetPolicyStatusCMP0060())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
if (this->CMP0060Warn) if (this->CMP0060Warn)
@ -1531,7 +1539,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
this->OrderLinkerSearchPath->AddLinkLibrary(item); this->OrderLinkerSearchPath->AddLinkLibrary(item);
// Produce any needed message. // Produce any needed message.
switch(this->Target->GetPolicyStatusCMP0008()) switch(this->Target->Target->GetPolicyStatusCMP0008())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
{ {
@ -1548,7 +1556,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
<< " " << item << "\n" << " " << item << "\n"
<< "which is a full-path but not a valid library file name."; << "which is a full-path but not a valid library file name.";
this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
this->Target->GetBacktrace()); this->Target->Target->GetBacktrace());
} }
} }
case cmPolicies::OLD: case cmPolicies::OLD:
@ -1566,7 +1574,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
<< " " << item << "\n" << " " << item << "\n"
<< "which is a full-path but not a valid library file name."; << "which is a full-path but not a valid library file name.";
this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(),
this->Target->GetBacktrace()); this->Target->Target->GetBacktrace());
} }
break; break;
} }
@ -1583,7 +1591,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
} }
// Enforce policy constraints. // Enforce policy constraints.
switch(this->Target->GetPolicyStatusCMP0003()) switch(this->Target->Target->GetPolicyStatusCMP0003())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
if(!this->CMakeInstance->GetState() if(!this->CMakeInstance->GetState()
@ -1594,7 +1602,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
std::ostringstream w; std::ostringstream w;
this->PrintLinkPolicyDiagnosis(w); this->PrintLinkPolicyDiagnosis(w);
this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
this->Target->GetBacktrace()); this->Target->Target->GetBacktrace());
} }
case cmPolicies::OLD: case cmPolicies::OLD:
// OLD behavior is to add the paths containing libraries with // OLD behavior is to add the paths containing libraries with
@ -1610,7 +1618,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0003) << "\n"; e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0003) << "\n";
this->PrintLinkPolicyDiagnosis(e); this->PrintLinkPolicyDiagnosis(e);
this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(),
this->Target->GetBacktrace()); this->Target->Target->GetBacktrace());
return false; return false;
} }
} }
@ -1804,7 +1812,10 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
// Try to get the soname of the library. Only files with this name // Try to get the soname of the library. Only files with this name
// could possibly conflict. // could possibly conflict.
std::string soName = target->GetSOName(this->Config); cmGeneratorTarget *gtgt = target->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(target);
std::string soName = gtgt->GetSOName(this->Config);
const char* soname = soName.empty()? 0 : soName.c_str(); const char* soname = soName.empty()? 0 : soName.c_str();
// Include this library in the runtime path ordering. // Include this library in the runtime path ordering.
@ -1911,23 +1922,24 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
// build tree. // build tree.
bool linking_for_install = bool linking_for_install =
(for_install || (for_install ||
this->Target->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH")); this->Target->Target->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"));
bool use_install_rpath = bool use_install_rpath =
(outputRuntime && this->Target->HaveInstallTreeRPATH() && (outputRuntime && this->Target->Target->HaveInstallTreeRPATH() &&
linking_for_install); linking_for_install);
bool use_build_rpath = bool use_build_rpath =
(outputRuntime && this->Target->HaveBuildTreeRPATH(this->Config) && (outputRuntime && this->Target->Target->HaveBuildTreeRPATH(this->Config) &&
!linking_for_install); !linking_for_install);
bool use_link_rpath = bool use_link_rpath =
outputRuntime && linking_for_install && outputRuntime && linking_for_install &&
!this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH") && !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH") &&
this->Target->GetPropertyAsBool("INSTALL_RPATH_USE_LINK_PATH"); this->Target->Target->GetPropertyAsBool("INSTALL_RPATH_USE_LINK_PATH");
// Construct the RPATH. // Construct the RPATH.
std::set<std::string> emitted; std::set<std::string> emitted;
if(use_install_rpath) if(use_install_rpath)
{ {
const char* install_rpath = this->Target->GetProperty("INSTALL_RPATH"); const char* install_rpath =
this->Target->Target->GetProperty("INSTALL_RPATH");
cmCLI_ExpandListUnique(install_rpath, runtimeDirs, emitted); cmCLI_ExpandListUnique(install_rpath, runtimeDirs, emitted);
} }
if(use_build_rpath || use_link_rpath) if(use_build_rpath || use_link_rpath)
@ -1999,7 +2011,7 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
// Add runtime paths required by the languages to always be // Add runtime paths required by the languages to always be
// present. This is done even when skipping rpath support. // present. This is done even when skipping rpath support.
{ {
cmTarget::LinkClosure const* lc = cmGeneratorTarget::LinkClosure const* lc =
this->Target->GetLinkClosure(this->Config); this->Target->GetLinkClosure(this->Config);
for(std::vector<std::string>::const_iterator li = lc->Languages.begin(); for(std::vector<std::string>::const_iterator li = lc->Languages.begin();
li != lc->Languages.end(); ++li) li != lc->Languages.end(); ++li)

View File

@ -20,6 +20,7 @@ class cmake;
class cmGlobalGenerator; class cmGlobalGenerator;
class cmMakefile; class cmMakefile;
class cmTarget; class cmTarget;
class cmGeneratorTarget;
class cmOrderDirectories; class cmOrderDirectories;
/** \class cmComputeLinkInformation /** \class cmComputeLinkInformation
@ -28,7 +29,8 @@ class cmOrderDirectories;
class cmComputeLinkInformation class cmComputeLinkInformation
{ {
public: public:
cmComputeLinkInformation(cmTarget const* target, const std::string& config); cmComputeLinkInformation(cmGeneratorTarget const* target,
const std::string& config);
~cmComputeLinkInformation(); ~cmComputeLinkInformation();
bool Compute(); bool Compute();
@ -72,7 +74,7 @@ private:
std::set<cmTarget const*> SharedLibrariesLinked; std::set<cmTarget const*> SharedLibrariesLinked;
// Context information. // Context information.
cmTarget const* Target; cmGeneratorTarget const* Target;
cmMakefile* Makefile; cmMakefile* Makefile;
cmGlobalGenerator* GlobalGenerator; cmGlobalGenerator* GlobalGenerator;
cmake* CMakeInstance; cmake* CMakeInstance;

View File

@ -27,6 +27,7 @@ cmExportBuildFileGenerator::cmExportBuildFileGenerator()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
{ {
std::vector<cmGeneratorTarget*> allTargets;
{ {
std::string expectedTargets; std::string expectedTargets;
std::string sep; std::string sep;
@ -68,7 +69,8 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
tei = this->Exports.begin(); tei = this->Exports.begin();
tei != this->Exports.end(); ++tei) tei != this->Exports.end(); ++tei)
{ {
cmTarget* te = (*tei)->Target; cmGeneratorTarget* gte = *tei;
cmTarget* te = gte->Target;
this->GenerateImportTargetCode(os, te); this->GenerateImportTargetCode(os, te);
te->AppendBuildInterfaceIncludes(); te->AppendBuildInterfaceIncludes();
@ -104,7 +106,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
cmGeneratorExpression::BuildInterface, cmGeneratorExpression::BuildInterface,
properties, missingTargets); properties, missingTargets);
} }
this->PopulateCompatibleInterfaceProperties(te, properties); this->PopulateCompatibleInterfaceProperties(gte, properties);
this->GenerateInterfaceProperties(te, os, properties); this->GenerateInterfaceProperties(te, os, properties);
} }
@ -331,12 +333,12 @@ cmExportBuildFileGenerator
} }
std::string std::string
cmExportBuildFileGenerator::InstallNameDir(cmTarget* target, cmExportBuildFileGenerator::InstallNameDir(cmGeneratorTarget* target,
const std::string& config) const std::string& config)
{ {
std::string install_name_dir; std::string install_name_dir;
cmMakefile* mf = target->GetMakefile(); cmMakefile* mf = target->Target->GetMakefile();
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{ {
install_name_dir = install_name_dir =

View File

@ -71,7 +71,8 @@ protected:
cmGeneratorTarget* target, cmGeneratorTarget* target,
ImportPropertyMap& properties); ImportPropertyMap& properties);
std::string InstallNameDir(cmTarget* target, const std::string& config); std::string InstallNameDir(cmGeneratorTarget* target,
const std::string& config);
std::vector<std::string> std::vector<std::string>
FindNamespaces(cmMakefile* mf, const std::string& name); FindNamespaces(cmMakefile* mf, const std::string& name);

View File

@ -525,7 +525,7 @@ void getPropertyContents(cmTarget const* tgt, const std::string& prop,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void getCompatibleInterfaceProperties(cmTarget *target, void getCompatibleInterfaceProperties(cmGeneratorTarget *target,
std::set<std::string> &ifaceProperties, std::set<std::string> &ifaceProperties,
const std::string& config) const std::string& config)
{ {
@ -533,7 +533,7 @@ void getCompatibleInterfaceProperties(cmTarget *target,
if (!info) if (!info)
{ {
cmMakefile* mf = target->GetMakefile(); cmMakefile* mf = target->Target->GetMakefile();
std::ostringstream e; std::ostringstream e;
e << "Exporting the target \"" << target->GetName() << "\" is not " e << "Exporting the target \"" << target->GetName() << "\" is not "
"allowed since its linker language cannot be determined"; "allowed since its linker language cannot be determined";
@ -568,9 +568,10 @@ void getCompatibleInterfaceProperties(cmTarget *target,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmExportFileGenerator::PopulateCompatibleInterfaceProperties( void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
cmTarget *target, cmGeneratorTarget *gtarget,
ImportPropertyMap &properties) ImportPropertyMap &properties)
{ {
cmTarget *target = gtarget->Target;
this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_BOOL", this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_BOOL",
target, properties); target, properties);
this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_STRING", this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_STRING",
@ -591,7 +592,7 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
if (target->GetType() != cmTarget::INTERFACE_LIBRARY) if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
{ {
getCompatibleInterfaceProperties(target, ifaceProperties, ""); getCompatibleInterfaceProperties(gtarget, ifaceProperties, "");
std::vector<std::string> configNames; std::vector<std::string> configNames;
target->GetMakefile()->GetConfigurations(configNames); target->GetMakefile()->GetConfigurations(configNames);
@ -599,7 +600,7 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
for (std::vector<std::string>::const_iterator ci = configNames.begin(); for (std::vector<std::string>::const_iterator ci = configNames.begin();
ci != configNames.end(); ++ci) ci != configNames.end(); ++ci)
{ {
getCompatibleInterfaceProperties(target, ifaceProperties, *ci); getCompatibleInterfaceProperties(gtarget, ifaceProperties, *ci);
} }
} }
@ -888,14 +889,14 @@ cmExportFileGenerator
{ {
std::string prop; std::string prop;
std::string value; std::string value;
if(target->Target->HasSOName(config)) if(target->HasSOName(config))
{ {
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{ {
value = this->InstallNameDir(target->Target, config); value = this->InstallNameDir(target, config);
} }
prop = "IMPORTED_SONAME"; prop = "IMPORTED_SONAME";
value += target->Target->GetSOName(config); value += target->GetSOName(config);
} }
else else
{ {

View File

@ -132,7 +132,7 @@ protected:
std::vector<std::string> &missingTargets); std::vector<std::string> &missingTargets);
void PopulateInterfaceProperty(const std::string& propName, cmTarget *target, void PopulateInterfaceProperty(const std::string& propName, cmTarget *target,
ImportPropertyMap &properties); ImportPropertyMap &properties);
void PopulateCompatibleInterfaceProperties(cmTarget *target, void PopulateCompatibleInterfaceProperties(cmGeneratorTarget *target,
ImportPropertyMap &properties); ImportPropertyMap &properties);
void GenerateInterfaceProperties(cmTarget const* target, std::ostream& os, void GenerateInterfaceProperties(cmTarget const* target, std::ostream& os,
const ImportPropertyMap &properties); const ImportPropertyMap &properties);
@ -200,7 +200,7 @@ private:
virtual void ReplaceInstallPrefix(std::string &input); virtual void ReplaceInstallPrefix(std::string &input);
virtual std::string InstallNameDir(cmTarget* target, virtual std::string InstallNameDir(cmGeneratorTarget* target,
const std::string& config) = 0; const std::string& config) = 0;
}; };

View File

@ -193,7 +193,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
te, properties); te, properties);
this->PopulateCompatibleInterfaceProperties(te, properties); cmGeneratorTarget *gtgt = te->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(te);
this->PopulateCompatibleInterfaceProperties(gtgt, properties);
this->GenerateInterfaceProperties(te, os, properties); this->GenerateInterfaceProperties(te, os, properties);
} }
@ -358,7 +362,7 @@ cmExportInstallFileGenerator
if(!properties.empty()) if(!properties.empty())
{ {
// Get the rest of the target details. // Get the rest of the target details.
cmGeneratorTarget *gtgt = te->Target->GetMakefile()->GetLocalGenerator() cmGeneratorTarget *gtgt = te->Target->GetMakefile()
->GetGlobalGenerator()->GetGeneratorTarget(te->Target); ->GetGlobalGenerator()->GetGeneratorTarget(te->Target);
this->SetImportDetailProperties(config, suffix, this->SetImportDetailProperties(config, suffix,
gtgt, properties, missingTargets); gtgt, properties, missingTargets);
@ -542,12 +546,12 @@ cmExportInstallFileGenerator
} }
std::string std::string
cmExportInstallFileGenerator::InstallNameDir(cmTarget* target, cmExportInstallFileGenerator::InstallNameDir(cmGeneratorTarget* target,
const std::string&) const std::string&)
{ {
std::string install_name_dir; std::string install_name_dir;
cmMakefile* mf = target->GetMakefile(); cmMakefile* mf = target->Target->GetMakefile();
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{ {
install_name_dir = install_name_dir =

View File

@ -83,7 +83,8 @@ protected:
std::set<std::string>& importedLocations std::set<std::string>& importedLocations
); );
std::string InstallNameDir(cmTarget* target, const std::string& config); std::string InstallNameDir(cmGeneratorTarget* target,
const std::string& config);
cmInstallExportGenerator* IEGen; cmInstallExportGenerator* IEGen;

View File

@ -125,12 +125,12 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target,
} }
std::string std::string
cmExportTryCompileFileGenerator::InstallNameDir(cmTarget* target, cmExportTryCompileFileGenerator::InstallNameDir(cmGeneratorTarget* target,
const std::string& config) const std::string& config)
{ {
std::string install_name_dir; std::string install_name_dir;
cmMakefile* mf = target->GetMakefile(); cmMakefile* mf = target->Target->GetMakefile();
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{ {
install_name_dir = install_name_dir =

View File

@ -45,7 +45,7 @@ protected:
ImportPropertyMap& properties, ImportPropertyMap& properties,
std::set<cmTarget const*> &emitted); std::set<cmTarget const*> &emitted);
std::string InstallNameDir(cmTarget* target, std::string InstallNameDir(cmGeneratorTarget* target,
const std::string& config); const std::string& config);
private: private:
std::string FindTargets(const std::string& prop, cmTarget const* tgt, std::string FindTargets(const std::string& prop, cmTarget const* tgt,

View File

@ -990,6 +990,9 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
assert(target); assert(target);
cmGeneratorTarget* gtgt =
context->Makefile->GetGlobalGenerator()->GetGeneratorTarget(target);
if (propertyName == "LINKER_LANGUAGE") if (propertyName == "LINKER_LANGUAGE")
{ {
if (target->LinkLanguagePropagatesToDependents() && if (target->LinkLanguagePropagatesToDependents() &&
@ -1001,7 +1004,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
"link libraries for a static library"); "link libraries for a static library");
return std::string(); return std::string();
} }
return target->GetLinkerLanguage(context->Config); return gtgt->GetLinkerLanguage(context->Config);
} }
cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace,
@ -1135,40 +1138,40 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
{ {
return linkedTargetsContent; return linkedTargetsContent;
} }
if (target->IsLinkInterfaceDependentBoolProperty(propertyName, if (gtgt->IsLinkInterfaceDependentBoolProperty(propertyName,
context->Config)) context->Config))
{ {
context->HadContextSensitiveCondition = true; context->HadContextSensitiveCondition = true;
return target->GetLinkInterfaceDependentBoolProperty( return gtgt->GetLinkInterfaceDependentBoolProperty(
propertyName, propertyName,
context->Config) ? "1" : "0"; context->Config) ? "1" : "0";
} }
if (target->IsLinkInterfaceDependentStringProperty(propertyName, if (gtgt->IsLinkInterfaceDependentStringProperty(propertyName,
context->Config)) context->Config))
{ {
context->HadContextSensitiveCondition = true; context->HadContextSensitiveCondition = true;
const char *propContent = const char *propContent =
target->GetLinkInterfaceDependentStringProperty( gtgt->GetLinkInterfaceDependentStringProperty(
propertyName, propertyName,
context->Config); context->Config);
return propContent ? propContent : ""; return propContent ? propContent : "";
} }
if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, if (gtgt->IsLinkInterfaceDependentNumberMinProperty(propertyName,
context->Config)) context->Config))
{ {
context->HadContextSensitiveCondition = true; context->HadContextSensitiveCondition = true;
const char *propContent = const char *propContent =
target->GetLinkInterfaceDependentNumberMinProperty( gtgt->GetLinkInterfaceDependentNumberMinProperty(
propertyName, propertyName,
context->Config); context->Config);
return propContent ? propContent : ""; return propContent ? propContent : "";
} }
if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, if (gtgt->IsLinkInterfaceDependentNumberMaxProperty(propertyName,
context->Config)) context->Config))
{ {
context->HadContextSensitiveCondition = true; context->HadContextSensitiveCondition = true;
const char *propContent = const char *propContent =
target->GetLinkInterfaceDependentNumberMaxProperty( gtgt->GetLinkInterfaceDependentNumberMaxProperty(
propertyName, propertyName,
context->Config); context->Config);
return propContent ? propContent : ""; return propContent ? propContent : "";
@ -1180,22 +1183,22 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
if (!target->IsImported() if (!target->IsImported()
&& dagCheckerParent && !dagCheckerParent->EvaluatingLinkLibraries()) && dagCheckerParent && !dagCheckerParent->EvaluatingLinkLibraries())
{ {
if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, if (gtgt->IsLinkInterfaceDependentNumberMinProperty(propertyName,
context->Config)) context->Config))
{ {
context->HadContextSensitiveCondition = true; context->HadContextSensitiveCondition = true;
const char *propContent = const char *propContent =
target->GetLinkInterfaceDependentNumberMinProperty( gtgt->GetLinkInterfaceDependentNumberMinProperty(
propertyName, propertyName,
context->Config); context->Config);
return propContent ? propContent : ""; return propContent ? propContent : "";
} }
if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, if (gtgt->IsLinkInterfaceDependentNumberMaxProperty(propertyName,
context->Config)) context->Config))
{ {
context->HadContextSensitiveCondition = true; context->HadContextSensitiveCondition = true;
const char *propContent = const char *propContent =
target->GetLinkInterfaceDependentNumberMaxProperty( gtgt->GetLinkInterfaceDependentNumberMaxProperty(
propertyName, propertyName,
context->Config); context->Config);
return propContent ? propContent : ""; return propContent ? propContent : "";
@ -1584,7 +1587,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag>
} }
std::string result = target->Target->GetDirectory(context->Config); std::string result = target->Target->GetDirectory(context->Config);
result += "/"; result += "/";
result += target->Target->GetSOName(context->Config); result += target->GetSOName(context->Config);
return result; return result;
} }
}; };
@ -1597,7 +1600,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag>
cmGeneratorExpressionContext *context, cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *content) const GeneratorExpressionContent *content)
{ {
std::string language = target->Target->GetLinkerLanguage(context->Config); std::string language = target->GetLinkerLanguage(context->Config);
std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB"; std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB";
@ -1622,7 +1625,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag>
std::string result = target->Target->GetPDBDirectory(context->Config); std::string result = target->Target->GetPDBDirectory(context->Config);
result += "/"; result += "/";
result += target->Target->GetPDBName(context->Config); result += target->GetPDBName(context->Config);
return result; return result;
} }
}; };

File diff suppressed because it is too large Load Diff

View File

@ -20,11 +20,13 @@ class cmLocalGenerator;
class cmMakefile; class cmMakefile;
class cmSourceFile; class cmSourceFile;
class cmTarget; class cmTarget;
class cmComputeLinkInformation;
class cmGeneratorTarget class cmGeneratorTarget
{ {
public: public:
cmGeneratorTarget(cmTarget*, cmLocalGenerator* lg); cmGeneratorTarget(cmTarget*, cmLocalGenerator* lg);
~cmGeneratorTarget();
cmLocalGenerator* GetLocalGenerator() const; cmLocalGenerator* GetLocalGenerator() const;
@ -36,6 +38,9 @@ public:
location is suitable for use as the LOCATION target property. */ location is suitable for use as the LOCATION target property. */
const char* GetLocationForBuild() const; const char* GetLocationForBuild() const;
cmComputeLinkInformation*
GetLinkInformation(const std::string& config) const;
int GetType() const; int GetType() const;
std::string GetName() const; std::string GetName() const;
const char *GetProperty(const std::string& prop) const; const char *GetProperty(const std::string& prop) const;
@ -82,6 +87,26 @@ public:
bool GetFeatureAsBool(const std::string& feature, bool GetFeatureAsBool(const std::string& feature,
const std::string& config) const; const std::string& config) const;
bool IsLinkInterfaceDependentBoolProperty(const std::string &p,
const std::string& config) const;
bool IsLinkInterfaceDependentStringProperty(const std::string &p,
const std::string& config) const;
bool IsLinkInterfaceDependentNumberMinProperty(const std::string &p,
const std::string& config) const;
bool IsLinkInterfaceDependentNumberMaxProperty(const std::string &p,
const std::string& config) const;
bool GetLinkInterfaceDependentBoolProperty(const std::string &p,
const std::string& config) const;
const char *GetLinkInterfaceDependentStringProperty(const std::string &p,
const std::string& config) const;
const char *GetLinkInterfaceDependentNumberMinProperty(const std::string &p,
const std::string& config) const;
const char *GetLinkInterfaceDependentNumberMaxProperty(const std::string &p,
const std::string& config) const;
/** Get the full path to the target according to the settings in its /** Get the full path to the target according to the settings in its
makefile and the configuration type. */ makefile and the configuration type. */
std::string GetFullPath(const std::string& config="", bool implib = false, std::string GetFullPath(const std::string& config="", bool implib = false,
@ -90,6 +115,53 @@ public:
bool realname) const; bool realname) const;
std::string NormalGetRealName(const std::string& config) const; std::string NormalGetRealName(const std::string& config) const;
/** @return the Mac App directory without the base */
std::string GetAppBundleDirectory(const std::string& config,
bool contentOnly) const;
/** Return whether this target is an executable Bundle, a framework
or CFBundle on Apple. */
bool IsBundleOnApple() const;
/** Get the full name of the target according to the settings in its
makefile. */
std::string GetFullName(const std::string& config="",
bool implib = false) const;
/** @return the Mac framework directory without the base. */
std::string GetFrameworkDirectory(const std::string& config,
bool rootDir) const;
/** @return the Mac CFBundle directory without the base */
std::string GetCFBundleDirectory(const std::string& config,
bool contentOnly) const;
/** Return the install name directory for the target in the
* build tree. For example: "\@rpath/", "\@loader_path/",
* or "/full/path/to/library". */
std::string GetInstallNameDirForBuildTree(const std::string& config) const;
/** Return the install name directory for the target in the
* install tree. For example: "\@rpath/" or "\@loader_path/". */
std::string GetInstallNameDirForInstallTree() const;
/** Get the soname of the target. Allowed only for a shared library. */
std::string GetSOName(const std::string& config) const;
void GetFullNameComponents(std::string& prefix,
std::string& base, std::string& suffix,
const std::string& config="",
bool implib = false) const;
/** Append to @a base the mac content directory and return it. */
std::string BuildMacContentDirectory(const std::string& base,
const std::string& config = "",
bool contentOnly = true) const;
/** @return the mac content directory for this target. */
std::string GetMacContentDirectory(const std::string& config = 0,
bool implib = false) const;
cmTarget* Target; cmTarget* Target;
cmMakefile* Makefile; cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator; cmLocalGenerator* LocalGenerator;
@ -97,6 +169,20 @@ public:
std::string GetModuleDefinitionFile(const std::string& config) const; std::string GetModuleDefinitionFile(const std::string& config) const;
/** Link information from the transitive closure of the link
implementation and the interfaces of its dependencies. */
struct LinkClosure
{
// The preferred linker language.
std::string LinkerLanguage;
// Languages whose runtime libraries must be linked.
std::vector<std::string> Languages;
};
LinkClosure const* GetLinkClosure(const std::string& config) const;
void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const;
/** Full path with trailing slash to the top-level directory /** Full path with trailing slash to the top-level directory
holding object files for this target. Includes the build holding object files for this target. Includes the build
time config name placeholder if needed for the generator. */ time config name placeholder if needed for the generator. */
@ -128,10 +214,41 @@ public:
*/ */
void TraceDependencies(); void TraceDependencies();
/** Get the directory in which to place the target compiler .pdb file.
If the configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
compiler pdb output directory is given. */
std::string GetCompilePDBDirectory(const std::string& config = "") const;
/** Get sources that must be built before the given source. */ /** Get sources that must be built before the given source. */
std::vector<cmSourceFile*> const* std::vector<cmSourceFile*> const*
GetSourceDepends(cmSourceFile const* sf) const; GetSourceDepends(cmSourceFile const* sf) const;
/** Get the name of the pdb file for the target. */
std::string GetPDBName(const std::string& config="") const;
/** Whether this library has soname enabled and platform supports it. */
bool HasSOName(const std::string& config) const;
struct CompileInfo
{
std::string CompilePdbDir;
};
CompileInfo const* GetCompileInfo(const std::string& config) const;
typedef std::map<std::string, CompileInfo> CompileInfoMapType;
mutable CompileInfoMapType CompileInfoMap;
/** Get the name of the compiler pdb file for the target. */
std::string GetCompilePDBName(const std::string& config="") const;
/** Get the path for the MSVC /Fd option for this target. */
std::string GetCompilePDBPath(const std::string& config="") const;
// Get the target base name.
std::string GetOutputName(const std::string& config, bool implib) const;
/** /**
* Flags for a given source file as used in this target. Typically assigned * Flags for a given source file as used in this target. Typically assigned
* via SET_TARGET_PROPERTIES when the property is a list of source files. * via SET_TARGET_PROPERTIES when the property is a list of source files.
@ -153,6 +270,33 @@ public:
SourceFileType Type; SourceFileType Type;
const char* MacFolder; // location inside Mac content folders const char* MacFolder; // location inside Mac content folders
}; };
void GetAutoUicOptions(std::vector<std::string> &result,
const std::string& config) const;
/** Get the names of the executable needed to generate a build rule
that takes into account executable version numbers. This should
be called only on an executable target. */
void GetExecutableNames(std::string& name, std::string& realName,
std::string& impName, std::string& pdbName,
const std::string& config) const;
/** Get the names of the library needed to generate a build rule
that takes into account shared library version numbers. This
should be called only on a library target. */
void GetLibraryNames(std::string& name, std::string& soName,
std::string& realName, std::string& impName,
std::string& pdbName, const std::string& config) const;
/**
* Compute whether this target must be relinked before installing.
*/
bool NeedRelinkBeforeInstall(const std::string& config) const;
/** Return true if builtin chrpath will work for this target */
bool IsChrpathUsed(const std::string& config) const;
///! Return the preferred linker language for this target
std::string GetLinkerLanguage(const std::string& config = "") const;
struct SourceFileFlags struct SourceFileFlags
GetTargetSourceFileFlags(const cmSourceFile* sf) const; GetTargetSourceFileFlags(const cmSourceFile* sf) const;
@ -168,12 +312,16 @@ public:
std::vector<cmSourceFile const*> XamlSources; std::vector<cmSourceFile const*> XamlSources;
}; };
void ReportPropertyOrigin(const std::string &p,
const std::string &result,
const std::string &report,
const std::string &compatibilityType) const;
private: private:
friend class cmTargetTraceDependencies; friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; }; struct SourceEntry { std::vector<cmSourceFile*> Depends; };
typedef std::map<cmSourceFile const*, SourceEntry> SourceEntriesType; typedef std::map<cmSourceFile const*, SourceEntry> SourceEntriesType;
SourceEntriesType SourceEntries; SourceEntriesType SourceEntries;
mutable std::map<cmSourceFile const*, std::string> Objects; mutable std::map<cmSourceFile const*, std::string> Objects;
std::set<cmSourceFile const*> ExplicitObjectName; std::set<cmSourceFile const*> ExplicitObjectName;
mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache; mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache;
@ -182,8 +330,55 @@ private:
mutable bool SourceFileFlagsConstructed; mutable bool SourceFileFlagsConstructed;
mutable std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap; mutable std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap;
mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
std::string GetFullNameInternal(const std::string& config,
bool implib) const;
void GetFullNameInternal(const std::string& config, bool implib,
std::string& outPrefix, std::string& outBase,
std::string& outSuffix) const;
typedef std::map<std::string, LinkClosure> LinkClosureMapType;
mutable LinkClosureMapType LinkClosureMap;
struct CompatibleInterfacesBase
{
std::set<std::string> PropsBool;
std::set<std::string> PropsString;
std::set<std::string> PropsNumberMax;
std::set<std::string> PropsNumberMin;
};
CompatibleInterfacesBase const&
GetCompatibleInterfaces(std::string const& config) const;
struct CompatibleInterfaces: public CompatibleInterfacesBase
{
CompatibleInterfaces(): Done(false) {}
bool Done;
};
mutable std::map<std::string, CompatibleInterfaces> CompatibleInterfacesMap;
typedef std::map<std::string, cmComputeLinkInformation*>
cmTargetLinkInformationMap;
mutable cmTargetLinkInformationMap LinkInformation;
void CheckPropertyCompatibility(cmComputeLinkInformation *info,
const std::string& config) const;
cmGeneratorTarget(cmGeneratorTarget const&); cmGeneratorTarget(cmGeneratorTarget const&);
void operator=(cmGeneratorTarget const&); void operator=(cmGeneratorTarget const&);
struct LinkImplClosure: public std::vector<cmTarget const*>
{
LinkImplClosure(): Done(false) {}
bool Done;
};
mutable std::map<std::string, LinkImplClosure> LinkImplClosureMap;
public:
std::vector<cmTarget const*> const&
GetLinkImplementationClosure(const std::string& config) const;
}; };
struct cmStrictTargetComparison { struct cmStrictTargetComparison {

View File

@ -128,7 +128,8 @@ void cmGhsMultiTargetGenerator::Generate()
{ {
config = "RELEASE"; config = "RELEASE";
} }
const std::string language(this->Target->GetLinkerLanguage(config)); const std::string language(
this->GeneratorTarget->GetLinkerLanguage(config));
config = cmSystemTools::UpperCase(config); config = cmSystemTools::UpperCase(config);
this->DynamicDownload = this->DetermineIfDynamicDownload(config, language); this->DynamicDownload = this->DetermineIfDynamicDownload(config, language);
if (this->DynamicDownload) if (this->DynamicDownload)

View File

@ -911,9 +911,7 @@ cmGlobalNinjaGenerator
case cmTarget::STATIC_LIBRARY: case cmTarget::STATIC_LIBRARY:
case cmTarget::MODULE_LIBRARY: case cmTarget::MODULE_LIBRARY:
{ {
cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator() cmGeneratorTarget *gtgt = this->GetGeneratorTarget(target);
->GetGlobalGenerator()
->GetGeneratorTarget(target);
outputs.push_back(ng->ConvertToNinjaPath( outputs.push_back(ng->ConvertToNinjaPath(
gtgt->GetFullPath(configName, false, realname))); gtgt->GetFullPath(configName, false, realname)));
break; break;

View File

@ -482,7 +482,7 @@ cmGlobalUnixMakefileGenerator3
// Add this to the list of depends rules in this directory. // Add this to the list of depends rules in this directory.
if((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) && if((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
(!check_relink || (!check_relink ||
gtarget->Target gtarget
->NeedRelinkBeforeInstall(lg->GetConfigName()))) ->NeedRelinkBeforeInstall(lg->GetConfigName())))
{ {
std::string tname = lg->GetRelativeTargetDirectory(*gtarget->Target); std::string tname = lg->GetRelativeTargetDirectory(*gtarget->Target);
@ -691,7 +691,7 @@ cmGlobalUnixMakefileGenerator3
// Add a local name for the rule to relink the target before // Add a local name for the rule to relink the target before
// installation. // installation.
if(gtarget->Target if(gtarget
->NeedRelinkBeforeInstall(lg->GetConfigName())) ->NeedRelinkBeforeInstall(lg->GetConfigName()))
{ {
makeTargetName = lg->GetRelativeTargetDirectory(*gtarget->Target); makeTargetName = lg->GetRelativeTargetDirectory(*gtarget->Target);
@ -876,7 +876,7 @@ cmGlobalUnixMakefileGenerator3
name, depends, commands, true); name, depends, commands, true);
// Add rules to prepare the target for installation. // Add rules to prepare the target for installation.
if(gtarget->Target if(gtarget
->NeedRelinkBeforeInstall(lg->GetConfigName())) ->NeedRelinkBeforeInstall(lg->GetConfigName()))
{ {
localName = lg->GetRelativeTargetDirectory(*gtarget->Target); localName = lg->GetRelativeTargetDirectory(*gtarget->Target);

View File

@ -1376,7 +1376,8 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
return; return;
} }
std::string llang = cmtarget.GetLinkerLanguage("NOCONFIG"); cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&cmtarget);
std::string llang = gtgt->GetLinkerLanguage("NOCONFIG");
if(llang.empty()) { return; } if(llang.empty()) { return; }
// If the language is compiled as a source trust Xcode to link with it. // If the language is compiled as a source trust Xcode to link with it.
@ -1824,7 +1825,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
AddCompileOptions(flags, &target, lang, configName); AddCompileOptions(flags, &target, lang, configName);
} }
std::string llang = target.GetLinkerLanguage(configName); cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
std::string llang = gtgt->GetLinkerLanguage(configName);
if(binary && llang.empty()) if(binary && llang.empty())
{ {
cmSystemTools::Error cmSystemTools::Error
@ -1850,7 +1852,6 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// Add the export symbol definition for shared library objects. // Add the export symbol definition for shared library objects.
this->AppendDefines(ppDefs, exportMacro); this->AppendDefines(ppDefs, exportMacro);
} }
cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
std::vector<std::string> targetDefines; std::vector<std::string> targetDefines;
target.GetCompileDefinitions(targetDefines, configName, "C"); target.GetCompileDefinitions(targetDefines, configName, "C");
this->AppendDefines(ppDefs, targetDefines); this->AppendDefines(ppDefs, targetDefines);
@ -1940,11 +1941,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
std::string pnprefix; std::string pnprefix;
std::string pnbase; std::string pnbase;
std::string pnsuffix; std::string pnsuffix;
target.GetFullNameComponents(pnprefix, pnbase, pnsuffix, configName); gtgt->GetFullNameComponents(pnprefix, pnbase, pnsuffix, configName);
const char* version = target.GetProperty("VERSION"); const char* version = target.GetProperty("VERSION");
const char* soversion = target.GetProperty("SOVERSION"); const char* soversion = target.GetProperty("SOVERSION");
if(!target.HasSOName(configName) || target.IsFrameworkOnApple()) if(!gtgt->HasSOName(configName) || target.IsFrameworkOnApple())
{ {
version = 0; version = 0;
soversion = 0; soversion = 0;
@ -2202,7 +2203,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
} }
} }
// Add framework search paths needed for linking. // Add framework search paths needed for linking.
if(cmComputeLinkInformation* cli = target.GetLinkInformation(configName)) if(cmComputeLinkInformation* cli = gtgt->GetLinkInformation(configName))
{ {
std::vector<std::string> const& fwDirs = cli->GetFrameworkPaths(); std::vector<std::string> const& fwDirs = cli->GetFrameworkPaths();
for(std::vector<std::string>::const_iterator fdi = fwDirs.begin(); for(std::vector<std::string>::const_iterator fdi = fwDirs.begin();
@ -2331,7 +2332,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
if(target.GetType() == cmTarget::SHARED_LIBRARY) if(target.GetType() == cmTarget::SHARED_LIBRARY)
{ {
// Get the install_name directory for the build tree. // Get the install_name directory for the build tree.
install_name_dir = target.GetInstallNameDirForBuildTree(configName); install_name_dir = gtgt->GetInstallNameDirForBuildTree(configName);
// Xcode doesn't create the correct install_name in some cases. // Xcode doesn't create the correct install_name in some cases.
// That is, if the INSTALL_PATH is empty, or if we have versioning // That is, if the INSTALL_PATH is empty, or if we have versioning
// of dylib libraries, we want to specify the install_name. // of dylib libraries, we want to specify the install_name.
@ -2345,7 +2346,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
install_name += install_name_dir; install_name += install_name_dir;
install_name += "/"; install_name += "/";
} }
install_name += target.GetSOName(configName); install_name += gtgt->GetSOName(configName);
if((realName != soName) || install_name_dir.empty()) if((realName != soName) || install_name_dir.empty())
{ {
@ -2358,7 +2359,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CreateString(install_name_dir.c_str())); this->CreateString(install_name_dir.c_str()));
// Create the LD_RUNPATH_SEARCH_PATHS // Create the LD_RUNPATH_SEARCH_PATHS
cmComputeLinkInformation* pcli = target.GetLinkInformation(configName); cmComputeLinkInformation* pcli = gtgt->GetLinkInformation(configName);
if(pcli) if(pcli)
{ {
std::string search_paths; std::string search_paths;
@ -2742,7 +2743,8 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
} }
else else
{ {
fullName = cmtarget.GetFullName(defConfig.c_str()); cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&cmtarget);
fullName = gtgt->GetFullName(defConfig.c_str());
} }
fileRef->AddAttribute("path", this->CreateString(fullName.c_str())); fileRef->AddAttribute("path", this->CreateString(fullName.c_str()));
fileRef->AddAttribute("refType", this->CreateString("0")); fileRef->AddAttribute("refType", this->CreateString("0"));
@ -2964,7 +2966,8 @@ void cmGlobalXCodeGenerator
} }
// Compute the link library and directory information. // Compute the link library and directory information.
cmComputeLinkInformation* pcli = cmtarget->GetLinkInformation(configName); cmGeneratorTarget* gtgt = this->GetGeneratorTarget(cmtarget);
cmComputeLinkInformation* pcli = gtgt->GetLinkInformation(configName);
if(!pcli) if(!pcli)
{ {
continue; continue;
@ -3687,7 +3690,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
std::string universalFile = universal; std::string universalFile = universal;
universalFile += *arch; universalFile += *arch;
universalFile += "/"; universalFile += "/";
universalFile += t->GetFullName(configName); universalFile += gt->GetFullName(configName);
makefileStream << "\t/bin/rm -f " makefileStream << "\t/bin/rm -f "
<< <<
this->ConvertToRelativeForMake(universalFile.c_str()) this->ConvertToRelativeForMake(universalFile.c_str())

View File

@ -18,6 +18,7 @@
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmGeneratorTarget.h" #include "cmGeneratorTarget.h"
#include "cmake.h" #include "cmake.h"
#include "cmGeneratorTarget.h"
#include <assert.h> #include <assert.h>
@ -72,7 +73,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
{ {
// Compute the build tree directory from which to copy the target. // Compute the build tree directory from which to copy the target.
std::string fromDirConfig; std::string fromDirConfig;
if(this->Target->Target->NeedRelinkBeforeInstall(config)) if(this->Target->NeedRelinkBeforeInstall(config))
{ {
fromDirConfig = fromDirConfig =
this->Target->Target->GetMakefile()->GetCurrentBinaryDirectory(); this->Target->Target->GetMakefile()->GetCurrentBinaryDirectory();
@ -124,7 +125,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
std::string targetNameReal; std::string targetNameReal;
std::string targetNameImport; std::string targetNameImport;
std::string targetNamePDB; std::string targetNamePDB;
this->Target->Target->GetExecutableNames(targetName, targetNameReal, this->Target->GetExecutableNames(targetName, targetNameReal,
targetNameImport, targetNamePDB, targetNameImport, targetNamePDB,
config); config);
if(this->ImportLibrary) if(this->ImportLibrary)
@ -184,7 +185,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
std::string targetNameReal; std::string targetNameReal;
std::string targetNameImport; std::string targetNameImport;
std::string targetNamePDB; std::string targetNamePDB;
this->Target->Target->GetLibraryNames(targetName, targetNameSO, this->Target->GetLibraryNames(targetName, targetNameSO,
targetNameReal, targetNameReal,
targetNameImport, targetNamePDB, targetNameImport, targetNamePDB,
config); config);
@ -371,13 +372,16 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
{ {
std::string fname; std::string fname;
// Compute the name of the library. // Compute the name of the library.
cmGeneratorTarget *gtgt = target->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(target);
if(target->GetType() == cmTarget::EXECUTABLE) if(target->GetType() == cmTarget::EXECUTABLE)
{ {
std::string targetName; std::string targetName;
std::string targetNameReal; std::string targetNameReal;
std::string targetNameImport; std::string targetNameImport;
std::string targetNamePDB; std::string targetNamePDB;
target->GetExecutableNames(targetName, targetNameReal, gtgt->GetExecutableNames(targetName, targetNameReal,
targetNameImport, targetNamePDB, targetNameImport, targetNamePDB,
config); config);
if(nameType == NameImplib) if(nameType == NameImplib)
@ -407,7 +411,7 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
std::string targetNameReal; std::string targetNameReal;
std::string targetNameImport; std::string targetNameImport;
std::string targetNamePDB; std::string targetNamePDB;
target->GetLibraryNames(targetName, targetNameSO, targetNameReal, gtgt->GetLibraryNames(targetName, targetNameSO, targetNameReal,
targetNameImport, targetNamePDB, config); targetNameImport, targetNamePDB, config);
if(nameType == NameImplib) if(nameType == NameImplib)
{ {
@ -557,8 +561,7 @@ cmInstallTargetGenerator
// Build a map of build-tree install_name to install-tree install_name for // Build a map of build-tree install_name to install-tree install_name for
// shared libraries linked to this target. // shared libraries linked to this target.
std::map<std::string, std::string> install_name_remap; std::map<std::string, std::string> install_name_remap;
if(cmComputeLinkInformation* cli = if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config))
this->Target->Target->GetLinkInformation(config))
{ {
std::set<cmTarget const*> const& sharedLibs std::set<cmTarget const*> const& sharedLibs
= cli->GetSharedLibrariesLinked(); = cli->GetSharedLibrariesLinked();
@ -573,11 +576,14 @@ cmInstallTargetGenerator
continue; continue;
} }
cmGeneratorTarget *gtgt = tgt->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(tgt);
// If the build tree and install tree use different path // If the build tree and install tree use different path
// components of the install_name field then we need to create a // components of the install_name field then we need to create a
// mapping to be applied after installation. // mapping to be applied after installation.
std::string for_build = tgt->GetInstallNameDirForBuildTree(config); std::string for_build = gtgt->GetInstallNameDirForBuildTree(config);
std::string for_install = tgt->GetInstallNameDirForInstallTree(); std::string for_install = gtgt->GetInstallNameDirForInstallTree();
if(for_build != for_install) if(for_build != for_install)
{ {
// The directory portions differ. Append the filename to // The directory portions differ. Append the filename to
@ -602,9 +608,9 @@ cmInstallTargetGenerator
if(this->Target->GetType() == cmTarget::SHARED_LIBRARY) if(this->Target->GetType() == cmTarget::SHARED_LIBRARY)
{ {
std::string for_build = std::string for_build =
this->Target->Target->GetInstallNameDirForBuildTree(config); this->Target->GetInstallNameDirForBuildTree(config);
std::string for_install = std::string for_install =
this->Target->Target->GetInstallNameDirForInstallTree(); this->Target->GetInstallNameDirForInstallTree();
if(this->Target->Target->IsFrameworkOnApple() && for_install.empty()) if(this->Target->Target->IsFrameworkOnApple() && for_install.empty())
{ {
@ -653,11 +659,10 @@ cmInstallTargetGenerator
std::string const& toDestDirPath) std::string const& toDestDirPath)
{ {
// Skip the chrpath if the target does not need it. // Skip the chrpath if the target does not need it.
if(this->ImportLibrary || !this->Target->Target->IsChrpathUsed(config)) if(this->ImportLibrary || !this->Target->IsChrpathUsed(config))
{ {
return; return;
} }
// Skip if on Apple // Skip if on Apple
if(this->Target->Target->GetMakefile() if(this->Target->Target->GetMakefile()
->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) ->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
@ -667,8 +672,7 @@ cmInstallTargetGenerator
// Get the link information for this target. // Get the link information for this target.
// It can provide the RPATH. // It can provide the RPATH.
cmComputeLinkInformation* cli = cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config);
this->Target->Target->GetLinkInformation(config);
if(!cli) if(!cli)
{ {
return; return;
@ -693,15 +697,14 @@ cmInstallTargetGenerator
std::string const& toDestDirPath) std::string const& toDestDirPath)
{ {
// Skip the chrpath if the target does not need it. // Skip the chrpath if the target does not need it.
if(this->ImportLibrary || !this->Target->Target->IsChrpathUsed(config)) if(this->ImportLibrary || !this->Target->IsChrpathUsed(config))
{ {
return; return;
} }
// Get the link information for this target. // Get the link information for this target.
// It can provide the RPATH. // It can provide the RPATH.
cmComputeLinkInformation* cli = cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config);
this->Target->Target->GetLinkInformation(config);
if(!cli) if(!cli)
{ {
return; return;

View File

@ -1401,7 +1401,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
linkFlags += this->Makefile->GetSafeDefinition(build); linkFlags += this->Makefile->GetSafeDefinition(build);
linkFlags += " "; linkFlags += " ";
} }
std::string linkLanguage = target->Target->GetLinkerLanguage(buildType); std::string linkLanguage = target->GetLinkerLanguage(buildType);
if(linkLanguage.empty()) if(linkLanguage.empty())
{ {
cmSystemTools::Error cmSystemTools::Error
@ -1516,7 +1516,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
bool escapeAllowMakeVars = !forResponseFile; bool escapeAllowMakeVars = !forResponseFile;
std::ostringstream fout; std::ostringstream fout;
std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
cmComputeLinkInformation* pcli = tgt.Target->GetLinkInformation(config); cmComputeLinkInformation* pcli = tgt.GetLinkInformation(config);
if(!pcli) if(!pcli)
{ {
return; return;
@ -2107,7 +2107,9 @@ void cmLocalGenerator::AddCMP0018Flags(std::string &flags,
return; return;
} }
if (target->GetLinkInterfaceDependentBoolProperty( cmGeneratorTarget* gtgt =
this->GlobalGenerator->GetGeneratorTarget(target);
if (gtgt->GetLinkInterfaceDependentBoolProperty(
"POSITION_INDEPENDENT_CODE", "POSITION_INDEPENDENT_CODE",
config)) config))
{ {

View File

@ -486,8 +486,7 @@ void cmLocalUnixMakefileGenerator3
// Add a local name for the rule to relink the target before // Add a local name for the rule to relink the target before
// installation. // installation.
if(t->second->Target if(t->second->NeedRelinkBeforeInstall(this->ConfigName))
->NeedRelinkBeforeInstall(this->ConfigName))
{ {
makeTargetName = this->GetRelativeTargetDirectory(*t->second->Target); makeTargetName = this->GetRelativeTargetDirectory(*t->second->Target);
makeTargetName += "/preinstall"; makeTargetName += "/preinstall";

View File

@ -1115,10 +1115,12 @@ void cmLocalVisualStudio6Generator
cmTarget* tgt = this->GlobalGenerator->FindTarget(j->first.c_str()); cmTarget* tgt = this->GlobalGenerator->FindTarget(j->first.c_str());
if(tgt) if(tgt)
{ {
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(tgt);
lib = cmSystemTools::GetFilenameWithoutExtension lib = cmSystemTools::GetFilenameWithoutExtension
(tgt->GetFullName().c_str()); (gt->GetFullName().c_str());
libDebug = cmSystemTools::GetFilenameWithoutExtension libDebug = cmSystemTools::GetFilenameWithoutExtension
(tgt->GetFullName("Debug").c_str()); (gt->GetFullName("Debug").c_str());
lib += ".lib"; lib += ".lib";
libDebug += ".lib"; libDebug += ".lib";
} }
@ -1258,8 +1260,8 @@ void cmLocalVisualStudio6Generator
extraLinkOptionsRelWithDebInfo += targetLinkFlags; extraLinkOptionsRelWithDebInfo += targetLinkFlags;
} }
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
// Get standard libraries for this language. // Get standard libraries for this language.
if(targetBuilds) if(targetBuilds)
@ -1268,10 +1270,10 @@ void cmLocalVisualStudio6Generator
std::vector<std::string> configs; std::vector<std::string> configs;
target.GetMakefile()->GetConfigurations(configs); target.GetMakefile()->GetConfigurations(configs);
std::vector<std::string>::const_iterator it = configs.begin(); std::vector<std::string>::const_iterator it = configs.begin();
const std::string& linkLanguage = target.GetLinkerLanguage(*it); const std::string& linkLanguage = gt->GetLinkerLanguage(*it);
for ( ; it != configs.end(); ++it) for ( ; it != configs.end(); ++it)
{ {
const std::string& configLinkLanguage = target.GetLinkerLanguage(*it); const std::string& configLinkLanguage = gt->GetLinkerLanguage(*it);
if (configLinkLanguage != linkLanguage) if (configLinkLanguage != linkLanguage)
{ {
cmSystemTools::Error cmSystemTools::Error
@ -1328,11 +1330,11 @@ void cmLocalVisualStudio6Generator
target.GetType() == cmTarget::SHARED_LIBRARY || target.GetType() == cmTarget::SHARED_LIBRARY ||
target.GetType() == cmTarget::MODULE_LIBRARY) target.GetType() == cmTarget::MODULE_LIBRARY)
{ {
outputName = target.GetFullName(); outputName = gt->GetFullName();
outputNameDebug = target.GetFullName("Debug"); outputNameDebug = gt->GetFullName("Debug");
outputNameRelease = target.GetFullName("Release"); outputNameRelease = gt->GetFullName("Release");
outputNameMinSizeRel = target.GetFullName("MinSizeRel"); outputNameMinSizeRel = gt->GetFullName("MinSizeRel");
outputNameRelWithDebInfo = target.GetFullName("RelWithDebInfo"); outputNameRelWithDebInfo = gt->GetFullName("RelWithDebInfo");
} }
else if(target.GetType() == cmTarget::OBJECT_LIBRARY) else if(target.GetType() == cmTarget::OBJECT_LIBRARY)
{ {
@ -1429,10 +1431,10 @@ void cmLocalVisualStudio6Generator
fullPathImpRelease += "/"; fullPathImpRelease += "/";
fullPathImpMinSizeRel += "/"; fullPathImpMinSizeRel += "/";
fullPathImpRelWithDebInfo += "/"; fullPathImpRelWithDebInfo += "/";
fullPathImpDebug += target.GetFullName("Debug", true); fullPathImpDebug += gt->GetFullName("Debug", true);
fullPathImpRelease += target.GetFullName("Release", true); fullPathImpRelease += gt->GetFullName("Release", true);
fullPathImpMinSizeRel += target.GetFullName("MinSizeRel", true); fullPathImpMinSizeRel += gt->GetFullName("MinSizeRel", true);
fullPathImpRelWithDebInfo += target.GetFullName("RelWithDebInfo", true); fullPathImpRelWithDebInfo += gt->GetFullName("RelWithDebInfo", true);
targetImplibFlagDebug = "/implib:"; targetImplibFlagDebug = "/implib:";
targetImplibFlagRelease = "/implib:"; targetImplibFlagRelease = "/implib:";
@ -1701,10 +1703,10 @@ void cmLocalVisualStudio6Generator
std::vector<std::string> configs; std::vector<std::string> configs;
target.GetMakefile()->GetConfigurations(configs); target.GetMakefile()->GetConfigurations(configs);
std::vector<std::string>::const_iterator it = configs.begin(); std::vector<std::string>::const_iterator it = configs.begin();
const std::string& linkLanguage = target.GetLinkerLanguage(*it); const std::string& linkLanguage = gt->GetLinkerLanguage(*it);
for ( ; it != configs.end(); ++it) for ( ; it != configs.end(); ++it)
{ {
const std::string& configLinkLanguage = target.GetLinkerLanguage(*it); const std::string& configLinkLanguage = gt->GetLinkerLanguage(*it);
if (configLinkLanguage != linkLanguage) if (configLinkLanguage != linkLanguage)
{ {
cmSystemTools::Error cmSystemTools::Error
@ -1846,8 +1848,10 @@ void cmLocalVisualStudio6Generator
const std::string extraOptions, const std::string extraOptions,
std::string& options) std::string& options)
{ {
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
// Compute the link information for this configuration. // Compute the link information for this configuration.
cmComputeLinkInformation* pcli = target.GetLinkInformation(configName); cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName);
if(!pcli) if(!pcli)
{ {
return; return;

View File

@ -664,6 +664,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
const char* configType = "10"; const char* configType = "10";
const char* projectType = 0; const char* projectType = 0;
bool targetBuilds = true; bool targetBuilds = true;
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
switch(target.GetType()) switch(target.GetType())
{ {
case cmTarget::OBJECT_LIBRARY: case cmTarget::OBJECT_LIBRARY:
@ -696,7 +700,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
{ {
const std::string& linkLanguage = (this->FortranProject? const std::string& linkLanguage = (this->FortranProject?
std::string("Fortran"): std::string("Fortran"):
target.GetLinkerLanguage(configName)); gt->GetLinkerLanguage(configName));
if(linkLanguage.empty()) if(linkLanguage.empty())
{ {
cmSystemTools::Error cmSystemTools::Error
@ -758,8 +762,6 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.Parse(flags.c_str()); targetOptions.Parse(flags.c_str());
targetOptions.Parse(defineFlags.c_str()); targetOptions.Parse(defineFlags.c_str());
targetOptions.ParseFinish(); targetOptions.ParseFinish();
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
std::vector<std::string> targetDefines; std::vector<std::string> targetDefines;
target.GetCompileDefinitions(targetDefines, configName, "CXX"); target.GetCompileDefinitions(targetDefines, configName, "CXX");
targetOptions.AddDefines(targetDefines); targetOptions.AddDefines(targetDefines);
@ -803,7 +805,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
if (this->FortranProject) if (this->FortranProject)
{ {
// Intel Fortran >= 15.0 uses TargetName property. // Intel Fortran >= 15.0 uses TargetName property.
std::string targetNameFull = target.GetFullName(configName); std::string targetNameFull = gt->GetFullName(configName);
std::string targetName = std::string targetName =
cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull); cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull);
std::string targetExt = std::string targetExt =
@ -881,7 +883,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
if(target.GetType() <= cmTarget::OBJECT_LIBRARY) if(target.GetType() <= cmTarget::OBJECT_LIBRARY)
{ {
// Specify the compiler program database file if configured. // Specify the compiler program database file if configured.
std::string pdb = target.GetCompilePDBPath(configName); std::string pdb = gt->GetCompilePDBPath(configName);
if(!pdb.empty()) if(!pdb.empty())
{ {
fout << "\t\t\t\tProgramDataBaseFileName=\"" fout << "\t\t\t\tProgramDataBaseFileName=\""
@ -1074,6 +1076,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
this->ConvertToOutputFormat(this->ModuleDefinitionFile, SHELL); this->ConvertToOutputFormat(this->ModuleDefinitionFile, SHELL);
linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str()); linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str());
} }
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
if (target.GetType() == cmTarget::SHARED_LIBRARY && if (target.GetType() == cmTarget::SHARED_LIBRARY &&
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
{ {
@ -1104,7 +1109,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
} }
case cmTarget::STATIC_LIBRARY: case cmTarget::STATIC_LIBRARY:
{ {
std::string targetNameFull = target.GetFullName(configName); std::string targetNameFull = gt->GetFullName(configName);
std::string libpath = target.GetDirectory(configName); std::string libpath = target.GetDirectory(configName);
libpath += "/"; libpath += "/";
libpath += targetNameFull; libpath += targetNameFull;
@ -1144,11 +1149,11 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
std::string targetNameFull; std::string targetNameFull;
std::string targetNameImport; std::string targetNameImport;
std::string targetNamePDB; std::string targetNamePDB;
target.GetLibraryNames(targetName, targetNameSO, targetNameFull, gt->GetLibraryNames(targetName, targetNameSO, targetNameFull,
targetNameImport, targetNamePDB, configName); targetNameImport, targetNamePDB, configName);
// Compute the link library and directory information. // Compute the link library and directory information.
cmComputeLinkInformation* pcli = target.GetLinkInformation(configName); cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName);
if(!pcli) if(!pcli)
{ {
return; return;
@ -1241,11 +1246,11 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
std::string targetNameFull; std::string targetNameFull;
std::string targetNameImport; std::string targetNameImport;
std::string targetNamePDB; std::string targetNamePDB;
target.GetExecutableNames(targetName, targetNameFull, gt->GetExecutableNames(targetName, targetNameFull,
targetNameImport, targetNamePDB, configName); targetNameImport, targetNamePDB, configName);
// Compute the link library and directory information. // Compute the link library and directory information.
cmComputeLinkInformation* pcli = target.GetLinkInformation(configName); cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName);
if(!pcli) if(!pcli)
{ {
return; return;
@ -1632,7 +1637,7 @@ cmLocalVisualStudio7GeneratorFCInfo
lg->GlobalGenerator->GetLanguageFromExtension lg->GlobalGenerator->GetLanguageFromExtension
(sf.GetExtension().c_str()); (sf.GetExtension().c_str());
const std::string& sourceLang = lg->GetSourceFileLanguage(sf); const std::string& sourceLang = lg->GetSourceFileLanguage(sf);
const std::string& linkLanguage = target.GetLinkerLanguage(i->c_str()); const std::string& linkLanguage = gt->GetLinkerLanguage(i->c_str());
bool needForceLang = false; bool needForceLang = false;
// source file does not match its extension language // source file does not match its extension language
if(lang != sourceLang) if(lang != sourceLang)

View File

@ -25,7 +25,7 @@ cmMakefileExecutableTargetGenerator
cmMakefileTargetGenerator(target) cmMakefileTargetGenerator(target)
{ {
this->CustomCommandDriver = OnDepends; this->CustomCommandDriver = OnDepends;
this->Target->GetExecutableNames( this->GeneratorTarget->GetExecutableNames(
this->TargetNameOut, this->TargetNameReal, this->TargetNameImport, this->TargetNameOut, this->TargetNameReal, this->TargetNameImport,
this->TargetNamePDB, this->ConfigName); this->TargetNamePDB, this->ConfigName);
@ -58,7 +58,7 @@ void cmMakefileExecutableTargetGenerator::WriteRuleFiles()
// write the link rules // write the link rules
this->WriteExecutableRule(false); this->WriteExecutableRule(false);
if(this->Target->NeedRelinkBeforeInstall(this->ConfigName)) if(this->GeneratorTarget->NeedRelinkBeforeInstall(this->ConfigName))
{ {
// Write rules to link an installable version of the target. // Write rules to link an installable version of the target.
this->WriteExecutableRule(true); this->WriteExecutableRule(true);
@ -94,7 +94,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string targetNameReal; std::string targetNameReal;
std::string targetNameImport; std::string targetNameImport;
std::string targetNamePDB; std::string targetNamePDB;
this->Target->GetExecutableNames this->GeneratorTarget->GetExecutableNames
(targetName, targetNameReal, targetNameImport, targetNamePDB, (targetName, targetNameReal, targetNameImport, targetNamePDB,
this->ConfigName); this->ConfigName);
@ -130,7 +130,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
} }
std::string compilePdbOutputPath = std::string compilePdbOutputPath =
this->Target->GetCompilePDBDirectory(this->ConfigName); this->GeneratorTarget->GetCompilePDBDirectory(this->ConfigName);
cmSystemTools::MakeDirectory(compilePdbOutputPath.c_str()); cmSystemTools::MakeDirectory(compilePdbOutputPath.c_str());
std::string pdbOutputPath = this->Target->GetPDBDirectory(this->ConfigName); std::string pdbOutputPath = this->Target->GetPDBDirectory(this->ConfigName);
@ -161,7 +161,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Get the language to use for linking this executable. // Get the language to use for linking this executable.
std::string linkLanguage = std::string linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName); this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
// Make sure we have a link language. // Make sure we have a link language.
if(linkLanguage.empty()) if(linkLanguage.empty())

View File

@ -28,7 +28,7 @@ cmMakefileLibraryTargetGenerator
this->CustomCommandDriver = OnDepends; this->CustomCommandDriver = OnDepends;
if (this->Target->GetType() != cmTarget::INTERFACE_LIBRARY) if (this->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
{ {
this->Target->GetLibraryNames( this->GeneratorTarget->GetLibraryNames(
this->TargetNameOut, this->TargetNameSO, this->TargetNameReal, this->TargetNameOut, this->TargetNameSO, this->TargetNameReal,
this->TargetNameImport, this->TargetNamePDB, this->ConfigName); this->TargetNameImport, this->TargetNamePDB, this->ConfigName);
} }
@ -69,7 +69,7 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
break; break;
case cmTarget::SHARED_LIBRARY: case cmTarget::SHARED_LIBRARY:
this->WriteSharedLibraryRules(false); this->WriteSharedLibraryRules(false);
if(this->Target->NeedRelinkBeforeInstall(this->ConfigName)) if(this->GeneratorTarget->NeedRelinkBeforeInstall(this->ConfigName))
{ {
// Write rules to link an installable version of the target. // Write rules to link an installable version of the target.
this->WriteSharedLibraryRules(true); this->WriteSharedLibraryRules(true);
@ -77,7 +77,7 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
break; break;
case cmTarget::MODULE_LIBRARY: case cmTarget::MODULE_LIBRARY:
this->WriteModuleLibraryRules(false); this->WriteModuleLibraryRules(false);
if(this->Target->NeedRelinkBeforeInstall(this->ConfigName)) if(this->GeneratorTarget->NeedRelinkBeforeInstall(this->ConfigName))
{ {
// Write rules to link an installable version of the target. // Write rules to link an installable version of the target.
this->WriteModuleLibraryRules(true); this->WriteModuleLibraryRules(true);
@ -133,7 +133,7 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
{ {
std::string linkLanguage = std::string linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName); this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_"; std::string linkRuleVar = "CMAKE_";
linkRuleVar += linkLanguage; linkRuleVar += linkLanguage;
linkRuleVar += "_CREATE_STATIC_LIBRARY"; linkRuleVar += "_CREATE_STATIC_LIBRARY";
@ -159,7 +159,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
return; return;
} }
std::string linkLanguage = std::string linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName); this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_"; std::string linkRuleVar = "CMAKE_";
linkRuleVar += linkLanguage; linkRuleVar += linkLanguage;
linkRuleVar += "_CREATE_SHARED_LIBRARY"; linkRuleVar += "_CREATE_SHARED_LIBRARY";
@ -183,7 +183,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
{ {
std::string linkLanguage = std::string linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName); this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_"; std::string linkRuleVar = "CMAKE_";
linkRuleVar += linkLanguage; linkRuleVar += linkLanguage;
linkRuleVar += "_CREATE_SHARED_MODULE"; linkRuleVar += "_CREATE_SHARED_MODULE";
@ -206,7 +206,7 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink) void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink)
{ {
std::string linkLanguage = std::string linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName); this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_"; std::string linkRuleVar = "CMAKE_";
linkRuleVar += linkLanguage; linkRuleVar += linkLanguage;
linkRuleVar += "_CREATE_MACOSX_FRAMEWORK"; linkRuleVar += "_CREATE_MACOSX_FRAMEWORK";
@ -238,7 +238,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
// Get the language to use for linking this library. // Get the language to use for linking this library.
std::string linkLanguage = std::string linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName); this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
// Make sure we have a link language. // Make sure we have a link language.
if(linkLanguage.empty()) if(linkLanguage.empty())
@ -266,7 +266,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std::string targetNameReal; std::string targetNameReal;
std::string targetNameImport; std::string targetNameImport;
std::string targetNamePDB; std::string targetNamePDB;
this->Target->GetLibraryNames( this->GeneratorTarget->GetLibraryNames(
targetName, targetNameSO, targetNameReal, targetNameImport, targetNamePDB, targetName, targetNameSO, targetNameReal, targetNameImport, targetNamePDB,
this->ConfigName); this->ConfigName);
@ -311,7 +311,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
} }
std::string compilePdbOutputPath = std::string compilePdbOutputPath =
this->Target->GetCompilePDBDirectory(this->ConfigName); this->GeneratorTarget->GetCompilePDBDirectory(this->ConfigName);
cmSystemTools::MakeDirectory(compilePdbOutputPath.c_str()); cmSystemTools::MakeDirectory(compilePdbOutputPath.c_str());
std::string pdbOutputPath = this->Target->GetPDBDirectory(this->ConfigName); std::string pdbOutputPath = this->Target->GetPDBDirectory(this->ConfigName);
@ -653,7 +653,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
vars.Target = target.c_str(); vars.Target = target.c_str();
vars.LinkLibraries = linkLibs.c_str(); vars.LinkLibraries = linkLibs.c_str();
vars.ObjectsQuoted = buildObjs.c_str(); vars.ObjectsQuoted = buildObjs.c_str();
if (this->Target->HasSOName(this->ConfigName)) if (this->GeneratorTarget->HasSOName(this->ConfigName))
{ {
vars.SONameFlag = this->Makefile->GetSONameFlag(linkLanguage); vars.SONameFlag = this->Makefile->GetSONameFlag(linkLanguage);
vars.TargetSOName= targetNameSO.c_str(); vars.TargetSOName= targetNameSO.c_str();
@ -666,7 +666,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
{ {
// Get the install_name directory for the build tree. // Get the install_name directory for the build tree.
install_name_dir = install_name_dir =
this->Target->GetInstallNameDirForBuildTree(this->ConfigName); this->GeneratorTarget->GetInstallNameDirForBuildTree(this->ConfigName);
// Set the rule variable replacement value. // Set the rule variable replacement value.
if(install_name_dir.empty()) if(install_name_dir.empty())

View File

@ -313,7 +313,7 @@ cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()
(cmSourceFile const& source, const char* pkgloc) (cmSourceFile const& source, const char* pkgloc)
{ {
// Skip OS X content when not building a Framework or Bundle. // Skip OS X content when not building a Framework or Bundle.
if(!this->Generator->GetTarget()->IsBundleOnApple()) if(!this->Generator->GetGeneratorTarget()->IsBundleOnApple())
{ {
return; return;
} }
@ -548,12 +548,12 @@ cmMakefileTargetGenerator
this->GeneratorTarget->GetFullPath(this->ConfigName, false, true); this->GeneratorTarget->GetFullPath(this->ConfigName, false, true);
targetFullPathPDB = this->Target->GetPDBDirectory(this->ConfigName); targetFullPathPDB = this->Target->GetPDBDirectory(this->ConfigName);
targetFullPathPDB += "/"; targetFullPathPDB += "/";
targetFullPathPDB += this->Target->GetPDBName(this->ConfigName); targetFullPathPDB += this->GeneratorTarget->GetPDBName(this->ConfigName);
} }
if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY) if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY)
{ {
targetFullPathCompilePDB = targetFullPathCompilePDB =
this->Target->GetCompilePDBPath(this->ConfigName); this->GeneratorTarget->GetCompilePDBPath(this->ConfigName);
if(targetFullPathCompilePDB.empty()) if(targetFullPathCompilePDB.empty())
{ {
targetFullPathCompilePDB = this->Target->GetSupportDirectory() + "/"; targetFullPathCompilePDB = this->Target->GetSupportDirectory() + "/";
@ -1446,7 +1446,8 @@ void cmMakefileTargetGenerator
// Loop over all library dependencies. // Loop over all library dependencies.
const char* cfg = this->LocalGenerator->GetConfigName().c_str(); const char* cfg = this->LocalGenerator->GetConfigName().c_str();
if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) if(cmComputeLinkInformation* cli =
this->GeneratorTarget->GetLinkInformation(cfg))
{ {
std::vector<std::string> const& libDeps = cli->GetDepends(); std::vector<std::string> const& libDeps = cli->GetDepends();
depends.insert(depends.end(), libDeps.begin(), libDeps.end()); depends.insert(depends.end(), libDeps.begin(), libDeps.end());
@ -1508,7 +1509,7 @@ std::string cmMakefileTargetGenerator::GetLinkRule(
if(this->Target->HasImplibGNUtoMS()) if(this->Target->HasImplibGNUtoMS())
{ {
std::string ruleVar = "CMAKE_"; std::string ruleVar = "CMAKE_";
ruleVar += this->Target->GetLinkerLanguage(this->ConfigName); ruleVar += this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
ruleVar += "_GNUtoMS_RULE"; ruleVar += "_GNUtoMS_RULE";
if(const char* rule = this->Makefile->GetDefinition(ruleVar)) if(const char* rule = this->Makefile->GetDefinition(ruleVar))
{ {
@ -1662,7 +1663,8 @@ cmMakefileTargetGenerator
{ {
// Lookup the response file reference flag. // Lookup the response file reference flag.
std::string responseFlagVar = "CMAKE_"; std::string responseFlagVar = "CMAKE_";
responseFlagVar += this->Target->GetLinkerLanguage(this->ConfigName); responseFlagVar += this->GeneratorTarget
->GetLinkerLanguage(this->ConfigName);
responseFlagVar += "_RESPONSE_FILE_LINK_FLAG"; responseFlagVar += "_RESPONSE_FILE_LINK_FLAG";
const char* responseFlag = const char* responseFlag =
this->Makefile->GetDefinition(responseFlagVar); this->Makefile->GetDefinition(responseFlagVar);
@ -1706,7 +1708,8 @@ cmMakefileTargetGenerator
// Lookup the response file reference flag. // Lookup the response file reference flag.
std::string responseFlagVar = "CMAKE_"; std::string responseFlagVar = "CMAKE_";
responseFlagVar += this->Target->GetLinkerLanguage(this->ConfigName); responseFlagVar += this->GeneratorTarget
->GetLinkerLanguage(this->ConfigName);
responseFlagVar += "_RESPONSE_FILE_LINK_FLAG"; responseFlagVar += "_RESPONSE_FILE_LINK_FLAG";
const char* responseFlag = const char* responseFlag =
this->Makefile->GetDefinition(responseFlagVar); this->Makefile->GetDefinition(responseFlagVar);

View File

@ -53,6 +53,7 @@ public:
{ return this->ProgressFileNameFull; } { return this->ProgressFileNameFull; }
cmTarget* GetTarget() { return this->Target;} cmTarget* GetTarget() { return this->Target;}
cmGeneratorTarget* GetGeneratorTarget() { return this->GeneratorTarget;}
protected: protected:

View File

@ -40,16 +40,15 @@ cmNinjaNormalTargetGenerator(cmGeneratorTarget* target)
, TargetNamePDB() , TargetNamePDB()
, TargetLinkLanguage("") , TargetLinkLanguage("")
{ {
this->TargetLinkLanguage = target->Target this->TargetLinkLanguage = target->GetLinkerLanguage(this->GetConfigName());
->GetLinkerLanguage(this->GetConfigName());
if (target->GetType() == cmTarget::EXECUTABLE) if (target->GetType() == cmTarget::EXECUTABLE)
target->Target->GetExecutableNames(this->TargetNameOut, this->GetGeneratorTarget()->GetExecutableNames(this->TargetNameOut,
this->TargetNameReal, this->TargetNameReal,
this->TargetNameImport, this->TargetNameImport,
this->TargetNamePDB, this->TargetNamePDB,
GetLocalGenerator()->GetConfigName()); GetLocalGenerator()->GetConfigName());
else else
target->Target->GetLibraryNames(this->TargetNameOut, this->GetGeneratorTarget()->GetLibraryNames(this->TargetNameOut,
this->TargetNameSO, this->TargetNameSO,
this->TargetNameReal, this->TargetNameReal,
this->TargetNameImport, this->TargetNameImport,
@ -531,13 +530,14 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
vars["LANGUAGE_COMPILE_FLAGS"] = t; vars["LANGUAGE_COMPILE_FLAGS"] = t;
} }
if (target.HasSOName(cfgName)) if (this->GetGeneratorTarget()->HasSOName(cfgName))
{ {
vars["SONAME_FLAG"] = mf->GetSONameFlag(this->TargetLinkLanguage); vars["SONAME_FLAG"] = mf->GetSONameFlag(this->TargetLinkLanguage);
vars["SONAME"] = this->TargetNameSO; vars["SONAME"] = this->TargetNameSO;
if (targetType == cmTarget::SHARED_LIBRARY) if (targetType == cmTarget::SHARED_LIBRARY)
{ {
std::string install_dir = target.GetInstallNameDirForBuildTree(cfgName); std::string install_dir =
this->GetGeneratorTarget()->GetInstallNameDirForBuildTree(cfgName);
if (!install_dir.empty()) if (!install_dir.empty())
{ {
vars["INSTALLNAME_DIR"] = localGen.Convert(install_dir, vars["INSTALLNAME_DIR"] = localGen.Convert(install_dir,
@ -569,7 +569,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
std::string prefix; std::string prefix;
std::string base; std::string base;
std::string suffix; std::string suffix;
target.GetFullNameComponents(prefix, base, suffix); this->GetGeneratorTarget()->GetFullNameComponents(prefix, base, suffix);
std::string dbg_suffix = ".dbg"; std::string dbg_suffix = ".dbg";
// TODO: Where to document? // TODO: Where to document?
if (mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX")) if (mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX"))

View File

@ -195,7 +195,7 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
return cmNinjaDeps(); return cmNinjaDeps();
cmComputeLinkInformation* cli = cmComputeLinkInformation* cli =
this->Target->GetLinkInformation(this->GetConfigName()); this->GeneratorTarget->GetLinkInformation(this->GetConfigName());
if(!cli) if(!cli)
return cmNinjaDeps(); return cmNinjaDeps();
@ -273,11 +273,12 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const
{ {
pdbPath = this->Target->GetPDBDirectory(this->GetConfigName()); pdbPath = this->Target->GetPDBDirectory(this->GetConfigName());
pdbPath += "/"; pdbPath += "/";
pdbPath += this->Target->GetPDBName(this->GetConfigName()); pdbPath += this->GeneratorTarget->GetPDBName(this->GetConfigName());
} }
if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY) if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY)
{ {
compilePdbPath = this->Target->GetCompilePDBPath(this->GetConfigName()); compilePdbPath =
this->GeneratorTarget->GetCompilePDBPath(this->GetConfigName());
if(compilePdbPath.empty()) if(compilePdbPath.empty())
{ {
compilePdbPath = this->Target->GetSupportDirectory() + "/"; compilePdbPath = this->Target->GetSupportDirectory() + "/";
@ -741,7 +742,7 @@ cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()(
cmSourceFile const& source, const char* pkgloc) cmSourceFile const& source, const char* pkgloc)
{ {
// Skip OS X content when not building a Framework or Bundle. // Skip OS X content when not building a Framework or Bundle.
if(!this->Generator->GetTarget()->IsBundleOnApple()) if(!this->Generator->GetGeneratorTarget()->IsBundleOnApple())
{ {
return; return;
} }

View File

@ -47,7 +47,7 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
// Compute bundle directory names. // Compute bundle directory names.
std::string out = outpath; std::string out = outpath;
out += "/"; out += "/";
out += this->GT->Target->GetAppBundleDirectory(this->ConfigName, false); out += this->GT->GetAppBundleDirectory(this->ConfigName, false);
cmSystemTools::MakeDirectory(out.c_str()); cmSystemTools::MakeDirectory(out.c_str());
this->Makefile->AddCMakeOutputFile(out); this->Makefile->AddCMakeOutputFile(out);
@ -57,7 +57,7 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
// to be set. // to be set.
std::string plist = outpath; std::string plist = outpath;
plist += "/"; plist += "/";
plist += this->GT->Target->GetAppBundleDirectory(this->ConfigName, true); plist += this->GT->GetAppBundleDirectory(this->ConfigName, true);
plist += "/Info.plist"; plist += "/Info.plist";
this->LocalGenerator->GenerateAppleInfoPList(this->GT->Target, this->LocalGenerator->GenerateAppleInfoPList(this->GT->Target,
targetName, targetName,
@ -77,11 +77,11 @@ void cmOSXBundleGenerator::CreateFramework(
// Compute the location of the top-level foo.framework directory. // Compute the location of the top-level foo.framework directory.
std::string contentdir = outpath + "/" + std::string contentdir = outpath + "/" +
this->GT->Target->GetFrameworkDirectory(this->ConfigName, true); this->GT->GetFrameworkDirectory(this->ConfigName, true);
contentdir += "/"; contentdir += "/";
std::string newoutpath = outpath + "/" + std::string newoutpath = outpath + "/" +
this->GT->Target->GetFrameworkDirectory(this->ConfigName, false); this->GT->GetFrameworkDirectory(this->ConfigName, false);
std::string frameworkVersion = this->GT->Target->GetFrameworkVersion(); std::string frameworkVersion = this->GT->Target->GetFrameworkVersion();
@ -172,14 +172,14 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName,
// Compute bundle directory names. // Compute bundle directory names.
std::string out = root; std::string out = root;
out += "/"; out += "/";
out += this->GT->Target->GetCFBundleDirectory(this->ConfigName, false); out += this->GT->GetCFBundleDirectory(this->ConfigName, false);
cmSystemTools::MakeDirectory(out.c_str()); cmSystemTools::MakeDirectory(out.c_str());
this->Makefile->AddCMakeOutputFile(out); this->Makefile->AddCMakeOutputFile(out);
// Configure the Info.plist file. Note that it needs the executable name // Configure the Info.plist file. Note that it needs the executable name
// to be set. // to be set.
std::string plist = root + "/" + std::string plist = root + "/" +
this->GT->Target->GetCFBundleDirectory(this->ConfigName, true); this->GT->GetCFBundleDirectory(this->ConfigName, true);
plist += "/Info.plist"; plist += "/Info.plist";
std::string name = cmSystemTools::GetFilenameName(targetName); std::string name = cmSystemTools::GetFilenameName(targetName);
this->LocalGenerator->GenerateAppleInfoPList(this->GT->Target, this->LocalGenerator->GenerateAppleInfoPList(this->GT->Target,
@ -217,7 +217,7 @@ cmOSXBundleGenerator::InitMacOSXContentDirectory(const char* pkgloc)
// Construct the full path to the content subdirectory. // Construct the full path to the content subdirectory.
std::string macdir = std::string macdir =
this->GT->Target->GetMacContentDirectory(this->ConfigName, this->GT->GetMacContentDirectory(this->ConfigName,
/*implib*/ false); /*implib*/ false);
macdir += "/"; macdir += "/";
macdir += pkgloc; macdir += pkgloc;

View File

@ -280,7 +280,7 @@ bool cmOrderDirectoriesConstraintLibrary::FindConflict(std::string const& dir)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmOrderDirectories::cmOrderDirectories(cmGlobalGenerator* gg, cmOrderDirectories::cmOrderDirectories(cmGlobalGenerator* gg,
cmTarget const* target, const cmGeneratorTarget* target,
const char* purpose) const char* purpose)
{ {
this->GlobalGenerator = gg; this->GlobalGenerator = gg;
@ -554,7 +554,8 @@ void cmOrderDirectories::FindImplicitConflicts()
<< text << text
<< "Some of these libraries may not be found correctly."; << "Some of these libraries may not be found correctly.";
this->GlobalGenerator->GetCMakeInstance() this->GlobalGenerator->GetCMakeInstance()
->IssueMessage(cmake::WARNING, w.str(), this->Target->GetBacktrace()); ->IssueMessage(cmake::WARNING, w.str(),
this->Target->Target->GetBacktrace());
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -635,5 +636,6 @@ void cmOrderDirectories::DiagnoseCycle()
} }
e << "Some of these libraries may not be found correctly."; e << "Some of these libraries may not be found correctly.";
this->GlobalGenerator->GetCMakeInstance() this->GlobalGenerator->GetCMakeInstance()
->IssueMessage(cmake::WARNING, e.str(), this->Target->GetBacktrace()); ->IssueMessage(cmake::WARNING, e.str(),
this->Target->Target->GetBacktrace());
} }

View File

@ -19,7 +19,7 @@
class cmGlobalGenerator; class cmGlobalGenerator;
class cmOrderDirectoriesConstraint; class cmOrderDirectoriesConstraint;
class cmOrderDirectoriesConstraintLibrary; class cmOrderDirectoriesConstraintLibrary;
class cmTarget; class cmGeneratorTarget;
/** \class cmOrderDirectories /** \class cmOrderDirectories
* \brief Compute a safe runtime path order for a set of shared libraries. * \brief Compute a safe runtime path order for a set of shared libraries.
@ -27,7 +27,7 @@ class cmTarget;
class cmOrderDirectories class cmOrderDirectories
{ {
public: public:
cmOrderDirectories(cmGlobalGenerator* gg, cmTarget const* target, cmOrderDirectories(cmGlobalGenerator* gg, cmGeneratorTarget const* target,
const char* purpose); const char* purpose);
~cmOrderDirectories(); ~cmOrderDirectories();
void AddRuntimeLibrary(std::string const& fullPath, const char* soname = 0); void AddRuntimeLibrary(std::string const& fullPath, const char* soname = 0);
@ -41,7 +41,7 @@ public:
std::vector<std::string> const& GetOrderedDirectories(); std::vector<std::string> const& GetOrderedDirectories();
private: private:
cmGlobalGenerator* GlobalGenerator; cmGlobalGenerator* GlobalGenerator;
cmTarget const* Target; cmGeneratorTarget const* Target;
std::string Purpose; std::string Purpose;
std::vector<std::string> OrderedDirectories; std::vector<std::string> OrderedDirectories;

View File

@ -547,8 +547,11 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target)
{ {
qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR"); qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR");
} }
cmGeneratorTarget *gtgt = target->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(target);
if (const char *targetQtVersion = if (const char *targetQtVersion =
target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", "")) gtgt->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", ""))
{ {
qtVersion = targetQtVersion; qtVersion = targetQtVersion;
} }
@ -878,8 +881,11 @@ void cmQtAutoGenerators::MergeUicOptions(std::vector<std::string> &opts,
static void GetUicOpts(cmTarget const* target, const std::string& config, static void GetUicOpts(cmTarget const* target, const std::string& config,
std::string &optString) std::string &optString)
{ {
cmGeneratorTarget *gtgt = target->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(target);
std::vector<std::string> opts; std::vector<std::string> opts;
target->GetAutoUicOptions(opts, config); gtgt->GetAutoUicOptions(opts, config);
optString = cmJoin(opts, ";"); optString = cmJoin(opts, ";");
} }
@ -1147,6 +1153,9 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* target) std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* target)
{ {
cmGeneratorTarget *gtgt = target->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(target);
cmMakefile *makefile = target->GetMakefile(); cmMakefile *makefile = target->GetMakefile();
const char *qtVersion = makefile->GetDefinition("_target_qt_version"); const char *qtVersion = makefile->GetDefinition("_target_qt_version");
if (!qtVersion) if (!qtVersion)
@ -1157,8 +1166,7 @@ std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* target)
qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR"); qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR");
} }
if (const char *targetQtVersion = if (const char *targetQtVersion =
target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", gtgt->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", ""))
""))
{ {
qtVersion = targetQtVersion; qtVersion = targetQtVersion;
} }

File diff suppressed because it is too large Load Diff

View File

@ -78,15 +78,6 @@ public:
bool FromGenex; bool FromGenex;
}; };
struct cmTargetLinkInformationMap:
public std::map<std::string, cmComputeLinkInformation*>
{
typedef std::map<std::string, cmComputeLinkInformation*> derived;
cmTargetLinkInformationMap() {}
cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r);
~cmTargetLinkInformationMap();
};
class cmTargetInternals; class cmTargetInternals;
class cmTargetInternalPointer class cmTargetInternalPointer
{ {
@ -302,19 +293,6 @@ public:
cmTarget const* headTarget, cmTarget const* headTarget,
bool usage_requirements_only) const; bool usage_requirements_only) const;
std::vector<cmTarget const*> const&
GetLinkImplementationClosure(const std::string& config) const;
struct CompatibleInterfaces
{
std::set<std::string> PropsBool;
std::set<std::string> PropsString;
std::set<std::string> PropsNumberMax;
std::set<std::string> PropsNumberMin;
};
CompatibleInterfaces const&
GetCompatibleInterfaces(std::string const& config) const;
/** The link implementation specifies the direct library /** The link implementation specifies the direct library
dependencies needed by the object files of the target. */ dependencies needed by the object files of the target. */
struct LinkImplementationLibraries struct LinkImplementationLibraries
@ -337,18 +315,6 @@ public:
LinkImplementationLibraries const* LinkImplementationLibraries const*
GetLinkImplementationLibraries(const std::string& config) const; GetLinkImplementationLibraries(const std::string& config) const;
/** Link information from the transitive closure of the link
implementation and the interfaces of its dependencies. */
struct LinkClosure
{
// The preferred linker language.
std::string LinkerLanguage;
// Languages whose runtime libraries must be linked.
std::vector<std::string> Languages;
};
LinkClosure const* GetLinkClosure(const std::string& config) const;
cmTarget const* FindTargetToLink(std::string const& name) const; cmTarget const* FindTargetToLink(std::string const& name) const;
/** Strip off leading and trailing whitespace from an item named in /** Strip off leading and trailing whitespace from an item named in
@ -368,12 +334,6 @@ public:
pdb output directory is given. */ pdb output directory is given. */
std::string GetPDBDirectory(const std::string& config) const; std::string GetPDBDirectory(const std::string& config) const;
/** Get the directory in which to place the target compiler .pdb file.
If the configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
compiler pdb output directory is given. */
std::string GetCompilePDBDirectory(const std::string& config = "") const;
const char* ImportedGetLocation(const std::string& config) const; const char* ImportedGetLocation(const std::string& config) const;
/** Get the target major and minor version numbers interpreted from /** Get the target major and minor version numbers interpreted from
@ -387,33 +347,6 @@ public:
void void
GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const; GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const;
///! Return the preferred linker language for this target
std::string GetLinkerLanguage(const std::string& config = "") const;
/** Get the full name of the target according to the settings in its
makefile. */
std::string GetFullName(const std::string& config="",
bool implib = false) const;
void GetFullNameComponents(std::string& prefix,
std::string& base, std::string& suffix,
const std::string& config="",
bool implib = false) const;
/** Get the name of the pdb file for the target. */
std::string GetPDBName(const std::string& config) const;
/** Get the name of the compiler pdb file for the target. */
std::string GetCompilePDBName(const std::string& config="") const;
/** Get the path for the MSVC /Fd option for this target. */
std::string GetCompilePDBPath(const std::string& config="") const;
/** Whether this library has soname enabled and platform supports it. */
bool HasSOName(const std::string& config) const;
/** Get the soname of the target. Allowed only for a shared library. */
std::string GetSOName(const std::string& config) const;
/** Whether this library has \@rpath and platform supports it. */ /** Whether this library has \@rpath and platform supports it. */
bool HasMacOSXRpathInstallNameDir(const std::string& config) const; bool HasMacOSXRpathInstallNameDir(const std::string& config) const;
@ -424,21 +357,6 @@ public:
no soname at all. */ no soname at all. */
bool IsImportedSharedLibWithoutSOName(const std::string& config) const; bool IsImportedSharedLibWithoutSOName(const std::string& config) const;
/** Get the names of the library needed to generate a build rule
that takes into account shared library version numbers. This
should be called only on a library target. */
void GetLibraryNames(std::string& name, std::string& soName,
std::string& realName, std::string& impName,
std::string& pdbName, const std::string& config) const;
/** Get the names of the executable needed to generate a build rule
that takes into account executable version numbers. This should
be called only on an executable target. */
void GetExecutableNames(std::string& name, std::string& realName,
std::string& impName,
std::string& pdbName,
const std::string& config) const;
/** Does this target have a GNU implib to convert to MS format? */ /** Does this target have a GNU implib to convert to MS format? */
bool HasImplibGNUtoMS() const; bool HasImplibGNUtoMS() const;
@ -447,29 +365,9 @@ public:
bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out, bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
const char* newExt = 0) const; const char* newExt = 0) const;
/**
* Compute whether this target must be relinked before installing.
*/
bool NeedRelinkBeforeInstall(const std::string& config) const;
bool HaveBuildTreeRPATH(const std::string& config) const; bool HaveBuildTreeRPATH(const std::string& config) const;
bool HaveInstallTreeRPATH() const; bool HaveInstallTreeRPATH() const;
/** Return true if builtin chrpath will work for this target */
bool IsChrpathUsed(const std::string& config) const;
/** Return the install name directory for the target in the
* build tree. For example: "\@rpath/", "\@loader_path/",
* or "/full/path/to/library". */
std::string GetInstallNameDirForBuildTree(const std::string& config) const;
/** Return the install name directory for the target in the
* install tree. For example: "\@rpath/" or "\@loader_path/". */
std::string GetInstallNameDirForInstallTree() const;
cmComputeLinkInformation*
GetLinkInformation(const std::string& config) const;
// Get the properties // Get the properties
cmPropertyMap &GetProperties() const { return this->Properties; } cmPropertyMap &GetProperties() const { return this->Properties; }
@ -520,10 +418,6 @@ public:
/** Return whether this target is an executable Bundle on Apple. */ /** Return whether this target is an executable Bundle on Apple. */
bool IsAppBundleOnApple() const; bool IsAppBundleOnApple() const;
/** Return whether this target is an executable Bundle, a framework
or CFBundle on Apple. */
bool IsBundleOnApple() const;
/** Return the framework version string. Undefined if /** Return the framework version string. Undefined if
IsFrameworkOnApple returns false. */ IsFrameworkOnApple returns false. */
std::string GetFrameworkVersion() const; std::string GetFrameworkVersion() const;
@ -538,25 +432,9 @@ public:
directory. */ directory. */
bool UsesDefaultOutputDir(const std::string& config, bool implib) const; bool UsesDefaultOutputDir(const std::string& config, bool implib) const;
/** @return the mac content directory for this target. */
std::string GetMacContentDirectory(const std::string& config,
bool implib) const;
/** @return whether this target have a well defined output file name. */ /** @return whether this target have a well defined output file name. */
bool HaveWellDefinedOutputFiles() const; bool HaveWellDefinedOutputFiles() const;
/** @return the Mac framework directory without the base. */
std::string GetFrameworkDirectory(const std::string& config,
bool rootDir) const;
/** @return the Mac CFBundle directory without the base */
std::string GetCFBundleDirectory(const std::string& config,
bool contentOnly) const;
/** @return the Mac App directory without the base */
std::string GetAppBundleDirectory(const std::string& config,
bool contentOnly) const;
std::vector<std::string> GetIncludeDirectories( std::vector<std::string> GetIncludeDirectories(
const std::string& config, const std::string& config,
const std::string& language) const; const std::string& language) const;
@ -574,30 +452,10 @@ public:
void GetCompileOptions(std::vector<std::string> &result, void GetCompileOptions(std::vector<std::string> &result,
const std::string& config, const std::string& config,
const std::string& language) const; const std::string& language) const;
void GetAutoUicOptions(std::vector<std::string> &result,
const std::string& config) const;
void GetCompileFeatures(std::vector<std::string> &features, void GetCompileFeatures(std::vector<std::string> &features,
const std::string& config) const; const std::string& config) const;
bool IsNullImpliedByLinkLibraries(const std::string &p) const; bool IsNullImpliedByLinkLibraries(const std::string &p) const;
bool IsLinkInterfaceDependentBoolProperty(const std::string &p,
const std::string& config) const;
bool IsLinkInterfaceDependentStringProperty(const std::string &p,
const std::string& config) const;
bool IsLinkInterfaceDependentNumberMinProperty(const std::string &p,
const std::string& config) const;
bool IsLinkInterfaceDependentNumberMaxProperty(const std::string &p,
const std::string& config) const;
bool GetLinkInterfaceDependentBoolProperty(const std::string &p,
const std::string& config) const;
const char *GetLinkInterfaceDependentStringProperty(const std::string &p,
const std::string& config) const;
const char *GetLinkInterfaceDependentNumberMinProperty(const std::string &p,
const std::string& config) const;
const char *GetLinkInterfaceDependentNumberMaxProperty(const std::string &p,
const std::string& config) const;
std::string GetDebugGeneratorExpressions(const std::string &value, std::string GetDebugGeneratorExpressions(const std::string &value,
cmTarget::LinkLibraryType llt) const; cmTarget::LinkLibraryType llt) const;
@ -610,11 +468,6 @@ public:
bool LinkLanguagePropagatesToDependents() const bool LinkLanguagePropagatesToDependents() const
{ return this->TargetTypeValue == STATIC_LIBRARY; } { return this->TargetTypeValue == STATIC_LIBRARY; }
void ReportPropertyOrigin(const std::string &p,
const std::string &result,
const std::string &report,
const std::string &compatibilityType) const;
std::map<std::string, std::string> const& std::map<std::string, std::string> const&
GetMaxLanguageStandards() const GetMaxLanguageStandards() const
{ {
@ -684,11 +537,6 @@ private:
const char* GetSuffixVariableInternal(bool implib) const; const char* GetSuffixVariableInternal(bool implib) const;
const char* GetPrefixVariableInternal(bool implib) const; const char* GetPrefixVariableInternal(bool implib) const;
std::string GetFullNameInternal(const std::string& config,
bool implib) const;
void GetFullNameInternal(const std::string& config, bool implib,
std::string& outPrefix, std::string& outBase,
std::string& outSuffix) const;
// Use a makefile variable to set a default for the given property. // Use a makefile variable to set a default for the given property.
// If the variable is not defined use the given default instead. // If the variable is not defined use the given default instead.
@ -698,19 +546,12 @@ private:
// Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type. // Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type.
const char* GetOutputTargetType(bool implib) const; const char* GetOutputTargetType(bool implib) const;
// Get the target base name.
std::string GetOutputName(const std::string& config, bool implib) const;
std::string GetFullNameImported(const std::string& config, std::string GetFullNameImported(const std::string& config,
bool implib) const; bool implib) const;
std::string ImportedGetFullPath(const std::string& config, std::string ImportedGetFullPath(const std::string& config,
bool implib) const; bool implib) const;
/** Append to @a base the mac content directory and return it. */
std::string BuildMacContentDirectory(const std::string& base,
const std::string& config,
bool contentOnly) const;
void GetSourceFiles(std::vector<std::string> &files, void GetSourceFiles(std::vector<std::string> &files,
const std::string& config) const; const std::string& config) const;
@ -721,7 +562,6 @@ private:
std::set<std::string> Utilities; std::set<std::string> Utilities;
mutable std::set<std::string> LinkImplicitNullProperties; mutable std::set<std::string> LinkImplicitNullProperties;
std::map<std::string, cmListFileBacktrace> UtilityBacktraces; std::map<std::string, cmListFileBacktrace> UtilityBacktraces;
mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
mutable std::map<std::string, std::string> MaxLanguageStandards; mutable std::map<std::string, std::string> MaxLanguageStandards;
cmPolicies::PolicyMap PolicyMap; cmPolicies::PolicyMap PolicyMap;
std::string Name; std::string Name;
@ -768,18 +608,24 @@ private:
std::string& out) const; std::string& out) const;
// Cache import information from properties for each configuration. // Cache import information from properties for each configuration.
struct ImportInfo; struct ImportInfo
{
ImportInfo(): NoSOName(false), Multiplicity(0) {}
bool NoSOName;
int Multiplicity;
std::string Location;
std::string SOName;
std::string ImportLibrary;
std::string Languages;
std::string Libraries;
std::string LibrariesProp;
std::string SharedDeps;
};
ImportInfo const* GetImportInfo(const std::string& config) const; ImportInfo const* GetImportInfo(const std::string& config) const;
void ComputeImportInfo(std::string const& desired_config, void ComputeImportInfo(std::string const& desired_config,
ImportInfo& info) const; ImportInfo& info) const;
// Cache target compile paths for each configuration.
struct CompileInfo;
CompileInfo const* GetCompileInfo(const std::string& config) const;
mutable cmTargetLinkInformationMap LinkInformation;
void CheckPropertyCompatibility(cmComputeLinkInformation *info,
const std::string& config) const;
LinkInterface const* LinkInterface const*
GetImportLinkInterface(const std::string& config, cmTarget const* head, GetImportLinkInterface(const std::string& config, cmTarget const* head,
@ -788,7 +634,6 @@ private:
LinkImplementationLibraries const* LinkImplementationLibraries const*
GetLinkImplementationLibrariesInternal(const std::string& config, GetLinkImplementationLibrariesInternal(const std::string& config,
cmTarget const* head) const; cmTarget const* head) const;
void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const;
void ExpandLinkItems(std::string const& prop, std::string const& value, void ExpandLinkItems(std::string const& prop, std::string const& value,
std::string const& config, cmTarget const* headTarget, std::string const& config, cmTarget const* headTarget,

View File

@ -1627,7 +1627,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
this->GlobalGenerator->GetLanguageFromExtension this->GlobalGenerator->GetLanguageFromExtension
(sf.GetExtension().c_str()); (sf.GetExtension().c_str());
std::string sourceLang = this->LocalGenerator->GetSourceFileLanguage(sf); std::string sourceLang = this->LocalGenerator->GetSourceFileLanguage(sf);
const std::string& linkLanguage = this->Target->GetLinkerLanguage(); const std::string& linkLanguage = this->GeneratorTarget->GetLinkerLanguage();
bool needForceLang = false; bool needForceLang = false;
// source file does not match its extension language // source file does not match its extension language
if(lang != sourceLang) if(lang != sourceLang)
@ -1774,7 +1774,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
else else
{ {
outDir = this->Target->GetDirectory(config->c_str()) + "/"; outDir = this->Target->GetDirectory(config->c_str()) + "/";
targetNameFull = this->Target->GetFullName(config->c_str()); targetNameFull = this->GeneratorTarget->GetFullName(config->c_str());
} }
this->ConvertToWindowsSlash(intermediateDir); this->ConvertToWindowsSlash(intermediateDir);
this->ConvertToWindowsSlash(outDir); this->ConvertToWindowsSlash(outDir);
@ -1888,7 +1888,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
std::string flags; std::string flags;
const std::string& linkLanguage = const std::string& linkLanguage =
this->Target->GetLinkerLanguage(configName.c_str()); this->GeneratorTarget->GetLinkerLanguage(configName.c_str());
if(linkLanguage.empty()) if(linkLanguage.empty())
{ {
cmSystemTools::Error cmSystemTools::Error
@ -2026,7 +2026,8 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
} }
// Specify the compiler program database file if configured. // Specify the compiler program database file if configured.
std::string pdb = this->Target->GetCompilePDBPath(configName.c_str()); std::string pdb =
this->GeneratorTarget->GetCompilePDBPath(configName.c_str());
if(!pdb.empty()) if(!pdb.empty())
{ {
this->ConvertToWindowsSlash(pdb); this->ConvertToWindowsSlash(pdb);
@ -2370,7 +2371,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
Options& linkOptions = *pOptions; Options& linkOptions = *pOptions;
const std::string& linkLanguage = const std::string& linkLanguage =
this->Target->GetLinkerLanguage(config.c_str()); this->GeneratorTarget->GetLinkerLanguage(config.c_str());
if(linkLanguage.empty()) if(linkLanguage.empty())
{ {
cmSystemTools::Error cmSystemTools::Error
@ -2438,7 +2439,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
cmSystemTools::ExpandListArgument(libs, libVec); cmSystemTools::ExpandListArgument(libs, libVec);
cmComputeLinkInformation* pcli = cmComputeLinkInformation* pcli =
this->Target->GetLinkInformation(config.c_str()); this->GeneratorTarget->GetLinkInformation(config.c_str());
if(!pcli) if(!pcli)
{ {
cmSystemTools::Error cmSystemTools::Error
@ -2471,13 +2472,14 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
std::string targetNamePDB; std::string targetNamePDB;
if(this->Target->GetType() == cmTarget::EXECUTABLE) if(this->Target->GetType() == cmTarget::EXECUTABLE)
{ {
this->Target->GetExecutableNames(targetName, targetNameFull, this->GeneratorTarget->GetExecutableNames(targetName, targetNameFull,
targetNameImport, targetNamePDB, targetNameImport, targetNamePDB,
config.c_str()); config.c_str());
} }
else else
{ {
this->Target->GetLibraryNames(targetName, targetNameSO, targetNameFull, this->GeneratorTarget->GetLibraryNames(targetName, targetNameSO,
targetNameFull,
targetNameImport, targetNamePDB, targetNameImport, targetNamePDB,
config.c_str()); config.c_str());
} }