Merge topic 'use-generator-target'

1fdccff5 Genex: Port implementation detail to cmGeneratorTarget.
ce75c86e cmGeneratorTarget: Move GetSupportDirectory from cmTarget.
526cc7dc cmGeneratorTarget: Move HasImportLibrary from cmTarget.
8d2e3e53 cmGeneratorTarget: Move HasImplibGNUtoMS from cmTarget.
a143d4ac Sublime: Port some API to cmGeneratorTarget.
993aace7 cmGeneratorTarget: Port processILibs to cmGeneratorTarget.
43ade995 cmGeneratorTarget: Port getTypedProperty to cmGeneratorTarget.
5fd2f43f cmGeneratorTarget: Port handleSystemIncludesDep to cmGeneratorTarget.
f7acd742 cmGeneratorTarget: Port LinkImplClosure to cmGeneratorTarget.
763f7b19 cmCommonTargetGenerator: Port implementation detail to cmGeneratorTarget.
ceb35b63 cmLinkItem: Port to cmGeneratorTarget.
bf2d061a cmGeneratorTarget: Move FindTargetToLink from cmTarget.
61c02dec cmHeadToLinkInterfaceMap: Port to cmGeneratorTarget.
9ca4cae5 cmGeneratorTarget: Move GetUtilityItems from cmTarget.
d6b394ed cmComputeLinkDepends: Port result API to cmGeneratorTarget.
7c8236ef cmComputeLinkInformation: Port result API to cmGeneratorTarget.
...
This commit is contained in:
Brad King 2015-10-14 13:35:57 -04:00 committed by CMake Topic Stage
commit ff6ae3ecfc
25 changed files with 281 additions and 281 deletions

View File

@ -383,7 +383,7 @@ std::vector<std::string>
cmCommonTargetGenerator::GetLinkedTargetDirectories() const cmCommonTargetGenerator::GetLinkedTargetDirectories() const
{ {
std::vector<std::string> dirs; std::vector<std::string> dirs;
std::set<cmTarget const*> emitted; std::set<cmGeneratorTarget const*> emitted;
if (cmComputeLinkInformation* cli = if (cmComputeLinkInformation* cli =
this->GeneratorTarget->GetLinkInformation(this->ConfigName)) this->GeneratorTarget->GetLinkInformation(this->ConfigName))
{ {
@ -391,7 +391,7 @@ cmCommonTargetGenerator::GetLinkedTargetDirectories() const
for(cmComputeLinkInformation::ItemVector::const_iterator for(cmComputeLinkInformation::ItemVector::const_iterator
i = items.begin(); i != items.end(); ++i) i = items.begin(); i != items.end(); ++i)
{ {
cmTarget const* linkee = i->Target; cmGeneratorTarget const* linkee = i->Target;
if(linkee && !linkee->IsImported() if(linkee && !linkee->IsImported()
// We can ignore the INTERFACE_LIBRARY items because // We can ignore the INTERFACE_LIBRARY items because
// Target->GetLinkInformation already processed their // Target->GetLinkInformation already processed their
@ -399,13 +399,11 @@ cmCommonTargetGenerator::GetLinkedTargetDirectories() const
&& linkee->GetType() != cmTarget::INTERFACE_LIBRARY && linkee->GetType() != cmTarget::INTERFACE_LIBRARY
&& emitted.insert(linkee).second) && emitted.insert(linkee).second)
{ {
cmGeneratorTarget* gt = cmLocalGenerator* lg = linkee->GetLocalGenerator();
this->GlobalGenerator->GetGeneratorTarget(linkee); cmMakefile* mf = linkee->Target->GetMakefile();
cmLocalGenerator* lg = gt->GetLocalGenerator();
cmMakefile* mf = linkee->GetMakefile();
std::string di = mf->GetCurrentBinaryDirectory(); std::string di = mf->GetCurrentBinaryDirectory();
di += "/"; di += "/";
di += lg->GetTargetDirectory(*linkee); di += lg->GetTargetDirectory(*linkee->Target);
dirs.push_back(di); dirs.push_back(di);
} }
} }

View File

@ -320,8 +320,7 @@ int cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item)
int index = lei->second; int index = lei->second;
LinkEntry& entry = this->EntryList[index]; LinkEntry& entry = this->EntryList[index];
entry.Item = item; entry.Item = item;
entry.Target = entry.Target = item.Target;
item.Target ? this->GlobalGenerator->GetGeneratorTarget(item.Target) : 0;
entry.IsFlag = (!entry.Target && item[0] == '-' && item[1] != 'l' && entry.IsFlag = (!entry.Target && item[0] == '-' && item[1] != 'l' &&
item.substr(0, 10) != "-framework"); item.substr(0, 10) != "-framework");
@ -443,9 +442,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
// Initialize the item entry. // Initialize the item entry.
LinkEntry& entry = this->EntryList[lei->second]; LinkEntry& entry = this->EntryList[lei->second];
entry.Item = dep.Item; entry.Item = dep.Item;
entry.Target = entry.Target = dep.Item.Target;
dep.Item.Target ?
this->GlobalGenerator->GetGeneratorTarget(dep.Item.Target) : 0;
// This item was added specifically because it is a dependent // This item was added specifically because it is a dependent
// shared library. It may get special treatment // shared library. It may get special treatment
@ -634,8 +631,9 @@ cmComputeLinkDepends::AddLinkEntries(
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmTarget const* cmComputeLinkDepends::FindTargetToLink(int depender_index, cmGeneratorTarget const*
const std::string& name) cmComputeLinkDepends::FindTargetToLink(int depender_index,
const std::string& name)
{ {
// Look for a target in the scope of the depender. // Look for a target in the scope of the depender.
cmGeneratorTarget const* from = this->Target; cmGeneratorTarget const* from = this->Target;
@ -647,7 +645,7 @@ cmTarget const* cmComputeLinkDepends::FindTargetToLink(int depender_index,
from = depender; from = depender;
} }
} }
return from->Target->FindTargetToLink(name); return from->FindTargetToLink(name);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -14,6 +14,7 @@
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
#include "cmTarget.h" #include "cmTarget.h"
#include "cmLinkItem.h"
#include "cmGraphAdjacencyList.h" #include "cmGraphAdjacencyList.h"
@ -52,7 +53,7 @@ public:
EntryVector const& Compute(); EntryVector const& Compute();
void SetOldLinkDirMode(bool b); void SetOldLinkDirMode(bool b);
std::set<cmTarget const*> const& GetOldWrongConfigItems() const std::set<cmGeneratorTarget const*> const& GetOldWrongConfigItems() const
{ return this->OldWrongConfigItems; } { return this->OldWrongConfigItems; }
private: private:
@ -72,8 +73,8 @@ private:
void AddDirectLinkEntries(); void AddDirectLinkEntries();
template <typename T> template <typename T>
void AddLinkEntries(int depender_index, std::vector<T> const& libs); void AddLinkEntries(int depender_index, std::vector<T> const& libs);
cmTarget const* FindTargetToLink(int depender_index, cmGeneratorTarget const* FindTargetToLink(int depender_index,
const std::string& name); const std::string& name);
// One entry for each unique item. // One entry for each unique item.
std::vector<LinkEntry> EntryList; std::vector<LinkEntry> EntryList;
@ -150,7 +151,7 @@ private:
// Record of the original link line. // Record of the original link line.
std::vector<int> OriginalEntries; std::vector<int> OriginalEntries;
std::set<cmTarget const*> OldWrongConfigItems; std::set<cmGeneratorTarget const*> OldWrongConfigItems;
void CheckWrongConfigItem(cmLinkItem const& item); void CheckWrongConfigItem(cmLinkItem const& item);
int ComponentOrderId; int ComponentOrderId;

View File

@ -19,7 +19,6 @@
#include "cmState.h" #include "cmState.h"
#include "cmOutputConverter.h" #include "cmOutputConverter.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmTarget.h"
#include "cmGeneratorTarget.h" #include "cmGeneratorTarget.h"
#include "cmake.h" #include "cmake.h"
#include "cmAlgorithms.h" #include "cmAlgorithms.h"
@ -471,7 +470,7 @@ std::vector<std::string> const& cmComputeLinkInformation::GetFrameworkPaths()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::set<cmTarget const*> const& const std::set<const cmGeneratorTarget*>&
cmComputeLinkInformation::GetSharedLibrariesLinked() cmComputeLinkInformation::GetSharedLibrariesLinked()
{ {
return this->SharedLibrariesLinked; return this->SharedLibrariesLinked;
@ -537,16 +536,16 @@ bool cmComputeLinkInformation::Compute()
// For CMake 2.4 bug-compatibility we need to consider the output // For CMake 2.4 bug-compatibility we need to consider the output
// directories of targets linked in another configuration as link // directories of targets linked in another configuration as link
// directories. // directories.
std::set<cmTarget const*> const& wrongItems = cld.GetOldWrongConfigItems(); std::set<cmGeneratorTarget const*> const& wrongItems =
for(std::set<cmTarget const*>::const_iterator i = wrongItems.begin(); cld.GetOldWrongConfigItems();
i != wrongItems.end(); ++i) for(std::set<cmGeneratorTarget const*>::const_iterator i =
wrongItems.begin(); i != wrongItems.end(); ++i)
{ {
cmTarget const* tgt = *i; cmGeneratorTarget const* tgt = *i;
cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt);
bool implib = bool implib =
(this->UseImportLibrary && (this->UseImportLibrary &&
(tgt->GetType() == cmTarget::SHARED_LIBRARY)); (tgt->GetType() == cmTarget::SHARED_LIBRARY));
std::string lib = gtgt->GetFullPath(this->Config , implib, true); std::string lib = tgt->GetFullPath(this->Config , implib, true);
this->OldLinkDirItems.push_back(lib); this->OldLinkDirItems.push_back(lib);
} }
} }
@ -658,7 +657,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
std::string exe = tgt->GetFullPath(config, this->UseImportLibrary, std::string exe = tgt->GetFullPath(config, this->UseImportLibrary,
true); true);
linkItem += exe; linkItem += exe;
this->Items.push_back(Item(linkItem, true, tgt->Target)); this->Items.push_back(Item(linkItem, true, tgt));
this->Depends.push_back(exe); this->Depends.push_back(exe);
} }
else if(tgt->GetType() == cmTarget::INTERFACE_LIBRARY) else if(tgt->GetType() == cmTarget::INTERFACE_LIBRARY)
@ -666,7 +665,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
// Add the interface library as an item so it can be considered as part // Add the interface library as an item so it can be considered as part
// of COMPATIBLE_INTERFACE_ enforcement. The generators will ignore // of COMPATIBLE_INTERFACE_ enforcement. The generators will ignore
// this for the actual link line. // this for the actual link line.
this->Items.push_back(Item(std::string(), true, tgt->Target)); this->Items.push_back(Item(std::string(), true, tgt));
} }
else else
{ {
@ -683,8 +682,8 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
this->Depends.push_back(lib); this->Depends.push_back(lib);
} }
this->AddTargetItem(lib, tgt->Target); this->AddTargetItem(lib, tgt);
this->AddLibraryRuntimeInfo(lib, tgt->Target); this->AddLibraryRuntimeInfo(lib, tgt);
} }
} }
else else
@ -766,7 +765,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
if(tgt) if(tgt)
{ {
lib = tgt->GetFullPath(this->Config, this->UseImportLibrary); lib = tgt->GetFullPath(this->Config, this->UseImportLibrary);
this->AddLibraryRuntimeInfo(lib, tgt->Target); this->AddLibraryRuntimeInfo(lib, tgt);
} }
else else
{ {
@ -1077,7 +1076,7 @@ void cmComputeLinkInformation::SetCurrentLinkType(LinkType lt)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmComputeLinkInformation::AddTargetItem(std::string const& item, void cmComputeLinkInformation::AddTargetItem(std::string const& item,
cmTarget const* target) cmGeneratorTarget const* target)
{ {
// This is called to handle a link item that is a full path to a target. // This is called to handle a link item that is a full path to a target.
// If the target is not a static library make sure the link type is // If the target is not a static library make sure the link type is
@ -1096,10 +1095,9 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
this->SharedLibrariesLinked.insert(target); this->SharedLibrariesLinked.insert(target);
} }
cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(target);
// Handle case of an imported shared library with no soname. // Handle case of an imported shared library with no soname.
if(this->NoSONameUsesPath && if(this->NoSONameUsesPath &&
gtgt->IsImportedSharedLibWithoutSOName(this->Config)) target->IsImportedSharedLibWithoutSOName(this->Config))
{ {
this->AddSharedLibNoSOName(item); this->AddSharedLibNoSOName(item);
return; return;
@ -1113,7 +1111,7 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
// For compatibility with CMake 2.4 include the item's directory in // For compatibility with CMake 2.4 include the item's directory in
// the linker search path. // the linker search path.
if(this->OldLinkDirMode && !target->IsFrameworkOnApple() && if(this->OldLinkDirMode && !target->Target->IsFrameworkOnApple() &&
this->OldLinkDirMask.find(cmSystemTools::GetFilenamePath(item)) == this->OldLinkDirMask.find(cmSystemTools::GetFilenamePath(item)) ==
this->OldLinkDirMask.end()) this->OldLinkDirMask.end())
{ {
@ -1777,15 +1775,14 @@ cmComputeLinkInformation::GetRuntimeSearchPath()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath, cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
cmTarget const* target) cmGeneratorTarget const* target)
{ {
cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(target);
// Ignore targets on Apple where install_name is not @rpath. // Ignore targets on Apple where install_name is not @rpath.
// The dependenty library can be found with other means such as // The dependenty library can be found with other means such as
// @loader_path or full paths. // @loader_path or full paths.
if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{ {
if(!gtgt->HasMacOSXRpathInstallNameDir(this->Config)) if(!target->HasMacOSXRpathInstallNameDir(this->Config))
{ {
return; return;
} }
@ -1807,7 +1804,7 @@ 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 = gtgt->GetSOName(this->Config); std::string soName = target->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.

View File

@ -19,7 +19,6 @@
class cmake; class cmake;
class cmGlobalGenerator; class cmGlobalGenerator;
class cmMakefile; class cmMakefile;
class cmTarget;
class cmGeneratorTarget; class cmGeneratorTarget;
class cmOrderDirectories; class cmOrderDirectories;
@ -39,11 +38,11 @@ public:
Item(): Value(), IsPath(true), Target(0) {} Item(): Value(), IsPath(true), Target(0) {}
Item(Item const& item): Item(Item const& item):
Value(item.Value), IsPath(item.IsPath), Target(item.Target) {} Value(item.Value), IsPath(item.IsPath), Target(item.Target) {}
Item(std::string const& v, bool p, cmTarget const* target = 0): Item(std::string const& v, bool p, cmGeneratorTarget const* target = 0):
Value(v), IsPath(p), Target(target) {} Value(v), IsPath(p), Target(target) {}
std::string Value; std::string Value;
bool IsPath; bool IsPath;
cmTarget const* Target; cmGeneratorTarget const* Target;
}; };
typedef std::vector<Item> ItemVector; typedef std::vector<Item> ItemVector;
ItemVector const& GetItems(); ItemVector const& GetItems();
@ -57,7 +56,7 @@ public:
void GetRPath(std::vector<std::string>& runtimeDirs, bool for_install); void GetRPath(std::vector<std::string>& runtimeDirs, bool for_install);
std::string GetRPathString(bool for_install); std::string GetRPathString(bool for_install);
std::string GetChrpathString(); std::string GetChrpathString();
std::set<cmTarget const*> const& GetSharedLibrariesLinked(); std::set<cmGeneratorTarget const*> const& GetSharedLibrariesLinked();
std::string const& GetRPathLinkFlag() const { return this->RPathLinkFlag; } std::string const& GetRPathLinkFlag() const { return this->RPathLinkFlag; }
std::string GetRPathLinkString(); std::string GetRPathLinkString();
@ -71,7 +70,7 @@ private:
std::vector<std::string> Depends; std::vector<std::string> Depends;
std::vector<std::string> FrameworkPaths; std::vector<std::string> FrameworkPaths;
std::vector<std::string> RuntimeSearchPath; std::vector<std::string> RuntimeSearchPath;
std::set<cmTarget const*> SharedLibrariesLinked; std::set<cmGeneratorTarget const*> SharedLibrariesLinked;
// Context information. // Context information.
cmGeneratorTarget const* Target; cmGeneratorTarget const* Target;
@ -129,7 +128,7 @@ private:
std::string NoCaseExpression(const char* str); std::string NoCaseExpression(const char* str);
// Handling of link items. // Handling of link items.
void AddTargetItem(std::string const& item, cmTarget const* target); void AddTargetItem(std::string const& item, const cmGeneratorTarget* target);
void AddFullItem(std::string const& item); void AddFullItem(std::string const& item);
bool CheckImplicitDirItem(std::string const& item); bool CheckImplicitDirItem(std::string const& item);
void AddUserItem(std::string const& item, bool pathNotKnown); void AddUserItem(std::string const& item, bool pathNotKnown);
@ -183,7 +182,7 @@ private:
bool CMP0060Warn; bool CMP0060Warn;
void AddLibraryRuntimeInfo(std::string const& fullPath, void AddLibraryRuntimeInfo(std::string const& fullPath,
cmTarget const* target); const cmGeneratorTarget* target);
void AddLibraryRuntimeInfo(std::string const& fullPath); void AddLibraryRuntimeInfo(std::string const& fullPath);
}; };

View File

@ -272,7 +272,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// Loop over all utility dependencies. // Loop over all utility dependencies.
{ {
std::set<cmLinkItem> const& tutils = depender->Target->GetUtilityItems(); std::set<cmLinkItem> const& tutils = depender->GetUtilityItems();
std::set<std::string> emitted; std::set<std::string> emitted;
// A target should not depend on itself. // A target should not depend on itself.
emitted.insert(depender->GetName()); emitted.insert(depender->GetName());
@ -319,22 +319,20 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
std::set<std::string> &emitted) std::set<std::string> &emitted)
{ {
cmGeneratorTarget const* depender = this->Targets[depender_index]; cmGeneratorTarget const* depender = this->Targets[depender_index];
cmTarget const* dependee = dependee_name.Target; cmGeneratorTarget const* dependee = dependee_name.Target;
// Skip targets that will not really be linked. This is probably a // Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable // name conflict between an external library and an executable
// within the project. // within the project.
if(dependee && if(dependee &&
dependee->GetType() == cmTarget::EXECUTABLE && dependee->GetType() == cmTarget::EXECUTABLE &&
!dependee->IsExecutableWithExports()) !dependee->Target->IsExecutableWithExports())
{ {
dependee = 0; dependee = 0;
} }
if(dependee) if(dependee)
{ {
cmGeneratorTarget* gt = this->AddInterfaceDepends(depender_index, dependee, "", emitted);
this->GlobalGenerator->GetGeneratorTarget(dependee);
this->AddInterfaceDepends(depender_index, gt, "", emitted);
std::vector<std::string> configs; std::vector<std::string> configs;
depender->Makefile->GetConfigurations(configs); depender->Makefile->GetConfigurations(configs);
for (std::vector<std::string>::const_iterator it = configs.begin(); for (std::vector<std::string>::const_iterator it = configs.begin();
@ -342,7 +340,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
{ {
// A target should not depend on itself. // A target should not depend on itself.
emitted.insert(depender->GetName()); emitted.insert(depender->GetName());
this->AddInterfaceDepends(depender_index, gt, *it, emitted); this->AddInterfaceDepends(depender_index, dependee, *it, emitted);
} }
} }
} }
@ -356,7 +354,7 @@ void cmComputeTargetDepends::AddTargetDepend(
cmGeneratorTarget const* depender = this->Targets[depender_index]; cmGeneratorTarget const* depender = this->Targets[depender_index];
// Check the target's makefile first. // Check the target's makefile first.
cmTarget const* dependee = dependee_name.Target; cmGeneratorTarget const* dependee = dependee_name.Target;
if(!dependee && !linking && if(!dependee && !linking &&
(depender->GetType() != cmTarget::GLOBAL_TARGET)) (depender->GetType() != cmTarget::GLOBAL_TARGET))
@ -403,16 +401,14 @@ void cmComputeTargetDepends::AddTargetDepend(
// within the project. // within the project.
if(linking && dependee && if(linking && dependee &&
dependee->GetType() == cmTarget::EXECUTABLE && dependee->GetType() == cmTarget::EXECUTABLE &&
!dependee->IsExecutableWithExports()) !dependee->Target->IsExecutableWithExports())
{ {
dependee = 0; dependee = 0;
} }
if(dependee) if(dependee)
{ {
cmGeneratorTarget* gt = this->AddTargetDepend(depender_index, dependee, linking);
this->GlobalGenerator->GetGeneratorTarget(dependee);
this->AddTargetDepend(depender_index, gt, linking);
} }
} }
@ -426,15 +422,13 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
{ {
// Skip IMPORTED and INTERFACE targets but follow their utility // Skip IMPORTED and INTERFACE targets but follow their utility
// dependencies. // dependencies.
std::set<cmLinkItem> const& utils = dependee->Target->GetUtilityItems(); std::set<cmLinkItem> const& utils = dependee->GetUtilityItems();
for(std::set<cmLinkItem>::const_iterator i = utils.begin(); for(std::set<cmLinkItem>::const_iterator i = utils.begin();
i != utils.end(); ++i) i != utils.end(); ++i)
{ {
if(cmTarget const* transitive_dependee = i->Target) if(cmGeneratorTarget const* transitive_dependee = i->Target)
{ {
cmGeneratorTarget* gt = this->AddTargetDepend(depender_index, transitive_dependee, false);
this->GlobalGenerator->GetGeneratorTarget(transitive_dependee);
this->AddTargetDepend(depender_index, gt, false);
} }
} }
} }

View File

@ -217,7 +217,7 @@ cmExportBuildFileGenerator
std::string prop = "IMPORTED_IMPLIB"; std::string prop = "IMPORTED_IMPLIB";
prop += suffix; prop += suffix;
std::string value = target->GetFullPath(config, true); std::string value = target->GetFullPath(config, true);
target->Target->GetImplibGNUtoMS(value, value, target->GetImplibGNUtoMS(value, value,
"${CMAKE_IMPORT_LIBRARY_SUFFIX}"); "${CMAKE_IMPORT_LIBRARY_SUFFIX}");
properties[prop] = value; properties[prop] = value;
} }

View File

@ -517,8 +517,9 @@ void cmExportFileGenerator::PopulateInterfaceProperty(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void getPropertyContents(cmTarget const* tgt, const std::string& prop, void getPropertyContents(cmGeneratorTarget const* tgt,
std::set<std::string> &ifaceProperties) const std::string& prop,
std::set<std::string> &ifaceProperties)
{ {
const char *p = tgt->GetProperty(prop); const char *p = tgt->GetProperty(prop);
if (!p) if (!p)
@ -589,11 +590,11 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
std::set<std::string> ifaceProperties; std::set<std::string> ifaceProperties;
getPropertyContents(target, "COMPATIBLE_INTERFACE_BOOL", ifaceProperties); getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_BOOL", ifaceProperties);
getPropertyContents(target, "COMPATIBLE_INTERFACE_STRING", ifaceProperties); getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_STRING", ifaceProperties);
getPropertyContents(target, "COMPATIBLE_INTERFACE_NUMBER_MIN", getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_NUMBER_MIN",
ifaceProperties); ifaceProperties);
getPropertyContents(target, "COMPATIBLE_INTERFACE_NUMBER_MAX", getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_NUMBER_MAX",
ifaceProperties); ifaceProperties);
if (target->GetType() != cmTarget::INTERFACE_LIBRARY) if (target->GetType() != cmTarget::INTERFACE_LIBRARY)

View File

@ -254,9 +254,9 @@ void cmExtraSublimeTextGenerator::
} }
std::vector<std::string>& flags = sourceFileFlagsIter->second; std::vector<std::string>& flags = sourceFileFlagsIter->second;
std::string flagsString = std::string flagsString =
this->ComputeFlagsForObject(*iter, lg, target, gtgt); this->ComputeFlagsForObject(*iter, lg, gtgt);
std::string definesString = std::string definesString =
this->ComputeDefines(*iter, lg, target, gtgt); this->ComputeDefines(*iter, lg, gtgt);
flags.clear(); flags.clear();
cmsys::RegularExpression flagRegex; cmsys::RegularExpression flagRegex;
// Regular expression to extract compiler flags from a string // Regular expression to extract compiler flags from a string
@ -364,7 +364,6 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand(
std::string std::string
cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source, cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source,
cmLocalGenerator* lg, cmLocalGenerator* lg,
cmTarget *target,
cmGeneratorTarget* gtgt) cmGeneratorTarget* gtgt)
{ {
std::string flags; std::string flags;
@ -389,7 +388,7 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source,
// } // }
// Add shared-library flags if needed. // Add shared-library flags if needed.
lg->AddCMP0018Flags(flags, target, language, config); lg->AddCMP0018Flags(flags, gtgt->Target, language, config);
// Add include directory flags. // Add include directory flags.
{ {
@ -404,7 +403,7 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source,
lg->AppendFlags(flags, makefile->GetDefineFlags()); lg->AppendFlags(flags, makefile->GetDefineFlags());
// Add target-specific flags. // Add target-specific flags.
lg->AddCompileOptions(flags, target, language, config); lg->AddCompileOptions(flags, gtgt->Target, language, config);
// Add source file specific flags. // Add source file specific flags.
lg->AppendFlags(flags, source->GetProperty("COMPILE_FLAGS")); lg->AppendFlags(flags, source->GetProperty("COMPILE_FLAGS"));
@ -418,8 +417,8 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source,
// void cmMakefileTargetGenerator::WriteTargetLanguageFlags(). // void cmMakefileTargetGenerator::WriteTargetLanguageFlags().
std::string std::string
cmExtraSublimeTextGenerator:: cmExtraSublimeTextGenerator::
ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target, ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg,
cmGeneratorTarget*) cmGeneratorTarget* target)
{ {
std::set<std::string> defines; std::set<std::string> defines;
@ -428,13 +427,13 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target,
const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
// Add the export symbol definition for shared library objects. // Add the export symbol definition for shared library objects.
if(const char* exportMacro = target->GetExportMacro()) if(const char* exportMacro = target->Target->GetExportMacro())
{ {
lg->AppendDefines(defines, exportMacro); lg->AppendDefines(defines, exportMacro);
} }
// Add preprocessor definitions for this target and configuration. // Add preprocessor definitions for this target and configuration.
lg->AddCompileDefinitions(defines, target, config, language); lg->AddCompileDefinitions(defines, target->Target, config, language);
lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS")); lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS"));
{ {
std::string defPropName = "COMPILE_DEFINITIONS_"; std::string defPropName = "COMPILE_DEFINITIONS_";

View File

@ -79,11 +79,10 @@ private:
*/ */
std::string ComputeFlagsForObject(cmSourceFile *source, std::string ComputeFlagsForObject(cmSourceFile *source,
cmLocalGenerator* lg, cmLocalGenerator* lg,
cmTarget *target,
cmGeneratorTarget* gtgt); cmGeneratorTarget* gtgt);
std::string ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, std::string ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg,
cmTarget *target, cmGeneratorTarget* gtgt); cmGeneratorTarget* gtgt);
}; };
#endif #endif

View File

@ -831,8 +831,8 @@ template <typename T>
std::string std::string
getLinkedTargetsContent( getLinkedTargetsContent(
std::vector<T> const &libraries, std::vector<T> const &libraries,
cmTarget const* target, cmGeneratorTarget const* target,
cmTarget const* headTarget, cmGeneratorTarget const* headTarget,
cmGeneratorExpressionContext *context, cmGeneratorExpressionContext *context,
cmGeneratorExpressionDAGChecker *dagChecker, cmGeneratorExpressionDAGChecker *dagChecker,
const std::string &interfacePropertyName) const std::string &interfacePropertyName)
@ -858,8 +858,10 @@ getLinkedTargetsContent(
{ {
linkedTargetsContent = linkedTargetsContent =
cmGeneratorExpressionNode::EvaluateDependentExpression(depString, cmGeneratorExpressionNode::EvaluateDependentExpression(depString,
target->GetMakefile(), context, target->Target->GetMakefile(),
headTarget, target, dagChecker); context,
headTarget->Target,
target->Target, dagChecker);
} }
linkedTargetsContent = linkedTargetsContent =
cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent);
@ -1116,8 +1118,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
gtgt->GetLinkInterfaceLibraries(context->Config, gHeadTarget, true)) gtgt->GetLinkInterfaceLibraries(context->Config, gHeadTarget, true))
{ {
linkedTargetsContent = linkedTargetsContent =
getLinkedTargetsContent(iface->Libraries, target, getLinkedTargetsContent(iface->Libraries, gtgt,
headTarget, gHeadTarget,
context, &dagChecker, context, &dagChecker,
interfacePropertyName); interfacePropertyName);
} }
@ -1128,8 +1130,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
gtgt->GetLinkImplementationLibraries(context->Config)) gtgt->GetLinkImplementationLibraries(context->Config))
{ {
linkedTargetsContent = linkedTargetsContent =
getLinkedTargetsContent(impl->Libraries, target, getLinkedTargetsContent(impl->Libraries, gtgt,
target, gtgt,
context, &dagChecker, context, &dagChecker,
interfacePropertyName); interfacePropertyName);
} }
@ -1658,7 +1660,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag>
return std::string(); return std::string();
} }
return target->GetFullPath(context->Config, return target->GetFullPath(context->Config,
target->Target->HasImportLibrary()); target->HasImportLibrary());
} }
}; };

View File

@ -271,7 +271,8 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
DebugCompileFeaturesDone(false), DebugCompileFeaturesDone(false),
DebugCompileDefinitionsDone(false), DebugCompileDefinitionsDone(false),
DebugSourcesDone(false), DebugSourcesDone(false),
LinkImplementationLanguageIsContextDependent(true) LinkImplementationLanguageIsContextDependent(true),
UtilityItemsDone(false)
{ {
this->Makefile = this->Target->GetMakefile(); this->Makefile = this->Target->GetMakefile();
this->LocalGenerator = lg; this->LocalGenerator = lg;
@ -509,7 +510,8 @@ cmGeneratorTarget::GetSourceDepends(cmSourceFile const* sf) const
return 0; return 0;
} }
static void handleSystemIncludesDep(cmMakefile *mf, cmTarget const* depTgt, static void handleSystemIncludesDep(cmMakefile *mf,
cmGeneratorTarget const* depTgt,
const std::string& config, const std::string& config,
cmGeneratorTarget const* headTarget, cmGeneratorTarget const* headTarget,
cmGeneratorExpressionDAGChecker *dagChecker, cmGeneratorExpressionDAGChecker *dagChecker,
@ -523,7 +525,7 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget const* depTgt,
cmSystemTools::ExpandListArgument(ge.Parse(dirs) cmSystemTools::ExpandListArgument(ge.Parse(dirs)
->Evaluate(mf, ->Evaluate(mf,
config, false, headTarget->Target, config, false, headTarget->Target,
depTgt, dagChecker), result); depTgt->Target, dagChecker), result);
} }
if (!depTgt->IsImported() || excludeImported) if (!depTgt->IsImported() || excludeImported)
{ {
@ -537,7 +539,7 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget const* depTgt,
cmSystemTools::ExpandListArgument(ge.Parse(dirs) cmSystemTools::ExpandListArgument(ge.Parse(dirs)
->Evaluate(mf, ->Evaluate(mf,
config, false, headTarget->Target, config, false, headTarget->Target,
depTgt, dagChecker), result); depTgt->Target, dagChecker), result);
} }
} }
@ -760,7 +762,25 @@ cmGeneratorTarget::GetExpectedXamlSources(std::set<std::string>& srcs,
{ {
XamlData data; XamlData data;
IMPLEMENT_VISIT_IMPL(Xaml, COMMA cmGeneratorTarget::XamlData) IMPLEMENT_VISIT_IMPL(Xaml, COMMA cmGeneratorTarget::XamlData)
srcs = data.ExpectedXamlSources; srcs = data.ExpectedXamlSources;
}
std::set<cmLinkItem> const& cmGeneratorTarget::GetUtilityItems() const
{
if(!this->UtilityItemsDone)
{
this->UtilityItemsDone = true;
std::set<std::string> const& utilities = this->Target->GetUtilities();
for(std::set<std::string>::const_iterator i = utilities.begin();
i != utilities.end(); ++i)
{
cmTarget* tgt = this->Makefile->FindTargetToUse(*i);
cmGeneratorTarget* gt = tgt ? this->GlobalGenerator
->GetGeneratorTarget(tgt) : 0;
this->UtilityItems.insert(cmLinkItem(*i, gt));
}
}
return this->UtilityItems;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -864,9 +884,9 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
&dagChecker), result); &dagChecker), result);
} }
std::vector<cmTarget const*> const& deps = std::vector<cmGeneratorTarget const*> const& deps =
this->GetLinkImplementationClosure(config); this->GetLinkImplementationClosure(config);
for(std::vector<cmTarget const*>::const_iterator for(std::vector<cmGeneratorTarget const*>::const_iterator
li = deps.begin(), le = deps.end(); li != le; ++li) li = deps.begin(), le = deps.end(); li != le; ++li)
{ {
handleSystemIncludesDep(this->Makefile, *li, config, this, handleSystemIncludesDep(this->Makefile, *li, config, this,
@ -1711,15 +1731,12 @@ public:
} }
return; return;
} }
if(!this->Visited.insert(item.Target).second) if(!this->Visited.insert(item.Target->Target).second)
{ {
return; return;
} }
cmGeneratorTarget* gtgt =
this->Target->GetLocalGenerator()->GetGlobalGenerator()
->GetGeneratorTarget(item.Target);
cmLinkInterface const* iface = cmLinkInterface const* iface =
gtgt->GetLinkInterface(this->Config, this->HeadTarget); item.Target->GetLinkInterface(this->Config, this->HeadTarget);
if(!iface) { return; } if(!iface) { return; }
for(std::vector<std::string>::const_iterator for(std::vector<std::string>::const_iterator
@ -2050,15 +2067,14 @@ void processILibs(const std::string& config,
cmGeneratorTarget const* headTarget, cmGeneratorTarget const* headTarget,
cmLinkItem const& item, cmLinkItem const& item,
cmGlobalGenerator* gg, cmGlobalGenerator* gg,
std::vector<cmTarget const*>& tgts, std::vector<cmGeneratorTarget const*>& tgts,
std::set<cmTarget const*>& emitted) std::set<cmGeneratorTarget const*>& emitted)
{ {
if (item.Target && emitted.insert(item.Target).second) if (item.Target && emitted.insert(item.Target).second)
{ {
tgts.push_back(item.Target); tgts.push_back(item.Target);
cmGeneratorTarget* gt = gg->GetGeneratorTarget(item.Target);
if(cmLinkInterfaceLibraries const* iface = if(cmLinkInterfaceLibraries const* iface =
gt->GetLinkInterfaceLibraries(config, headTarget, true)) item.Target->GetLinkInterfaceLibraries(config, headTarget, true))
{ {
for(std::vector<cmLinkItem>::const_iterator for(std::vector<cmLinkItem>::const_iterator
it = iface->Libraries.begin(); it = iface->Libraries.begin();
@ -2071,7 +2087,7 @@ void processILibs(const std::string& config,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const std::vector<const cmTarget*>& const std::vector<const cmGeneratorTarget*>&
cmGeneratorTarget::GetLinkImplementationClosure( cmGeneratorTarget::GetLinkImplementationClosure(
const std::string& config) const const std::string& config) const
{ {
@ -2080,7 +2096,7 @@ cmGeneratorTarget::GetLinkImplementationClosure(
if(!tgts.Done) if(!tgts.Done)
{ {
tgts.Done = true; tgts.Done = true;
std::set<cmTarget const*> emitted; std::set<cmGeneratorTarget const*> emitted;
cmLinkImplementationLibraries const* impl cmLinkImplementationLibraries const* impl
= this->GetLinkImplementationLibraries(config); = this->GetLinkImplementationLibraries(config);
@ -3615,10 +3631,10 @@ cmGeneratorTarget::GetCompatibleInterfaces(std::string const& config) const
compat.Done = true; compat.Done = true;
compat.PropsBool.insert("POSITION_INDEPENDENT_CODE"); compat.PropsBool.insert("POSITION_INDEPENDENT_CODE");
compat.PropsString.insert("AUTOUIC_OPTIONS"); compat.PropsString.insert("AUTOUIC_OPTIONS");
std::vector<cmTarget const*> const& deps = std::vector<cmGeneratorTarget const*> const& deps =
this->GetLinkImplementationClosure(config); this->GetLinkImplementationClosure(config);
for(std::vector<cmTarget const*>::const_iterator li = deps.begin(); for(std::vector<cmGeneratorTarget const*>::const_iterator li =
li != deps.end(); ++li) deps.begin(); li != deps.end(); ++li)
{ {
#define CM_READ_COMPATIBLE_INTERFACE(X, x) \ #define CM_READ_COMPATIBLE_INTERFACE(X, x) \
if(const char* prop = (*li)->GetProperty("COMPATIBLE_INTERFACE_" #X)) \ if(const char* prop = (*li)->GetProperty("COMPATIBLE_INTERFACE_" #X)) \
@ -3735,7 +3751,7 @@ const char * getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
template<typename PropertyType> template<typename PropertyType>
void checkPropertyConsistency(cmGeneratorTarget const* depender, void checkPropertyConsistency(cmGeneratorTarget const* depender,
cmTarget const* dependee, cmGeneratorTarget const* dependee,
const std::string& propName, const std::string& propName,
std::set<std::string> &emitted, std::set<std::string> &emitted,
const std::string& config, const std::string& config,
@ -3751,7 +3767,7 @@ void checkPropertyConsistency(cmGeneratorTarget const* depender,
std::vector<std::string> props; std::vector<std::string> props;
cmSystemTools::ExpandListArgument(prop, props); cmSystemTools::ExpandListArgument(prop, props);
std::string pdir = std::string pdir =
dependee->GetMakefile()->GetRequiredDefinition("CMAKE_ROOT"); dependee->Target->GetMakefile()->GetRequiredDefinition("CMAKE_ROOT");
pdir += "/Help/prop_tgt/"; pdir += "/Help/prop_tgt/";
for(std::vector<std::string>::iterator pi = props.begin(); for(std::vector<std::string>::iterator pi = props.begin();
@ -3964,18 +3980,20 @@ std::string compatibilityAgree(CompatibleType t, bool dominant)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
template<typename PropertyType> template<typename PropertyType>
PropertyType getTypedProperty(cmTarget const* tgt, const std::string& prop); PropertyType getTypedProperty(cmGeneratorTarget const* tgt,
const std::string& prop);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
template<> template<>
bool getTypedProperty<bool>(cmTarget const* tgt, const std::string& prop) bool getTypedProperty<bool>(cmGeneratorTarget const* tgt,
const std::string& prop)
{ {
return tgt->GetPropertyAsBool(prop); return tgt->GetPropertyAsBool(prop);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
template<> template<>
const char *getTypedProperty<const char *>(cmTarget const* tgt, const char *getTypedProperty<const char *>(cmGeneratorTarget const* tgt,
const std::string& prop) const std::string& prop)
{ {
return tgt->GetProperty(prop); return tgt->GetProperty(prop);
@ -4105,7 +4123,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
CompatibleType t, CompatibleType t,
PropertyType *) PropertyType *)
{ {
PropertyType propContent = getTypedProperty<PropertyType>(tgt->Target, p); PropertyType propContent = getTypedProperty<PropertyType>(tgt, p);
const bool explicitlySet = tgt->Target->GetProperties() const bool explicitlySet = tgt->Target->GetProperties()
.find(p) .find(p)
!= tgt->Target->GetProperties().end(); != tgt->Target->GetProperties().end();
@ -4114,7 +4132,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
assert((impliedByUse ^ explicitlySet) assert((impliedByUse ^ explicitlySet)
|| (!impliedByUse && !explicitlySet)); || (!impliedByUse && !explicitlySet));
std::vector<cmTarget const*> const& deps = std::vector<cmGeneratorTarget const*> const& deps =
tgt->GetLinkImplementationClosure(config); tgt->GetLinkImplementationClosure(config);
if(deps.empty()) if(deps.empty())
@ -4141,7 +4159,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
} }
std::string interfaceProperty = "INTERFACE_" + p; std::string interfaceProperty = "INTERFACE_" + p;
for(std::vector<cmTarget const*>::const_iterator li = for(std::vector<cmGeneratorTarget const*>::const_iterator li =
deps.begin(); deps.begin();
li != deps.end(); ++li) li != deps.end(); ++li)
{ {
@ -4151,11 +4169,11 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
// target itself has a POSITION_INDEPENDENT_CODE which disagrees // target itself has a POSITION_INDEPENDENT_CODE which disagrees
// with a dependency. // with a dependency.
cmTarget const* theTarget = *li; cmGeneratorTarget const* theTarget = *li;
const bool ifaceIsSet = theTarget->GetProperties() const bool ifaceIsSet = theTarget->Target->GetProperties()
.find(interfaceProperty) .find(interfaceProperty)
!= theTarget->GetProperties().end(); != theTarget->Target->GetProperties().end();
PropertyType ifacePropContent = PropertyType ifacePropContent =
getTypedProperty<PropertyType>(theTarget, getTypedProperty<PropertyType>(theTarget,
interfaceProperty); interfaceProperty);
@ -4410,7 +4428,7 @@ void cmGeneratorTarget::LookupLinkItems(std::vector<std::string> const& names,
{ {
continue; continue;
} }
items.push_back(cmLinkItem(name, this->Target->FindTargetToLink(name))); items.push_back(cmLinkItem(name, this->FindTargetToLink(name)));
} }
} }
@ -4473,7 +4491,7 @@ cmGeneratorTarget::GetLinkInterface(const std::string& config,
return &hm.begin()->second; return &hm.begin()->second;
} }
cmOptionalLinkInterface& iface = hm[head->Target]; cmOptionalLinkInterface& iface = hm[head];
if(!iface.LibrariesDone) if(!iface.LibrariesDone)
{ {
iface.LibrariesDone = true; iface.LibrariesDone = true;
@ -4625,7 +4643,7 @@ cmGeneratorTarget::GetLinkInterfaceLibraries(const std::string& config,
return &hm.begin()->second; return &hm.begin()->second;
} }
cmOptionalLinkInterface& iface = hm[head->Target]; cmOptionalLinkInterface& iface = hm[head];
if(!iface.LibrariesDone) if(!iface.LibrariesDone)
{ {
iface.LibrariesDone = true; iface.LibrariesDone = true;
@ -5062,7 +5080,7 @@ cmGeneratorTarget::GetImportLinkInterface(const std::string& config,
return &hm.begin()->second; return &hm.begin()->second;
} }
cmOptionalLinkInterface& iface = hm[headTarget->Target]; cmOptionalLinkInterface& iface = hm[headTarget];
if(!iface.AllDone) if(!iface.AllDone)
{ {
iface.AllDone = true; iface.AllDone = true;
@ -5381,7 +5399,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
// The entry is meant for this configuration. // The entry is meant for this configuration.
impl.Libraries.push_back( impl.Libraries.push_back(
cmLinkImplItem(name, this->Target->FindTargetToLink(name), cmLinkImplItem(name, this->FindTargetToLink(name),
*btIt, evaluated != *le)); *btIt, evaluated != *le));
} }
@ -5413,11 +5431,47 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
} }
// Support OLD behavior for CMP0003. // Support OLD behavior for CMP0003.
impl.WrongConfigLibraries.push_back( impl.WrongConfigLibraries.push_back(
cmLinkItem(name, this->Target->FindTargetToLink(name))); cmLinkItem(name, this->FindTargetToLink(name)));
} }
} }
} }
//----------------------------------------------------------------------------
cmGeneratorTarget*
cmGeneratorTarget::FindTargetToLink(std::string const& name) const
{
cmTarget const* tgt = this->Makefile->FindTargetToUse(name);
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
// within the project.
if(tgt && tgt->GetType() == cmTarget::EXECUTABLE &&
!tgt->IsExecutableWithExports())
{
tgt = 0;
}
if(tgt && tgt->GetType() == cmTarget::OBJECT_LIBRARY)
{
std::ostringstream e;
e << "Target \"" << this->GetName() << "\" links to "
"OBJECT library \"" << tgt->GetName() << "\" but this is not "
"allowed. "
"One may link only to STATIC or SHARED libraries, or to executables "
"with the ENABLE_EXPORTS property set.";
cmake* cm = this->Makefile->GetCMakeInstance();
cm->IssueMessage(cmake::FATAL_ERROR, e.str(),
this->Target->GetBacktrace());
tgt = 0;
}
if (!tgt)
{
return 0;
}
return this->GlobalGenerator->GetGeneratorTarget(tgt);
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string std::string
cmGeneratorTarget::GetPDBDirectory(const std::string& config) const cmGeneratorTarget::GetPDBDirectory(const std::string& config) const
@ -5429,3 +5483,47 @@ cmGeneratorTarget::GetPDBDirectory(const std::string& config) const
} }
return ""; return "";
} }
//----------------------------------------------------------------------------
bool cmGeneratorTarget::HasImplibGNUtoMS() const
{
return this->HasImportLibrary()
&& this->GetPropertyAsBool("GNUtoMS");
}
//----------------------------------------------------------------------------
bool cmGeneratorTarget::GetImplibGNUtoMS(std::string const& gnuName,
std::string& out, const char* newExt) const
{
if(this->HasImplibGNUtoMS() &&
gnuName.size() > 6 && gnuName.substr(gnuName.size()-6) == ".dll.a")
{
out = gnuName.substr(0, gnuName.size()-6);
out += newExt? newExt : ".lib";
return true;
}
return false;
}
//----------------------------------------------------------------------------
bool cmGeneratorTarget::HasImportLibrary() const
{
return (this->Target->IsDLLPlatform() &&
(this->GetType() == cmTarget::SHARED_LIBRARY ||
this->Target->IsExecutableWithExports()));
}
//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetSupportDirectory() const
{
std::string dir = this->Makefile->GetCurrentBinaryDirectory();
dir += cmake::GetCMakeFilesDirectory();
dir += "/";
dir += this->GetName();
#if defined(__VMS)
dir += "_dir";
#else
dir += ".dir";
#endif
return dir;
}

View File

@ -82,6 +82,8 @@ public:
void GetExpectedXamlSources(std::set<std::string>&, void GetExpectedXamlSources(std::set<std::string>&,
const std::string& config) const; const std::string& config) const;
std::set<cmLinkItem>const& GetUtilityItems() const;
void ComputeObjectMapping(); void ComputeObjectMapping();
const char* GetFeature(const std::string& feature, const char* GetFeature(const std::string& feature,
@ -214,6 +216,8 @@ public:
cmOptionalLinkImplementation& impl, cmOptionalLinkImplementation& impl,
const cmGeneratorTarget* head) const; const cmGeneratorTarget* head) const;
cmGeneratorTarget* FindTargetToLink(std::string const& name) const;
// Compute the set of languages compiled by the target. This is // Compute the set of languages compiled by the target. This is
// computed every time it is called because the languages can change // computed every time it is called because the languages can change
// when source file properties are changed and we do not have enough // when source file properties are changed and we do not have enough
@ -386,6 +390,20 @@ public:
///! Return the preferred linker language for this target ///! Return the preferred linker language for this target
std::string GetLinkerLanguage(const std::string& config = "") const; std::string GetLinkerLanguage(const std::string& config = "") const;
/** Does this target have a GNU implib to convert to MS format? */
bool HasImplibGNUtoMS() const;
/** Convert the given GNU import library name (.dll.a) to a name with a new
extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}). */
bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
const char* newExt = 0) const;
/** Return whether or not the target has a DLL import library. */
bool HasImportLibrary() const;
/** Get a build-tree directory in which to place target support files. */
std::string GetSupportDirectory() const;
struct SourceFileFlags struct SourceFileFlags
GetTargetSourceFileFlags(const cmSourceFile* sf) const; GetTargetSourceFileFlags(const cmSourceFile* sf) const;
@ -473,7 +491,7 @@ private:
cmGeneratorTarget(cmGeneratorTarget const&); cmGeneratorTarget(cmGeneratorTarget const&);
void operator=(cmGeneratorTarget const&); void operator=(cmGeneratorTarget const&);
struct LinkImplClosure: public std::vector<cmTarget const*> struct LinkImplClosure: public std::vector<cmGeneratorTarget const*>
{ {
LinkImplClosure(): Done(false) {} LinkImplClosure(): Done(false) {}
bool Done; bool Done;
@ -537,6 +555,7 @@ private:
typedef std::pair<std::string, bool> OutputNameKey; typedef std::pair<std::string, bool> OutputNameKey;
typedef std::map<OutputNameKey, std::string> OutputNameMapType; typedef std::map<OutputNameKey, std::string> OutputNameMapType;
mutable OutputNameMapType OutputNameMap; mutable OutputNameMapType OutputNameMap;
mutable std::set<cmLinkItem> UtilityItems;
mutable bool PolicyWarnedCMP0022; mutable bool PolicyWarnedCMP0022;
mutable bool DebugIncludesDone; mutable bool DebugIncludesDone;
mutable bool DebugCompileOptionsDone; mutable bool DebugCompileOptionsDone;
@ -544,13 +563,14 @@ private:
mutable bool DebugCompileDefinitionsDone; mutable bool DebugCompileDefinitionsDone;
mutable bool DebugSourcesDone; mutable bool DebugSourcesDone;
mutable bool LinkImplementationLanguageIsContextDependent; mutable bool LinkImplementationLanguageIsContextDependent;
mutable bool UtilityItemsDone;
bool ComputePDBOutputDir(const std::string& kind, const std::string& config, bool ComputePDBOutputDir(const std::string& kind, const std::string& config,
std::string& out) const; std::string& out) const;
public: public:
std::vector<cmTarget const*> const& const std::vector<const cmGeneratorTarget*>&
GetLinkImplementationClosure(const std::string& config) const; GetLinkImplementationClosure(const std::string& config) const;
mutable std::map<std::string, std::string> MaxLanguageStandards; mutable std::map<std::string, std::string> MaxLanguageStandards;
std::map<std::string, std::string> const& std::map<std::string, std::string> const&

View File

@ -2893,13 +2893,14 @@ void cmGlobalGenerator::WriteSummary()
{ {
continue; continue;
} }
this->WriteSummary(ti->second); cmGeneratorTarget* gt = this->GetGeneratorTarget(ti->second);
fout << ti->second->GetSupportDirectory() << "\n"; this->WriteSummary(gt);
fout << gt->GetSupportDirectory() << "\n";
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalGenerator::WriteSummary(cmTarget* target) void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
{ {
// Place the labels file in a per-target support directory. // Place the labels file in a per-target support directory.
std::string dir = target->GetSupportDirectory(); std::string dir = target->GetSupportDirectory();
@ -2942,17 +2943,15 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target)
fout << "# Source files and their labels\n"; fout << "# Source files and their labels\n";
std::vector<cmSourceFile*> sources; std::vector<cmSourceFile*> sources;
std::vector<std::string> configs; std::vector<std::string> configs;
target->GetMakefile()->GetConfigurations(configs); target->Target->GetMakefile()->GetConfigurations(configs);
if (configs.empty()) if (configs.empty())
{ {
configs.push_back(""); configs.push_back("");
} }
cmGeneratorTarget* gt =
this->GetGeneratorTarget(target);
for(std::vector<std::string>::const_iterator ci = configs.begin(); for(std::vector<std::string>::const_iterator ci = configs.begin();
ci != configs.end(); ++ci) ci != configs.end(); ++ci)
{ {
gt->GetSourceFiles(sources, *ci); target->GetSourceFiles(sources, *ci);
} }
std::vector<cmSourceFile*>::const_iterator sourcesEnd std::vector<cmSourceFile*>::const_iterator sourcesEnd
= cmRemoveDuplicates(sources); = cmRemoveDuplicates(sources);

View File

@ -458,7 +458,7 @@ private:
void WriteRuleHashes(std::string const& pfile); void WriteRuleHashes(std::string const& pfile);
void WriteSummary(); void WriteSummary();
void WriteSummary(cmTarget* target); void WriteSummary(cmGeneratorTarget* target);
void FinalizeTargetCompileInfo(); void FinalizeTargetCompileInfo();
virtual void ForceLinkerLanguages(); virtual void ForceLinkerLanguages();

View File

@ -135,7 +135,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
filesFrom.push_back(from1); filesFrom.push_back(from1);
filesTo.push_back(to1); filesTo.push_back(to1);
std::string targetNameImportLib; std::string targetNameImportLib;
if(this->Target->Target->GetImplibGNUtoMS(targetNameImport, if(this->Target->GetImplibGNUtoMS(targetNameImport,
targetNameImportLib)) targetNameImportLib))
{ {
filesFrom.push_back(fromDirConfig + targetNameImportLib); filesFrom.push_back(fromDirConfig + targetNameImportLib);
@ -199,7 +199,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
filesFrom.push_back(from1); filesFrom.push_back(from1);
filesTo.push_back(to1); filesTo.push_back(to1);
std::string targetNameImportLib; std::string targetNameImportLib;
if(this->Target->Target->GetImplibGNUtoMS(targetNameImport, if(this->Target->GetImplibGNUtoMS(targetNameImport,
targetNameImportLib)) targetNameImportLib))
{ {
filesFrom.push_back(fromDirConfig + targetNameImportLib); filesFrom.push_back(fromDirConfig + targetNameImportLib);
@ -387,7 +387,7 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
if(nameType == NameImplib) if(nameType == NameImplib)
{ {
// Use the import library name. // Use the import library name.
if(!target->GetImplibGNUtoMS(targetNameImport, fname, if(!gtgt->GetImplibGNUtoMS(targetNameImport, fname,
"${CMAKE_IMPORT_LIBRARY_SUFFIX}")) "${CMAKE_IMPORT_LIBRARY_SUFFIX}"))
{ {
fname = targetNameImport; fname = targetNameImport;
@ -416,7 +416,7 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
if(nameType == NameImplib) if(nameType == NameImplib)
{ {
// Use the import library name. // Use the import library name.
if(!target->GetImplibGNUtoMS(targetNameImport, fname, if(!gtgt->GetImplibGNUtoMS(targetNameImport, fname,
"${CMAKE_IMPORT_LIBRARY_SUFFIX}")) "${CMAKE_IMPORT_LIBRARY_SUFFIX}"))
{ {
fname = targetNameImport; fname = targetNameImport;
@ -563,12 +563,12 @@ cmInstallTargetGenerator
std::map<std::string, std::string> install_name_remap; std::map<std::string, std::string> install_name_remap;
if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config)) if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config))
{ {
std::set<cmTarget const*> const& sharedLibs std::set<cmGeneratorTarget const*> const& sharedLibs
= cli->GetSharedLibrariesLinked(); = cli->GetSharedLibrariesLinked();
for(std::set<cmTarget const*>::const_iterator j = sharedLibs.begin(); for(std::set<cmGeneratorTarget const*>::const_iterator j
j != sharedLibs.end(); ++j) = sharedLibs.begin(); j != sharedLibs.end(); ++j)
{ {
cmTarget const* tgt = *j; cmGeneratorTarget const* tgt = *j;
// The install_name of an imported target does not change. // The install_name of an imported target does not change.
if(tgt->IsImported()) if(tgt->IsImported())
@ -576,20 +576,17 @@ 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 = gtgt->GetInstallNameDirForBuildTree(config); std::string for_build = tgt->GetInstallNameDirForBuildTree(config);
std::string for_install = gtgt->GetInstallNameDirForInstallTree(); std::string for_install = tgt->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
// create the mapping. // create the mapping.
std::string fname = std::string fname =
this->GetInstallFilename(tgt, config, NameSO); this->GetInstallFilename(tgt->Target, config, NameSO);
// Map from the build-tree install_name. // Map from the build-tree install_name.
for_build += fname; for_build += fname;

View File

@ -15,7 +15,7 @@
#include "cmListFileCache.h" #include "cmListFileCache.h"
class cmTarget; class cmGeneratorTarget;
// Basic information about each link item. // Basic information about each link item.
class cmLinkItem: public std::string class cmLinkItem: public std::string
@ -24,9 +24,9 @@ class cmLinkItem: public std::string
public: public:
cmLinkItem(): std_string(), Target(0) {} cmLinkItem(): std_string(), Target(0) {}
cmLinkItem(const std_string& n, cmLinkItem(const std_string& n,
cmTarget const* t): std_string(n), Target(t) {} cmGeneratorTarget const* t): std_string(n), Target(t) {}
cmLinkItem(cmLinkItem const& r): std_string(r), Target(r.Target) {} cmLinkItem(cmLinkItem const& r): std_string(r), Target(r.Target) {}
cmTarget const* Target; cmGeneratorTarget const* Target;
}; };
class cmLinkImplItem: public cmLinkItem class cmLinkImplItem: public cmLinkItem
@ -34,7 +34,7 @@ class cmLinkImplItem: public cmLinkItem
public: public:
cmLinkImplItem(): cmLinkItem(), Backtrace(), FromGenex(false) {} cmLinkImplItem(): cmLinkItem(), Backtrace(), FromGenex(false) {}
cmLinkImplItem(std::string const& n, cmLinkImplItem(std::string const& n,
cmTarget const* t, cmGeneratorTarget const* t,
cmListFileBacktrace const& bt, cmListFileBacktrace const& bt,
bool fromGenex): bool fromGenex):
cmLinkItem(n, t), Backtrace(bt), FromGenex(fromGenex) {} cmLinkItem(n, t), Backtrace(bt), FromGenex(fromGenex) {}
@ -97,7 +97,7 @@ struct cmOptionalLinkInterface: public cmLinkInterface
}; };
struct cmHeadToLinkInterfaceMap: struct cmHeadToLinkInterfaceMap:
public std::map<cmTarget const*, cmOptionalLinkInterface> public std::map<cmGeneratorTarget const*, cmOptionalLinkInterface>
{ {
}; };

View File

@ -259,7 +259,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
cmLocalGenerator::START_OUTPUT, cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED)); cmLocalGenerator::UNCHANGED));
std::string implib; std::string implib;
if(this->Target->GetImplibGNUtoMS(targetFullPathImport, implib)) if(this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport, implib))
{ {
exeCleanFiles.push_back(this->Convert(implib, exeCleanFiles.push_back(this->Convert(implib,
cmLocalGenerator::START_OUTPUT, cmLocalGenerator::START_OUTPUT,
@ -361,7 +361,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
vars.CMTarget = this->Target; vars.CMTarget = this->Target;
vars.Language = linkLanguage.c_str(); vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str(); vars.Objects = buildObjs.c_str();
std::string objectDir = this->Target->GetSupportDirectory(); std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
objectDir = this->Convert(objectDir, objectDir = this->Convert(objectDir,
cmLocalGenerator::START_OUTPUT, cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL); cmLocalGenerator::SHELL);

View File

@ -410,7 +410,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
cmLocalGenerator::START_OUTPUT, cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED)); cmLocalGenerator::UNCHANGED));
std::string implib; std::string implib;
if(this->Target->GetImplibGNUtoMS(targetFullPathImport, implib)) if(this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport, implib))
{ {
libCleanFiles.push_back(this->Convert(implib, libCleanFiles.push_back(this->Convert(implib,
cmLocalGenerator::START_OUTPUT, cmLocalGenerator::START_OUTPUT,
@ -572,7 +572,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
if(this->Target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) if(this->Target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
{ {
std::string name_of_def_file = std::string name_of_def_file =
this->Target->GetSupportDirectory(); this->GeneratorTarget->GetSupportDirectory();
name_of_def_file += std::string("/") + name_of_def_file += std::string("/") +
this->Target->GetName(); this->Target->GetName();
name_of_def_file += ".def"; name_of_def_file += ".def";
@ -643,7 +643,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
vars.CMTarget = this->Target; vars.CMTarget = this->Target;
vars.Language = linkLanguage.c_str(); vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str(); vars.Objects = buildObjs.c_str();
std::string objectDir = this->Target->GetSupportDirectory(); std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
objectDir = this->Convert(objectDir, objectDir = this->Convert(objectDir,
cmLocalGenerator::START_OUTPUT, cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL); cmLocalGenerator::SHELL);

View File

@ -557,7 +557,8 @@ cmMakefileTargetGenerator
this->GeneratorTarget->GetCompilePDBPath(this->ConfigName); this->GeneratorTarget->GetCompilePDBPath(this->ConfigName);
if(targetFullPathCompilePDB.empty()) if(targetFullPathCompilePDB.empty())
{ {
targetFullPathCompilePDB = this->Target->GetSupportDirectory() + "/"; targetFullPathCompilePDB =
this->GeneratorTarget->GetSupportDirectory() + "/";
} }
} }
@ -594,7 +595,7 @@ cmMakefileTargetGenerator
cmLocalGenerator::NONE, cmLocalGenerator::NONE,
cmLocalGenerator::SHELL); cmLocalGenerator::SHELL);
vars.Object = shellObj.c_str(); vars.Object = shellObj.c_str();
std::string objectDir = this->Target->GetSupportDirectory(); std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
objectDir = this->Convert(objectDir, objectDir = this->Convert(objectDir,
cmLocalGenerator::START_OUTPUT, cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL); cmLocalGenerator::SHELL);
@ -1517,7 +1518,7 @@ std::string cmMakefileTargetGenerator::GetLinkRule(
const std::string& linkRuleVar) const std::string& linkRuleVar)
{ {
std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar); std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar);
if(this->Target->HasImplibGNUtoMS()) if(this->GeneratorTarget->HasImplibGNUtoMS())
{ {
std::string ruleVar = "CMAKE_"; std::string ruleVar = "CMAKE_";
ruleVar += this->GeneratorTarget->GetLinkerLanguage(this->ConfigName); ruleVar += this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);

View File

@ -492,9 +492,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
{ {
if(target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) if(target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
{ {
std::string dllname = targetOutput;
std::string name_of_def_file std::string name_of_def_file
= target.GetSupportDirectory(); = gt.GetSupportDirectory();
name_of_def_file += "/" + target.GetName(); name_of_def_file += "/" + target.GetName();
name_of_def_file += ".def "; name_of_def_file += ".def ";
vars["LINK_FLAGS"] += " /DEF:"; vars["LINK_FLAGS"] += " /DEF:";
@ -559,7 +558,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
cmLocalGenerator::SHELL); cmLocalGenerator::SHELL);
vars["TARGET_IMPLIB"] = impLibPath; vars["TARGET_IMPLIB"] = impLibPath;
EnsureParentDirectoryExists(impLibPath); EnsureParentDirectoryExists(impLibPath);
if(target.HasImportLibrary()) if(genTarget.HasImportLibrary())
{ {
byproducts.push_back(targetOutputImplib); byproducts.push_back(targetOutputImplib);
} }
@ -582,7 +581,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
vars["TARGET_PDB"] = base + suffix + dbg_suffix; vars["TARGET_PDB"] = base + suffix + dbg_suffix;
} }
const std::string objPath = GetTarget()->GetSupportDirectory(); const std::string objPath = GetGeneratorTarget()->GetSupportDirectory();
vars["OBJECT_DIR"] = vars["OBJECT_DIR"] =
this->GetLocalGenerator()->ConvertToOutputFormat( this->GetLocalGenerator()->ConvertToOutputFormat(
this->ConvertToNinjaPath(objPath), cmLocalGenerator::SHELL); this->ConvertToNinjaPath(objPath), cmLocalGenerator::SHELL);
@ -634,7 +633,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
this->GetLocalGenerator()->ConvertToOutputFormat( this->GetLocalGenerator()->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
std::string name_of_def_file std::string name_of_def_file
= target.GetSupportDirectory(); = gt.GetSupportDirectory();
name_of_def_file += "/" + target.GetName(); name_of_def_file += "/" + target.GetName();
name_of_def_file += ".def"; name_of_def_file += ".def";
std::string cmd = cmakeCommand; std::string cmd = cmakeCommand;

View File

@ -298,7 +298,7 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const
this->GeneratorTarget->GetCompilePDBPath(this->GetConfigName()); this->GeneratorTarget->GetCompilePDBPath(this->GetConfigName());
if(compilePdbPath.empty()) if(compilePdbPath.empty())
{ {
compilePdbPath = this->Target->GetSupportDirectory() + "/"; compilePdbPath = this->GeneratorTarget->GetSupportDirectory() + "/";
} }
} }
@ -567,7 +567,7 @@ cmNinjaTargetGenerator
std::string const language = source->GetLanguage(); std::string const language = source->GetLanguage();
std::string const sourceFileName = std::string const sourceFileName =
language=="RC" ? source->GetFullPath() : this->GetSourceFilePath(source); language=="RC" ? source->GetFullPath() : this->GetSourceFilePath(source);
std::string const objectDir = this->Target->GetSupportDirectory(); std::string const objectDir = this->GeneratorTarget->GetSupportDirectory();
std::string const objectFileName = this->GetObjectFilePath(source); std::string const objectFileName = this->GetObjectFilePath(source);
std::string const objectFileDir = std::string const objectFileDir =
cmSystemTools::GetFilenamePath(objectFileName); cmSystemTools::GetFilenamePath(objectFileName);

View File

@ -64,7 +64,7 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
std::string basename = cmsys::SystemTools:: std::string basename = cmsys::SystemTools::
GetFilenameWithoutLastExtension(absFile); GetFilenameWithoutLastExtension(absFile);
std::string rcc_output_dir = target->Target->GetSupportDirectory(); std::string rcc_output_dir = target->GetSupportDirectory();
cmSystemTools::MakeDirectory(rcc_output_dir.c_str()); cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
std::string rcc_output_file = rcc_output_dir; std::string rcc_output_file = rcc_output_dir;
rcc_output_file += "/qrc_" + basename + ".cpp"; rcc_output_file += "/qrc_" + basename + ".cpp";
@ -833,7 +833,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
std::string basename = cmsys::SystemTools:: std::string basename = cmsys::SystemTools::
GetFilenameWithoutLastExtension(absFile); GetFilenameWithoutLastExtension(absFile);
std::string rcc_output_dir = target->Target->GetSupportDirectory(); std::string rcc_output_dir = target->GetSupportDirectory();
cmSystemTools::MakeDirectory(rcc_output_dir.c_str()); cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
std::string rcc_output_file = rcc_output_dir; std::string rcc_output_file = rcc_output_dir;
rcc_output_file += "/qrc_" + basename + ".cpp"; rcc_output_file += "/qrc_" + basename + ".cpp";

View File

@ -67,12 +67,10 @@ public:
cmTargetInternals() cmTargetInternals()
: Backtrace() : Backtrace()
{ {
this->UtilityItemsDone = false;
} }
cmTargetInternals(cmTargetInternals const&) cmTargetInternals(cmTargetInternals const&)
: Backtrace() : Backtrace()
{ {
this->UtilityItemsDone = false;
} }
~cmTargetInternals(); ~cmTargetInternals();
@ -82,9 +80,6 @@ public:
typedef std::map<std::string, cmTarget::ImportInfo> ImportInfoMapType; typedef std::map<std::string, cmTarget::ImportInfo> ImportInfoMapType;
ImportInfoMapType ImportInfoMap; ImportInfoMapType ImportInfoMap;
std::set<cmLinkItem> UtilityItems;
bool UtilityItemsDone;
std::vector<std::string> IncludeDirectoriesEntries; std::vector<std::string> IncludeDirectoriesEntries;
std::vector<cmListFileBacktrace> IncludeDirectoriesBacktraces; std::vector<cmListFileBacktrace> IncludeDirectoriesBacktraces;
std::vector<std::string> CompileOptionsEntries; std::vector<std::string> CompileOptionsEntries;
@ -363,22 +358,6 @@ cmListFileBacktrace const* cmTarget::GetUtilityBacktrace(
return &i->second; return &i->second;
} }
//----------------------------------------------------------------------------
std::set<cmLinkItem> const& cmTarget::GetUtilityItems() const
{
if(!this->Internal->UtilityItemsDone)
{
this->Internal->UtilityItemsDone = true;
for(std::set<std::string>::const_iterator i = this->Utilities.begin();
i != this->Utilities.end(); ++i)
{
this->Internal->UtilityItems.insert(
cmLinkItem(*i, this->Makefile->FindTargetToUse(*i)));
}
}
return this->Internal->UtilityItems;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::FinishConfigure() void cmTarget::FinishConfigure()
{ {
@ -402,21 +381,6 @@ cmListFileBacktrace const& cmTarget::GetBacktrace() const
return this->Internal->Backtrace; return this->Internal->Backtrace;
} }
//----------------------------------------------------------------------------
std::string cmTarget::GetSupportDirectory() const
{
std::string dir = this->Makefile->GetCurrentBinaryDirectory();
dir += cmake::GetCMakeFilesDirectory();
dir += "/";
dir += this->Name;
#if defined(__VMS)
dir += "_dir";
#else
dir += ".dir";
#endif
return dir;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmTarget::IsExecutableWithExports() const bool cmTarget::IsExecutableWithExports() const
{ {
@ -2219,26 +2183,6 @@ void cmTarget::ComputeVersionedName(std::string& vName,
vName += this->IsApple? suffix : std::string(); vName += this->IsApple? suffix : std::string();
} }
//----------------------------------------------------------------------------
bool cmTarget::HasImplibGNUtoMS() const
{
return this->HasImportLibrary() && this->GetPropertyAsBool("GNUtoMS");
}
//----------------------------------------------------------------------------
bool cmTarget::GetImplibGNUtoMS(std::string const& gnuName,
std::string& out, const char* newExt) const
{
if(this->HasImplibGNUtoMS() &&
gnuName.size() > 6 && gnuName.substr(gnuName.size()-6) == ".dll.a")
{
out = gnuName.substr(0, gnuName.size()-6);
out += newExt? newExt : ".lib";
return true;
}
return false;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::SetPropertyDefault(const std::string& property, void cmTarget::SetPropertyDefault(const std::string& property,
const char* default_value) const char* default_value)
@ -2690,37 +2634,6 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
} }
} }
//----------------------------------------------------------------------------
cmTarget const* cmTarget::FindTargetToLink(std::string const& name) const
{
cmTarget const* tgt = this->Makefile->FindTargetToUse(name);
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
// within the project.
if(tgt && tgt->GetType() == cmTarget::EXECUTABLE &&
!tgt->IsExecutableWithExports())
{
tgt = 0;
}
if(tgt && tgt->GetType() == cmTarget::OBJECT_LIBRARY)
{
std::ostringstream e;
e << "Target \"" << this->GetName() << "\" links to "
"OBJECT library \"" << tgt->GetName() << "\" but this is not "
"allowed. "
"One may link only to STATIC or SHARED libraries, or to executables "
"with the ENABLE_EXPORTS property set.";
cmake* cm = this->Makefile->GetCMakeInstance();
cm->IssueMessage(cmake::FATAL_ERROR, e.str(), this->GetBacktrace());
tgt = 0;
}
// Return the target found, if any.
return tgt;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string cmTarget::CheckCMP0004(std::string const& item) const std::string cmTarget::CheckCMP0004(std::string const& item) const
{ {

View File

@ -16,7 +16,6 @@
#include "cmPropertyMap.h" #include "cmPropertyMap.h"
#include "cmPolicies.h" #include "cmPolicies.h"
#include "cmListFileCache.h" #include "cmListFileCache.h"
#include "cmLinkItem.h"
#include <cmsys/auto_ptr.hxx> #include <cmsys/auto_ptr.hxx>
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
@ -206,7 +205,6 @@ public:
void AddUtility(const std::string& u, cmMakefile *makefile = 0); void AddUtility(const std::string& u, cmMakefile *makefile = 0);
///! Get the utilities used by this target ///! Get the utilities used by this target
std::set<std::string>const& GetUtilities() const { return this->Utilities; } std::set<std::string>const& GetUtilities() const { return this->Utilities; }
std::set<cmLinkItem>const& GetUtilityItems() const;
cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const; cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const;
/** Finalize the target at the end of the Configure step. */ /** Finalize the target at the end of the Configure step. */
@ -225,8 +223,6 @@ public:
void GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const; void GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) 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
the link dependencies of this target. */ the link dependencies of this target. */
std::string CheckCMP0004(std::string const& item) const; std::string CheckCMP0004(std::string const& item) const;
@ -244,14 +240,6 @@ public:
void void
GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const; GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const;
/** Does this target have a GNU implib to convert to MS format? */
bool HasImplibGNUtoMS() const;
/** Convert the given GNU import library name (.dll.a) to a name with a new
extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}). */
bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
const char* newExt = 0) const;
// Get the properties // Get the properties
cmPropertyMap &GetProperties() const { return this->Properties; } cmPropertyMap &GetProperties() const { return this->Properties; }
@ -274,9 +262,6 @@ public:
/** Return whether or not the target is for a DLL platform. */ /** Return whether or not the target is for a DLL platform. */
bool IsDLLPlatform() const { return this->DLLPlatform; } bool IsDLLPlatform() const { return this->DLLPlatform; }
/** Return whether or not the target has a DLL import library. */
bool HasImportLibrary() const;
/** Return whether this target is a shared library Framework on /** Return whether this target is a shared library Framework on
Apple. */ Apple. */
bool IsFrameworkOnApple() const; bool IsFrameworkOnApple() const;
@ -297,9 +282,6 @@ public:
/** Get a backtrace from the creation of the target. */ /** Get a backtrace from the creation of the target. */
cmListFileBacktrace const& GetBacktrace() const; cmListFileBacktrace const& GetBacktrace() const;
/** Get a build-tree directory in which to place target support files. */
std::string GetSupportDirectory() 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;
@ -475,6 +457,9 @@ private:
void MaybeInvalidatePropertyCache(const std::string& prop); void MaybeInvalidatePropertyCache(const std::string& prop);
/** Return whether or not the target has a DLL import library. */
bool HasImportLibrary() const;
// Internal representation details. // Internal representation details.
friend class cmTargetInternals; friend class cmTargetInternals;
friend class cmGeneratorTarget; friend class cmGeneratorTarget;