[Cmake-commits] CMake branch, next, updated. v2.8.12.1-7023-gc34122d
Stephen Kelly
steveire at gmail.com
Sat Jan 11 05:13:55 EST 2014
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via c34122dd32d7f0d9c3ca37712cbb309f7984fe04 (commit)
via 72ab62e2ea297ced3718cfef120fc073ae1ef39c (commit)
via 26e4936815ee6d822cb6b36ec1ba1b950f2b397f (commit)
via 00f42efe2c1c66c7ad64ff99b65b70b6848fea46 (commit)
via 6130982d4ae5c5720598418c7c9ad278e0c259cd (commit)
via 5bdee48b5d0d047570fe6a9ee91a3ffaca2e4f08 (commit)
via 212048a7854b925e2e0d2d7a8787598482d11b6c (commit)
via d69841c7eb6561baebb218a620bf751f43a5ed40 (commit)
via eba2cc74da17c9e016b728027150ab24e2648efe (commit)
via 95b8ea1c93f3322d8a988700dbed48e6e2a3af4f (commit)
via 645e609b9a9d1491d0e48c61efb5285977be8aa4 (commit)
via 411082b879ed82dfbe581bd44ec3201424819699 (commit)
via a7a784530cbf51a24850180fdf4fbaac3d73a657 (commit)
via 49ff6dd2b73b4b803de96f23f5399d5ad511d6e2 (commit)
via e406308b7cd2a98210125366231f3d87deaf516d (commit)
via b1d2fe596a424c80db06b868f2fb0c5d0d3c806f (commit)
via 6df00db520ff9c97705b9852ac8c3301d789b82b (commit)
via 912d9e803446aba832b539e79b1f5b7b9434c8aa (commit)
via 7034bb80d30cfb718db1621f7837e8f3241dd008 (commit)
via 65ca1f0bf6abfa1810dea64bea762967de0bc283 (commit)
via 7beea6870e66d990f2ecd12580169bfef14ae40b (commit)
via 636906a03952d6f8c116a2cfb5976de9cfa5e38e (commit)
via 9f05621d7c412cee44161426bea667b40777d96d (commit)
via b167fe258144f8d9a120c12d152c4759a3cfe12d (commit)
via c217692a8f19f7e509bee9a29e01722e4b43fdc3 (commit)
via 76684b7ae4541f6040f91bab77bede1aa06bf75a (commit)
via cf72a09bd763b2c7e02ee97b1b512f4c528acbdf (commit)
via afcfb18bb8187d6e82a7b5f8d52fadf114d73943 (commit)
via 5cb11f54814ce86c0b6d36738eaa4992866a6fe8 (commit)
via c773e6ab815f830d294e3a31bffe72deab7a1fc5 (commit)
via 229ed96916414364184ce6742caf43ee315ba5e2 (commit)
via 1699ae1bf34147fc569ee82670a403724082bfd4 (commit)
via d4aae11c7d5d2f97ab2058d4b0c69914105f5999 (commit)
via 90ac11b74636c7b622ad57793dbdf20c4fa562c9 (commit)
via 347d5c0503327d04e06786899bd58898cd484b8d (commit)
via f6229ef1ffa08c36e7b97b11a07c3a40991917b6 (commit)
via 824cc50ead5eb9a5178a2215dc6fa38a5549dfab (commit)
via 44b57fb52bd72a388bc010a37b2be8005e22822c (commit)
via cb7af7af44bd9ce5ac11e345b1756ea0770bbc83 (commit)
from dadfba9818808c980e345b8ea37d790eb361df0e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c34122dd32d7f0d9c3ca37712cbb309f7984fe04
commit c34122dd32d7f0d9c3ca37712cbb309f7984fe04
Merge: dadfba9 72ab62e
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jan 11 05:13:48 2014 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sat Jan 11 05:13:48 2014 -0500
Merge topic 'use-generator-target' into next
72ab62e Merge note: Dashboard testing.
26e4936 Remove old-style link dependency code.
00f42ef Move GetOutputName to cmGeneratorTarget.
6130982 Move link libraries methods to cmGeneratorTarget.
5bdee48 Port cmComputeTargetDepends to cmGeneratorTarget.
212048a Move HaveBuildTreeRPATH to cmGeneratorTarget.
d69841c Move ComputeVersionedName to cmGeneratorTarget.
eba2cc7 Port part of cmLinkInformation to cmGeneratorTarget.
95b8ea1 Move HasMacOSXRPath to cmGeneratorTarget.
645e609 Move GetLinkImplementation to cmGeneratorTarget.
411082b Move GetLinkInterface to cmGeneratorTarget.
a7a7845 Move GetLinkClosure to cmGeneratorTarget.
49ff6dd Move GetLinkerLanguage to cmGeneratorTarget.
e406308 Make ForceLinkerLanguages virtual.
b1d2fe5 Move GetFullNameInternal to cmGeneratorTarget.
6df00db Move GetFullName to cmGeneratorTarget.
...
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=72ab62e2ea297ced3718cfef120fc073ae1ef39c
commit 72ab62e2ea297ced3718cfef120fc073ae1ef39c
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Jan 10 21:55:30 2014 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:09 2014 +0100
Merge note: Dashboard testing.
This topic is not going to be merged to master until CMake 4.0, but
is being merged now to next to find issues reportable by the dashboard
which should be fixed before 3.0.
diff --git a/TempMerge b/TempMerge
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/TempMerge
@@ -0,0 +1 @@
+1
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=26e4936815ee6d822cb6b36ec1ba1b950f2b397f
commit 26e4936815ee6d822cb6b36ec1ba1b950f2b397f
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Dec 10 11:30:08 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:09 2014 +0100
Remove old-style link dependency code.
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 1e2a85c..7aeed5d 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -17,7 +17,6 @@
#include "cmCMakeHostSystemInformationCommand.cxx"
#include "cmElseIfCommand.cxx"
#include "cmExportCommand.cxx"
-#include "cmExportLibraryDependencies.cxx"
#include "cmFLTKWrapUICommand.cxx"
#include "cmIncludeExternalMSProjectCommand.cxx"
#include "cmInstallProgramsCommand.cxx"
@@ -60,7 +59,6 @@ void GetPredefinedCommands(std::list<cmCommand*>&
commands.push_back(new cmCMakeHostSystemInformationCommand);
commands.push_back(new cmElseIfCommand);
commands.push_back(new cmExportCommand);
- commands.push_back(new cmExportLibraryDependenciesCommand);
commands.push_back(new cmFLTKWrapUICommand);
commands.push_back(new cmIncludeExternalMSProjectCommand);
commands.push_back(new cmInstallProgramsCommand);
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index cc34132..ddd7bc7 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -190,9 +190,6 @@ cmComputeLinkDepends
// Enable debug mode if requested.
this->DebugMode = this->Makefile->IsOn("CMAKE_LINK_DEPENDS_DEBUG_MODE");
- // Assume no compatibility until set.
- this->OldLinkDirMode = false;
-
// No computation has been done.
this->CCG = 0;
}
@@ -210,12 +207,6 @@ cmComputeLinkDepends::~cmComputeLinkDepends()
}
//----------------------------------------------------------------------------
-void cmComputeLinkDepends::SetOldLinkDirMode(bool b)
-{
- this->OldLinkDirMode = b;
-}
-
-//----------------------------------------------------------------------------
std::vector<cmComputeLinkDepends::LinkEntry> const&
cmComputeLinkDepends::Compute()
{
@@ -226,7 +217,7 @@ cmComputeLinkDepends::Compute()
while(!this->BFSQueue.empty())
{
// Get the next entry.
- BFSEntry qe = this->BFSQueue.front();
+ int qe = this->BFSQueue.front();
this->BFSQueue.pop();
// Follow the entry's dependencies.
@@ -318,35 +309,21 @@ int cmComputeLinkDepends::AddLinkEntry(int depender_index,
if(entry.Target)
{
// Target dependencies are always known. Follow them.
- BFSEntry qe = {index, 0};
- this->BFSQueue.push(qe);
+ this->BFSQueue.push(index);
}
- else
+ else if(!entry.IsFlag)
{
- // Look for an old-style <item>_LIB_DEPENDS variable.
- std::string var = entry.Item;
- var += "_LIB_DEPENDS";
- if(const char* val = this->Makefile->GetDefinition(var.c_str()))
- {
- // The item dependencies are known. Follow them.
- BFSEntry qe = {index, val};
- this->BFSQueue.push(qe);
- }
- else if(!entry.IsFlag)
- {
- // The item dependencies are not known. We need to infer them.
- this->InferredDependSets[index] = new DependSetList;
- }
+ // The item dependencies are not known. We need to infer them.
+ this->InferredDependSets[index] = new DependSetList;
}
return index;
}
//----------------------------------------------------------------------------
-void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
+void cmComputeLinkDepends::FollowLinkEntry(int depender_index)
{
// Get this entry representation.
- int depender_index = qe.Index;
LinkEntry const& entry = this->EntryList[depender_index];
// Follow the item's dependencies.
@@ -371,21 +348,8 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
// Handle dependent shared libraries.
this->FollowSharedDeps(depender_index, iface);
-
- // Support for CMP0003.
- for(std::vector<std::string>::const_iterator
- oi = iface->WrongConfigLibraries.begin();
- oi != iface->WrongConfigLibraries.end(); ++oi)
- {
- this->CheckWrongConfigItem(depender_index, *oi);
- }
}
}
- else
- {
- // Follow the old-style dependency list.
- this->AddVarLinkEntries(depender_index, qe.LibDepends);
- }
}
//----------------------------------------------------------------------------
@@ -469,82 +433,6 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
}
//----------------------------------------------------------------------------
-void cmComputeLinkDepends::AddVarLinkEntries(int depender_index,
- const char* value)
-{
- // This is called to add the dependencies named by
- // <item>_LIB_DEPENDS. The variable contains a semicolon-separated
- // list. The list contains link-type;item pairs and just items.
- std::vector<std::string> deplist;
- cmSystemTools::ExpandListArgument(value, deplist);
-
- // Look for entries meant for this configuration.
- std::vector<std::string> actual_libs;
- cmTarget::LinkLibraryType llt = cmTarget::GENERAL;
- bool haveLLT = false;
- for(std::vector<std::string>::const_iterator di = deplist.begin();
- di != deplist.end(); ++di)
- {
- if(*di == "debug")
- {
- llt = cmTarget::DEBUG;
- haveLLT = true;
- }
- else if(*di == "optimized")
- {
- llt = cmTarget::OPTIMIZED;
- haveLLT = true;
- }
- else if(*di == "general")
- {
- llt = cmTarget::GENERAL;
- haveLLT = true;
- }
- else if(!di->empty())
- {
- // If no explicit link type was given prior to this entry then
- // check if the entry has its own link type variable. This is
- // needed for compatibility with dependency files generated by
- // the export_library_dependencies command from CMake 2.4 and
- // lower.
- if(!haveLLT)
- {
- std::string var = *di;
- var += "_LINK_TYPE";
- if(const char* val = this->Makefile->GetDefinition(var.c_str()))
- {
- if(strcmp(val, "debug") == 0)
- {
- llt = cmTarget::DEBUG;
- }
- else if(strcmp(val, "optimized") == 0)
- {
- llt = cmTarget::OPTIMIZED;
- }
- }
- }
-
- // If the library is meant for this link type then use it.
- if(llt == cmTarget::GENERAL || llt == this->LinkType)
- {
- actual_libs.push_back(*di);
- }
- else if(this->OldLinkDirMode)
- {
- this->CheckWrongConfigItem(depender_index, *di);
- }
-
- // Reset the link type until another explicit type is given.
- llt = cmTarget::GENERAL;
- haveLLT = false;
- }
- }
-
- // Add the entries from this list.
- this->AddLinkEntries(depender_index, actual_libs);
-}
-
-//----------------------------------------------------------------------------
void cmComputeLinkDepends::AddDirectLinkEntries()
{
cmGeneratorTarget *gtgt = this->Target->GetMakefile()->GetLocalGenerator()
@@ -554,12 +442,6 @@ void cmComputeLinkDepends::AddDirectLinkEntries()
cmGeneratorTarget::LinkImplementation const* impl =
gtgt->GetLinkImplementation(this->Config, this->HeadTarget);
this->AddLinkEntries(-1, impl->Libraries);
- for(std::vector<std::string>::const_iterator
- wi = impl->WrongConfigLibraries.begin();
- wi != impl->WrongConfigLibraries.end(); ++wi)
- {
- this->CheckWrongConfigItem(-1, *wi);
- }
}
//----------------------------------------------------------------------------
@@ -576,7 +458,7 @@ cmComputeLinkDepends::AddLinkEntries(int depender_index,
{
// Skip entries that will resolve to the target getting linked or
// are empty.
- std::string item = this->Target->CheckCMP0004(*li);
+ std::string item = *li;
if(item == this->Target->GetName() || item.empty())
{
continue;
@@ -997,25 +879,3 @@ void cmComputeLinkDepends::DisplayFinalEntries()
}
fprintf(stderr, "\n");
}
-
-//----------------------------------------------------------------------------
-void cmComputeLinkDepends::CheckWrongConfigItem(int depender_index,
- std::string const& item)
-{
- if(!this->OldLinkDirMode)
- {
- return;
- }
-
- // For CMake 2.4 bug-compatibility we need to consider the output
- // directories of targets linked in another configuration as link
- // directories.
- if(cmTarget const* tgt
- = this->FindTargetToLink(depender_index, item.c_str()))
- {
- if(!tgt->IsImported())
- {
- this->OldWrongConfigItems.insert(tgt);
- }
- }
-}
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index bf0b55c..ffa9c00 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -52,10 +52,6 @@ public:
typedef std::vector<LinkEntry> EntryVector;
EntryVector const& Compute();
- void SetOldLinkDirMode(bool b);
- std::set<cmTarget const*> const& GetOldWrongConfigItems() const
- { return this->OldWrongConfigItems; }
-
private:
// Context information.
@@ -79,7 +75,6 @@ private:
std::map<cmStdString, int>::iterator
AllocateLinkEntry(std::string const& item);
int AddLinkEntry(int depender_index, std::string const& item);
- void AddVarLinkEntries(int depender_index, const char* value);
void AddDirectLinkEntries();
void AddLinkEntries(int depender_index,
std::vector<std::string> const& libs);
@@ -89,14 +84,8 @@ private:
std::vector<LinkEntry> EntryList;
std::map<cmStdString, int> LinkEntryIndex;
- // BFS of initial dependencies.
- struct BFSEntry
- {
- int Index;
- const char* LibDepends;
- };
- std::queue<BFSEntry> BFSQueue;
- void FollowLinkEntry(BFSEntry const&);
+ std::queue<int> BFSQueue;
+ void FollowLinkEntry(int);
// Shared libraries that are included only because they are
// dependencies of other shared libraries, not because they are part
@@ -160,11 +149,6 @@ private:
// Record of the original link line.
std::vector<int> OriginalEntries;
-
- // Compatibility help.
- bool OldLinkDirMode;
- void CheckWrongConfigItem(int depender_index, std::string const& item);
- std::set<cmTarget const*> OldWrongConfigItems;
};
#endif
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 74102c6..a873f46 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -395,32 +395,6 @@ cmComputeLinkInformation
this->OrderDependentRPath
->AddLanguageDirectories(this->RuntimeLinkDirs);
}
-
- // Decide whether to enable compatible library search path mode.
- // There exists code that effectively does
- //
- // /path/to/libA.so -lB
- //
- // where -lB is meant to link to /path/to/libB.so. This is broken
- // because it specified -lB without specifying a link directory (-L)
- // in which to search for B. This worked in CMake 2.4 and below
- // because -L/path/to would be added by the -L/-l split for A. In
- // order to support such projects we need to add the directories
- // containing libraries linked with a full path to the -L path.
- this->OldLinkDirMode =
- this->Target->Target->GetPolicyStatusCMP0003() != cmPolicies::NEW;
- if(this->OldLinkDirMode)
- {
- // Construct a mask to not bother with this behavior for link
- // directories already specified by the user.
- std::vector<std::string> const& dirs =
- this->Target->Target->GetLinkDirectories();
- for(std::vector<std::string>::const_iterator di = dirs.begin();
- di != dirs.end(); ++di)
- {
- this->OldLinkDirMask.insert(*di);
- }
- }
}
//----------------------------------------------------------------------------
@@ -512,7 +486,6 @@ bool cmComputeLinkInformation::Compute()
// Compute the ordered link line items.
cmComputeLinkDepends cld(this->Target->Target, this->Config,
this->HeadTarget->Target);
- cld.SetOldLinkDirMode(this->OldLinkDirMode);
cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute();
// Add the link line items.
@@ -542,34 +515,6 @@ bool cmComputeLinkInformation::Compute()
this->SetCurrentLinkType(this->StartLinkType);
}
- // Finish listing compatibility paths.
- if(this->OldLinkDirMode)
- {
- // For CMake 2.4 bug-compatibility we need to consider the output
- // directories of targets linked in another configuration as link
- // directories.
- std::set<cmTarget const*> const& wrongItems = cld.GetOldWrongConfigItems();
- for(std::set<cmTarget const*>::const_iterator i = wrongItems.begin();
- i != wrongItems.end(); ++i)
- {
- cmTarget const* tgt = *i;
- cmGeneratorTarget *gtgt = tgt->GetMakefile()->GetLocalGenerator()
- ->GetGlobalGenerator()
- ->GetGeneratorTarget(tgt);
- bool implib =
- (this->UseImportLibrary &&
- (tgt->GetType() == cmTarget::SHARED_LIBRARY));
- std::string lib = gtgt->GetFullPath(this->Config , implib, true);
- this->OldLinkDirItems.push_back(lib);
- }
- }
-
- // Finish setting up linker search directories.
- if(!this->FinishLinkerSearchDirectories())
- {
- return false;
- }
-
// Add implicit language runtime libraries and directories.
this->AddImplicitLinkInfo();
@@ -709,7 +654,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
else
{
// This is a library or option specified by the user.
- this->AddUserItem(item, true);
+ this->AddUserItem(item);
}
}
}
@@ -1117,15 +1062,6 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
this->Items.push_back(Item(this->LibLinkFileFlag, false));
}
- // For compatibility with CMake 2.4 include the item's directory in
- // the linker search path.
- if(this->OldLinkDirMode && !target->IsFrameworkOnApple() &&
- this->OldLinkDirMask.find(cmSystemTools::GetFilenamePath(item)) ==
- this->OldLinkDirMask.end())
- {
- this->OldLinkDirItems.push_back(item);
- }
-
// Now add the full path to the library.
this->Items.push_back(Item(item, true, target));
}
@@ -1180,15 +1116,6 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
}
}
- // For compatibility with CMake 2.4 include the item's directory in
- // the linker search path.
- if(this->OldLinkDirMode &&
- this->OldLinkDirMask.find(cmSystemTools::GetFilenamePath(item)) ==
- this->OldLinkDirMask.end())
- {
- this->OldLinkDirItems.push_back(item);
- }
-
// If this platform wants a flag before the full path, add it.
if(!this->LibLinkFileFlag.empty())
{
@@ -1233,7 +1160,7 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item)
// directory then just report the file name without the directory
// portion. This will allow the system linker to locate the proper
// library for the architecture at link time.
- this->AddUserItem(file, false);
+ this->AddUserItem(file);
// Make sure the link directory ordering will find the library.
this->OrderLinkerSearchPath->AddLinkLibrary(item);
@@ -1242,8 +1169,7 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item)
}
//----------------------------------------------------------------------------
-void cmComputeLinkInformation::AddUserItem(std::string const& item,
- bool pathNotKnown)
+void cmComputeLinkInformation::AddUserItem(std::string const& item)
{
// This is called to handle a link item that does not match a CMake
// target and is not a full path. We check here if it looks like a
@@ -1256,16 +1182,6 @@ void cmComputeLinkInformation::AddUserItem(std::string const& item,
// Pass flags through untouched.
if(item[0] == '-' || item[0] == '$' || item[0] == '`')
{
- // if this is a -l option then we might need to warn about
- // CMP0003 so put it in OldUserFlagItems, if it is not a -l
- // or -Wl,-l (-framework -pthread), then allow it without a
- // CMP0003 as -L will not affect those other linker flags
- if(item.find("-l") == 0 || item.find("-Wl,-l") == 0)
- {
- // This is a linker option provided by the user.
- this->OldUserFlagItems.push_back(item);
- }
-
// Restore the target link type since this item does not specify
// one.
this->SetCurrentLinkType(this->StartLinkType);
@@ -1334,12 +1250,6 @@ void cmComputeLinkInformation::AddUserItem(std::string const& item,
}
else
{
- // This is a name specified by the user.
- if(pathNotKnown)
- {
- this->OldUserFlagItems.push_back(item);
- }
-
// We must ask the linker to search for a library with this name.
// Restore the target link type since this item does not specify
// one.
@@ -1493,7 +1403,7 @@ void cmComputeLinkInformation::AddSharedLibNoSOName(std::string const& item)
// runtime the dynamic linker will search for the library using the
// path instead of just the name.
std::string file = cmSystemTools::GetFilenameName(item);
- this->AddUserItem(file, false);
+ this->AddUserItem(file);
// Make sure the link directory ordering will find the library.
this->OrderLinkerSearchPath->AddLinkLibrary(item);
@@ -1512,9 +1422,8 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
}
// Tell the linker to search for the item and provide the proper
- // path for it. Do not contribute to any CMP0003 warning (do not
- // put in OldLinkDirItems or OldUserFlagItems).
- this->AddUserItem(file, false);
+ // path for it.
+ this->AddUserItem(file);
this->OrderLinkerSearchPath->AddLinkLibrary(item);
// Produce any needed message.
@@ -1561,127 +1470,6 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
}
//----------------------------------------------------------------------------
-bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
-{
- // Support broken projects if necessary.
- if(this->OldLinkDirItems.empty() || this->OldUserFlagItems.empty() ||
- !this->OldLinkDirMode)
- {
- return true;
- }
-
- // Enforce policy constraints.
- switch(this->Target->Target->GetPolicyStatusCMP0003())
- {
- case cmPolicies::WARN:
- if(!this->CMakeInstance->GetPropertyAsBool("CMP0003-WARNING-GIVEN"))
- {
- this->CMakeInstance->SetProperty("CMP0003-WARNING-GIVEN", "1");
- cmOStringStream w;
- this->PrintLinkPolicyDiagnosis(w);
- this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
- this->Target->Target->GetBacktrace());
- }
- case cmPolicies::OLD:
- // OLD behavior is to add the paths containing libraries with
- // known full paths as link directories.
- break;
- case cmPolicies::NEW:
- // Should never happen due to assignment of OldLinkDirMode
- return true;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- {
- cmOStringStream e;
- e << (this->Makefile->GetPolicies()->
- GetRequiredPolicyError(cmPolicies::CMP0003)) << "\n";
- this->PrintLinkPolicyDiagnosis(e);
- this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(),
- this->Target->Target->GetBacktrace());
- return false;
- }
- }
-
- // Add the link directories for full path items.
- for(std::vector<std::string>::const_iterator
- i = this->OldLinkDirItems.begin();
- i != this->OldLinkDirItems.end(); ++i)
- {
- this->OrderLinkerSearchPath->AddLinkLibrary(*i);
- }
- return true;
-}
-
-//----------------------------------------------------------------------------
-void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os)
-{
- // Tell the user what to do.
- os << "Policy CMP0003 should be set before this line. "
- << "Add code such as\n"
- << " if(COMMAND cmake_policy)\n"
- << " cmake_policy(SET CMP0003 NEW)\n"
- << " endif(COMMAND cmake_policy)\n"
- << "as early as possible but after the most recent call to "
- << "cmake_minimum_required or cmake_policy(VERSION). ";
-
- // List the items that might need the old-style paths.
- os << "This warning appears because target \""
- << this->Target->GetName() << "\" "
- << "links to some libraries for which the linker must search:\n";
- {
- // Format the list of unknown items to be as short as possible while
- // still fitting in the allowed width (a true solution would be the
- // bin packing problem if we were allowed to change the order).
- std::string::size_type max_size = 76;
- std::string line;
- const char* sep = " ";
- for(std::vector<std::string>::const_iterator
- i = this->OldUserFlagItems.begin();
- i != this->OldUserFlagItems.end(); ++i)
- {
- // If the addition of another item will exceed the limit then
- // output the current line and reset it. Note that the separator
- // is either " " or ", " which is always 2 characters.
- if(!line.empty() && (line.size() + i->size() + 2) > max_size)
- {
- os << line << "\n";
- sep = " ";
- line = "";
- }
- line += sep;
- line += *i;
- // Convert to the other separator.
- sep = ", ";
- }
- if(!line.empty())
- {
- os << line << "\n";
- }
- }
-
- // List the paths old behavior is adding.
- os << "and other libraries with known full path:\n";
- std::set<cmStdString> emitted;
- for(std::vector<std::string>::const_iterator
- i = this->OldLinkDirItems.begin();
- i != this->OldLinkDirItems.end(); ++i)
- {
- if(emitted.insert(cmSystemTools::GetFilenamePath(*i)).second)
- {
- os << " " << *i << "\n";
- }
- }
-
- // Explain.
- os << "CMake is adding directories in the second list to the linker "
- << "search path in case they are needed to find libraries from the "
- << "first list (for backwards compatibility with CMake 2.4). "
- << "Set policy CMP0003 to OLD or NEW to enable or disable this "
- << "behavior explicitly. "
- << "Run \"cmake --help-policy CMP0003\" for more information.";
-}
-
-//----------------------------------------------------------------------------
void cmComputeLinkInformation::LoadImplicitLinkInfo()
{
std::vector<std::string> implicitDirVec;
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index c39cb31..c26e39e 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -143,7 +143,7 @@ private:
void AddTargetItem(std::string const& item, cmTarget const* target);
void AddFullItem(std::string const& item);
bool CheckImplicitDirItem(std::string const& item);
- void AddUserItem(std::string const& item, bool pathNotKnown);
+ void AddUserItem(std::string const& item);
void AddDirectoryItem(std::string const& item);
void AddFrameworkItem(std::string const& item);
void DropDirectoryItem(std::string const& item);
@@ -159,8 +159,6 @@ private:
// Linker search path computation.
cmOrderDirectories* OrderLinkerSearchPath;
- bool FinishLinkerSearchDirectories();
- void PrintLinkPolicyDiagnosis(std::ostream&);
// Implicit link libraries and directories for linker language.
void LoadImplicitLinkInfo();
@@ -172,12 +170,6 @@ private:
// Additional paths configured by the runtime linker
std::vector<std::string> RuntimeLinkDirs;
- // Linker search path compatibility mode.
- std::set<cmStdString> OldLinkDirMask;
- std::vector<std::string> OldLinkDirItems;
- std::vector<std::string> OldUserFlagItems;
- bool OldLinkDirMode;
-
// Runtime path computation.
cmOrderDirectories* OrderRuntimeSearchPath;
void AddLibraryRuntimeInfo(std::string const& fullPath,
diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx
deleted file mode 100644
index 4624e92..0000000
--- a/Source/cmExportLibraryDependencies.cxx
+++ /dev/null
@@ -1,208 +0,0 @@
-/*============================================================================
- CMake - Cross Platform Makefile Generator
- Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
- Distributed under the OSI-approved BSD License (the "License");
- see accompanying file Copyright.txt for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even the
- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the License for more information.
-============================================================================*/
-#include "cmExportLibraryDependencies.h"
-#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
-#include "cmGeneratedFileStream.h"
-#include "cmake.h"
-#include "cmVersion.h"
-
-#include <cmsys/auto_ptr.hxx>
-
-bool cmExportLibraryDependenciesCommand
-::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
-{
- if(this->Disallowed(cmPolicies::CMP0033,
- "The export_library_dependencies command should not be called; "
- "see CMP0033."))
- { return true; }
- if(args.size() < 1 )
- {
- this->SetError("called with incorrect number of arguments");
- return false;
- }
-
- // store the arguments for the final pass
- this->Filename = args[0];
- this->Append = false;
- if(args.size() > 1)
- {
- if(args[1] == "APPEND")
- {
- this->Append = true;
- }
- }
- return true;
-}
-
-
-void cmExportLibraryDependenciesCommand::FinalPass()
-{
- // export_library_dependencies() shouldn't modify anything
- // ensure this by calling a const method
- this->ConstFinalPass();
-}
-
-void cmExportLibraryDependenciesCommand::ConstFinalPass() const
-{
- // Use copy-if-different if not appending.
- cmsys::auto_ptr<cmsys::ofstream> foutPtr;
- if(this->Append)
- {
- cmsys::auto_ptr<cmsys::ofstream> ap(
- new cmsys::ofstream(this->Filename.c_str(), std::ios::app));
- foutPtr = ap;
- }
- else
- {
- cmsys::auto_ptr<cmGeneratedFileStream> ap(
- new cmGeneratedFileStream(this->Filename.c_str(), true));
- ap->SetCopyIfDifferent(true);
- foutPtr = ap;
- }
- std::ostream& fout = *foutPtr.get();
-
- if (!fout)
- {
- cmSystemTools::Error("Error Writing ", this->Filename.c_str());
- cmSystemTools::ReportLastSystemError("");
- return;
- }
-
- // Collect dependency information about all library targets built in
- // the project.
- cmake* cm = this->Makefile->GetCMakeInstance();
- cmGlobalGenerator* global = cm->GetGlobalGenerator();
- const std::vector<cmLocalGenerator *>& locals = global->GetLocalGenerators();
- std::map<cmStdString, cmStdString> libDepsOld;
- std::map<cmStdString, cmStdString> libDepsNew;
- std::map<cmStdString, cmStdString> libTypes;
- for(std::vector<cmLocalGenerator *>::const_iterator i = locals.begin();
- i != locals.end(); ++i)
- {
- const cmLocalGenerator* gen = *i;
- const cmTargets &tgts = gen->GetMakefile()->GetTargets();
- for(cmTargets::const_iterator l = tgts.begin();
- l != tgts.end(); ++l)
- {
- // Get the current target.
- cmTarget const& target = l->second;
-
- // Skip non-library targets.
- if(target.GetType() < cmTarget::STATIC_LIBRARY
- || target.GetType() > cmTarget::MODULE_LIBRARY)
- {
- continue;
- }
-
- // Construct the dependency variable name.
- std::string targetEntry = target.GetName();
- targetEntry += "_LIB_DEPENDS";
-
- // Construct the dependency variable value. It is safe to use
- // the target GetLinkLibraries method here because this code is
- // called at the end of configure but before generate so library
- // dependencies have yet to be analyzed. Therefore the value
- // will be the direct link dependencies.
- std::string valueOld;
- std::string valueNew;
- cmTarget::LinkLibraryVectorType const& libs = target.GetLinkLibraries();
- for(cmTarget::LinkLibraryVectorType::const_iterator li = libs.begin();
- li != libs.end(); ++li)
- {
- std::string ltVar = li->first;
- ltVar += "_LINK_TYPE";
- std::string ltValue;
- switch(li->second)
- {
- case cmTarget::GENERAL:
- valueNew += "general;";
- ltValue = "general";
- break;
- case cmTarget::DEBUG:
- valueNew += "debug;";
- ltValue = "debug";
- break;
- case cmTarget::OPTIMIZED:
- valueNew += "optimized;";
- ltValue = "optimized";
- break;
- }
- std::string lib = li->first;
- if(cmTarget* libtgt = global->FindTarget(0, lib.c_str()))
- {
- // Handle simple output name changes. This command is
- // deprecated so we do not support full target name
- // translation (which requires per-configuration info).
- if(const char* outname = libtgt->GetProperty("OUTPUT_NAME"))
- {
- lib = outname;
- }
- }
- valueOld += lib;
- valueOld += ";";
- valueNew += lib;
- valueNew += ";";
-
- std::string& ltEntry = libTypes[ltVar];
- if(ltEntry.empty())
- {
- ltEntry = ltValue;
- }
- else if(ltEntry != ltValue)
- {
- ltEntry = "general";
- }
- }
- libDepsNew[targetEntry] = valueNew;
- libDepsOld[targetEntry] = valueOld;
- }
- }
-
- // Generate dependency information for both old and new style CMake
- // versions.
- const char* vertest =
- "\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" GREATER 2.4";
- fout << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n";
- fout << "if(" << vertest << ")\n";
- fout << " # Information for CMake 2.6 and above.\n";
- for(std::map<cmStdString, cmStdString>::const_iterator
- i = libDepsNew.begin();
- i != libDepsNew.end(); ++i)
- {
- if(!i->second.empty())
- {
- fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n";
- }
- }
- fout << "else()\n";
- fout << " # Information for CMake 2.4 and lower.\n";
- for(std::map<cmStdString, cmStdString>::const_iterator
- i = libDepsOld.begin();
- i != libDepsOld.end(); ++i)
- {
- if(!i->second.empty())
- {
- fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n";
- }
- }
- for(std::map<cmStdString, cmStdString>::const_iterator i = libTypes.begin();
- i != libTypes.end(); ++i)
- {
- if(i->second != "general")
- {
- fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n";
- }
- }
- fout << "endif()\n";
- return;
-}
diff --git a/Source/cmExportLibraryDependencies.h b/Source/cmExportLibraryDependencies.h
deleted file mode 100644
index 29b568f..0000000
--- a/Source/cmExportLibraryDependencies.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*============================================================================
- CMake - Cross Platform Makefile Generator
- Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
- Distributed under the OSI-approved BSD License (the "License");
- see accompanying file Copyright.txt for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even the
- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the License for more information.
-============================================================================*/
-#ifndef cmExportLibraryDependenciesCommand_h
-#define cmExportLibraryDependenciesCommand_h
-
-#include "cmCommand.h"
-
-class cmExportLibraryDependenciesCommand : public cmCommand
-{
-public:
- cmTypeMacro(cmExportLibraryDependenciesCommand, cmCommand);
- virtual cmCommand* Clone() { return new cmExportLibraryDependenciesCommand; }
- virtual bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus &status);
- virtual const char* GetName() const { return "export_library_dependencies";}
- virtual bool IsDiscouraged() const { return true; }
-
- virtual void FinalPass();
- virtual bool HasFinalPass() const { return true; }
-
-private:
- std::string Filename;
- bool Append;
- void ConstFinalPass() const;
-};
-
-
-#endif
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 3f3155e..d0d97dc 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -873,9 +873,6 @@ void cmGeneratorTarget::ComputeLinkImplementation(const char* config,
LinkImplementation& impl,
cmTarget const* head) const
{
- // Compute which library configuration to link.
- cmTarget::LinkLibraryType linkType = this->Target->ComputeLinkType(config);
-
// Collect libraries directly linked in this configuration.
std::vector<std::string> llibs;
this->GetDirectLinkLibraries(config, llibs, head);
@@ -967,23 +964,6 @@ void cmGeneratorTarget::ComputeLinkImplementation(const char* config,
impl.Libraries.push_back(item);
}
- cmTarget::LinkLibraryVectorType const& oldllibs =
- this->Target->GetOriginalLinkLibraries();
- for(cmTarget::LinkLibraryVectorType::const_iterator li = oldllibs.begin();
- li != oldllibs.end(); ++li)
- {
- if(li->second != cmTarget::GENERAL && li->second != linkType)
- {
- std::string item = this->Target->CheckCMP0004(li->first);
- if(item == this->GetName() || item.empty())
- {
- continue;
- }
- // Support OLD behavior for CMP0003.
- impl.WrongConfigLibraries.push_back(item);
- }
- }
-
// This target needs runtime libraries for its source languages.
std::set<cmStdString> languages;
// Get languages used in our source files.
@@ -3342,7 +3322,6 @@ bool cmGeneratorTarget::ComputeLinkInterface(const char* config,
this->GetLinkImplementation(config, headTarget);
iface.ImplementationIsInterface = true;
iface.Libraries = impl->Libraries;
- iface.WrongConfigLibraries = impl->WrongConfigLibraries;
if(this->Target->LinkLanguagePropagatesToDependents())
{
// Targets using this archive need its language runtime libraries.
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 9795a00..adc2414 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -219,10 +219,6 @@ public:
// or more static libraries.
int Multiplicity;
- // Libraries listed for other configurations.
- // Needed only for OLD behavior of CMP0003.
- std::vector<std::string> WrongConfigLibraries;
-
bool ImplementationIsInterface;
LinkInterface(): Multiplicity(0), ImplementationIsInterface(false) {}
@@ -313,10 +309,6 @@ public:
// Libraries linked directly in this configuration.
std::vector<std::string> Libraries;
-
- // Libraries linked directly in other configurations.
- // Needed only for OLD behavior of CMP0003.
- std::vector<std::string> WrongConfigLibraries;
};
typedef std::map<cmStdString, LinkImplementation> LinkImplMapType;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 5ff1510..a9fa501 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1501,29 +1501,6 @@ void cmGlobalGenerator::CheckLocalGenerators()
{
continue;
}
- const cmTarget::LinkLibraryVectorType& libs =
- l->second.GetOriginalLinkLibraries();
- for(cmTarget::LinkLibraryVectorType::const_iterator lib = libs.begin();
- lib != libs.end(); ++lib)
- {
- if(lib->first.size() > 9 &&
- cmSystemTools::IsNOTFOUND(lib->first.c_str()))
- {
- std::string varName = lib->first.substr(0, lib->first.size()-9);
- cmCacheManager::CacheIterator it =
- manager->GetCacheIterator(varName.c_str());
- if(it.GetPropertyAsBool("ADVANCED"))
- {
- varName += " (ADVANCED)";
- }
- std::string text = notFoundMap[varName];
- text += "\n linked by target \"";
- text += l->second.GetName();
- text += "\" in directory ";
- text+=this->LocalGenerators[i]->GetMakefile()->GetCurrentDirectory();
- notFoundMap[varName] = text;
- }
- }
std::vector<std::string> incs;
const char *incDirProp = l->second.GetProperty("INCLUDE_DIRECTORIES");
if (!incDirProp)
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 3a7070e..8944c69 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -291,6 +291,7 @@ void cmGraphVizWriter::WriteConnections(const char* targetName,
std::set<std::string>& insertedConnections,
cmGeneratedFileStream& str) const
{
+ (void)insertedConnections;
std::map<cmStdString, const cmTarget* >::const_iterator targetPtrIt =
this->TargetPtrs.find(targetName);
@@ -309,39 +310,6 @@ void cmGraphVizWriter::WriteConnections(const char* targetName,
std::string myNodeName = this->TargetNamesNodes.find(targetName)->second;
- const cmTarget::LinkLibraryVectorType* ll =
- &(targetPtrIt->second->GetOriginalLinkLibraries());
-
- for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin();
- llit != ll->end();
- ++ llit )
- {
- const char* libName = llit->first.c_str();
- std::map<cmStdString, cmStdString>::const_iterator libNameIt =
- this->TargetNamesNodes.find(libName);
-
- // can happen e.g. if GRAPHVIZ_TARGET_IGNORE_REGEX is used
- if(libNameIt == this->TargetNamesNodes.end())
- {
- continue;
- }
-
- std::string connectionName = myNodeName;
- connectionName += "-";
- connectionName += libNameIt->second;
- if (insertedConnections.find(connectionName) == insertedConnections.end())
- {
- insertedConnections.insert(connectionName);
- this->WriteNode(libName, this->TargetPtrs.find(libName)->second,
- insertedNodes, str);
-
- str << " \"" << myNodeName.c_str() << "\" -> \""
- << libNameIt->second.c_str() << "\"";
- str << " // " << targetName << " -> " << libName << std::endl;
- this->WriteConnections(libName, insertedNodes, insertedConnections, str);
- }
- }
-
}
@@ -350,6 +318,7 @@ void cmGraphVizWriter::WriteDependerConnections(const char* targetName,
std::set<std::string>& insertedConnections,
cmGeneratedFileStream& str) const
{
+ (void)insertedConnections;
std::map<cmStdString, const cmTarget* >::const_iterator targetPtrIt =
this->TargetPtrs.find(targetName);
@@ -386,45 +355,7 @@ void cmGraphVizWriter::WriteDependerConnections(const char* targetName,
// Now we have a target, check whether it links against targetName.
// If so, draw a connection, and then continue with dependers on that one.
- const cmTarget::LinkLibraryVectorType* ll =
- &(dependerIt->second->GetOriginalLinkLibraries());
- for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin();
- llit != ll->end();
- ++ llit )
- {
- std::string libName = llit->first.c_str();
- if (libName == targetName)
- {
- // So this target links against targetName.
- std::map<cmStdString, cmStdString>::const_iterator dependerNodeNameIt =
- this->TargetNamesNodes.find(dependerIt->first);
-
- if(dependerNodeNameIt != this->TargetNamesNodes.end())
- {
- std::string connectionName = dependerNodeNameIt->second;
- connectionName += "-";
- connectionName += myNodeName;
-
- if (insertedConnections.find(connectionName) ==
- insertedConnections.end())
- {
- insertedConnections.insert(connectionName);
- this->WriteNode(dependerIt->first.c_str(), dependerIt->second,
- insertedNodes, str);
-
- str << " \"" << dependerNodeNameIt->second << "\" -> \""
- << myNodeName << "\"";
- str << " // " <<targetName<< " -> " <<dependerIt->first<<std::endl;
- this->WriteDependerConnections(dependerIt->first.c_str(),
- insertedNodes, insertedConnections, str);
- }
-
-
- }
- break;
- }
- }
}
}
@@ -513,31 +444,6 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
// Skip ignored targets
continue;
}
- const cmTarget::LinkLibraryVectorType* ll =
- &(tit->second.GetOriginalLinkLibraries());
- for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin();
- llit != ll->end();
- ++ llit )
- {
- const char* libName = llit->first.c_str();
- if (this->IgnoreThisTarget(libName))
- {
- // Skip ignored targets
- continue;
- }
-
- std::map<cmStdString, const cmTarget*>::const_iterator tarIt =
- this->TargetPtrs.find(libName);
- if ( tarIt == this->TargetPtrs.end() )
- {
- cmOStringStream ostr;
- ostr << this->GraphNodePrefix << cnt++;
- this->TargetNamesNodes[libName] = ostr.str();
- this->TargetPtrs[libName] = NULL;
- // str << " \"" << ostr.c_str() << "\" [ label=\"" << libName
- // << "\" shape=\"ellipse\"];" << std::endl;
- }
- }
}
}
return cnt;
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 5d42205..bd2c06d 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1083,81 +1083,6 @@ void cmLocalVisualStudio6Generator
libMultiLineOptionsForDebug += " \n";
}
}
- // find link libraries
- const cmTarget::LinkLibraryVectorType& libs = target.GetLinkLibraries();
- cmTarget::LinkLibraryVectorType::const_iterator j;
- for(j = libs.begin(); j != libs.end(); ++j)
- {
- // add libraries to executables and dlls (but never include
- // a library in a library, bad recursion)
- // NEVER LINK STATIC LIBRARIES TO OTHER STATIC LIBRARIES
- if ((target.GetType() != cmTarget::SHARED_LIBRARY
- && target.GetType() != cmTarget::STATIC_LIBRARY
- && target.GetType() != cmTarget::MODULE_LIBRARY) ||
- (target.GetType()==cmTarget::SHARED_LIBRARY
- && libName != GetVS6TargetName(j->first)) ||
- (target.GetType()==cmTarget::MODULE_LIBRARY
- && libName != GetVS6TargetName(j->first)))
- {
- // Compute the proper name to use to link this library.
- std::string lib;
- std::string libDebug;
- cmGeneratorTarget* tgt =
- this->GlobalGenerator->FindGeneratorTarget(0, j->first.c_str());
- if(tgt)
- {
- lib = cmSystemTools::GetFilenameWithoutExtension
- (tgt->GetFullName().c_str());
- libDebug = cmSystemTools::GetFilenameWithoutExtension
- (tgt->GetFullName("Debug").c_str());
- lib += ".lib";
- libDebug += ".lib";
- }
- else
- {
- lib = j->first.c_str();
- libDebug = j->first.c_str();
- if(j->first.find(".lib") == std::string::npos)
- {
- lib += ".lib";
- libDebug += ".lib";
- }
- }
- lib = this->ConvertToOptionallyRelativeOutputPath(lib.c_str());
- libDebug =
- this->ConvertToOptionallyRelativeOutputPath(libDebug.c_str());
-
- if (j->second == cmTarget::GENERAL)
- {
- libOptions += " ";
- libOptions += lib;
- libMultiLineOptions += "# ADD LINK32 ";
- libMultiLineOptions += lib;
- libMultiLineOptions += "\n";
- libMultiLineOptionsForDebug += "# ADD LINK32 ";
- libMultiLineOptionsForDebug += libDebug;
- libMultiLineOptionsForDebug += "\n";
- }
- if (j->second == cmTarget::DEBUG)
- {
- libDebugOptions += " ";
- libDebugOptions += lib;
-
- libMultiLineDebugOptions += "# ADD LINK32 ";
- libMultiLineDebugOptions += libDebug;
- libMultiLineDebugOptions += "\n";
- }
- if (j->second == cmTarget::OPTIMIZED)
- {
- libOptimizedOptions += " ";
- libOptimizedOptions += lib;
-
- libMultiLineOptimizedOptions += "# ADD LINK32 ";
- libMultiLineOptimizedOptions += lib;
- libMultiLineOptimizedOptions += "\n";
- }
- }
- }
#endif
// Get include options for this target.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 479e712..c78d41d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1488,7 +1488,7 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target,
this->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
}
}
- i->second.AddLinkLibrary( *this, target, lib, llt );
+ i->second.AddLinkLibrary( target, lib, llt );
}
else
{
@@ -1991,7 +1991,7 @@ void cmMakefile::AddGlobalLinkInformation(const char* name, cmTarget& target)
{
target.AddLinkDirectory(j->c_str());
}
- target.MergeLinkLibraries( *this, name, this->LinkLibraries );
+ target.MergeLinkLibraries( name, this->LinkLibraries );
}
@@ -2018,10 +2018,6 @@ cmTarget* cmMakefile::AddLibrary(const char* lname, cmTarget::TargetType type,
}
cmTarget* target = this->AddNewTarget(type, lname);
- // Clear its dependencies. Otherwise, dependencies might persist
- // over changes in CMakeLists.txt, making the information stale and
- // hence useless.
- target->ClearDependencyInformation( *this, lname );
if(excludeFromAll)
{
target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 6c014bc..324cb5c 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -162,7 +162,6 @@ cmTarget::cmTarget()
#undef INITIALIZE_TARGET_POLICY_MEMBER
this->Makefile = 0;
- this->LinkLibrariesAnalyzed = false;
this->HaveInstallRule = false;
this->DLLPlatform = false;
this->IsApple = false;
@@ -373,9 +372,6 @@ void cmTarget::FinishConfigure()
// system generation uses up-to-date information even if other cache
// invalidation code in this source file is buggy.
this->ClearLinkMaps();
-
- // Do old-style link dependency analysis.
- this->AnalyzeLibDependencies(*this->Makefile);
}
//----------------------------------------------------------------------------
@@ -653,8 +649,7 @@ void cmTarget::ConstructSourceFileFlags() const
}
//----------------------------------------------------------------------------
-void cmTarget::MergeLinkLibraries( cmMakefile& mf,
- const char *selfname,
+void cmTarget::MergeLinkLibraries( const char *selfname,
const LinkLibraryVectorType& libs )
{
// Only add on libraries we haven't added on before.
@@ -664,7 +659,7 @@ void cmTarget::MergeLinkLibraries( cmMakefile& mf,
for( ; i != libs.end(); ++i )
{
// This is equivalent to the target_link_libraries plain signature.
- this->AddLinkLibrary( mf, selfname, i->first.c_str(), i->second );
+ this->AddLinkLibrary( selfname, i->first.c_str(), i->second );
this->AppendProperty("INTERFACE_LINK_LIBRARIES",
this->GetDebugGeneratorExpressions(i->first.c_str(), i->second).c_str());
}
@@ -716,34 +711,6 @@ cmTarget::LinkLibraryType cmTarget::ComputeLinkType(const char* config) const
}
//----------------------------------------------------------------------------
-void cmTarget::ClearDependencyInformation( cmMakefile& mf,
- const char* target )
-{
- // Clear the dependencies. The cache variable must exist iff we are
- // recording dependency information for this target.
- std::string depname = target;
- depname += "_LIB_DEPENDS";
- if (this->RecordDependencies)
- {
- mf.AddCacheDefinition(depname.c_str(), "",
- "Dependencies for target", cmCacheManager::STATIC);
- }
- else
- {
- if (mf.GetDefinition( depname.c_str() ))
- {
- std::string message = "Target ";
- message += target;
- message += " has dependency information when it shouldn't.\n";
- message += "Your cache is probably stale. Please remove the entry\n ";
- message += depname;
- message += "\nfrom the cache.";
- cmSystemTools::Error( message.c_str() );
- }
- }
-}
-
-//----------------------------------------------------------------------------
bool cmTarget::NameResolvesToFramework(const std::string& libname) const
{
return this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
@@ -846,8 +813,7 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s,
}
//----------------------------------------------------------------------------
-void cmTarget::AddLinkLibrary(cmMakefile& mf,
- const char *target, const char* lib,
+void cmTarget::AddLinkLibrary(const char *target, const char* lib,
LinkLibraryType llt)
{
cmTarget *tgt = this->Makefile->FindTargetToUse(lib);
@@ -872,48 +838,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
cmTarget::LibraryID tmp;
tmp.first = lib;
tmp.second = llt;
- this->LinkLibraries.push_back( tmp );
- this->OriginalLinkLibraries.push_back(tmp);
this->ClearLinkMaps();
-
- // Add the explicit dependency information for this target. This is
- // simply a set of libraries separated by ";". There should always
- // be a trailing ";". These library names are not canonical, in that
- // they may be "-framework x", "-ly", "/path/libz.a", etc.
- // We shouldn't remove duplicates here because external libraries
- // may be purposefully duplicated to handle recursive dependencies,
- // and we removing one instance will break the link line. Duplicates
- // will be appropriately eliminated at emit time.
- if(this->RecordDependencies)
- {
- std::string targetEntry = target;
- targetEntry += "_LIB_DEPENDS";
- std::string dependencies;
- const char* old_val = mf.GetDefinition( targetEntry.c_str() );
- if( old_val )
- {
- dependencies += old_val;
- }
- switch (llt)
- {
- case cmTarget::GENERAL:
- dependencies += "general";
- break;
- case cmTarget::DEBUG:
- dependencies += "debug";
- break;
- case cmTarget::OPTIMIZED:
- dependencies += "optimized";
- break;
- }
- dependencies += ";";
- dependencies += lib;
- dependencies += ";";
- mf.AddCacheDefinition( targetEntry.c_str(), dependencies.c_str(),
- "Dependencies for the target",
- cmCacheManager::STATIC );
- }
-
}
//----------------------------------------------------------------------------
@@ -939,147 +864,6 @@ cmTarget::AddSystemIncludeDirectories(const std::vector<std::string> &incs)
}
//----------------------------------------------------------------------------
-void
-cmTarget::AnalyzeLibDependencies( const cmMakefile& mf )
-{
- // There are two key parts of the dependency analysis: (1)
- // determining the libraries in the link line, and (2) constructing
- // the dependency graph for those libraries.
- //
- // The latter is done using the cache entries that record the
- // dependencies of each library.
- //
- // The former is a more thorny issue, since it is not clear how to
- // determine if two libraries listed on the link line refer to the a
- // single library or not. For example, consider the link "libraries"
- // /usr/lib/libtiff.so -ltiff
- // Is this one library or two? The solution implemented here is the
- // simplest (and probably the only practical) one: two libraries are
- // the same if their "link strings" are identical. Thus, the two
- // libraries above are considered distinct. This also means that for
- // dependency analysis to be effective, the CMake user must specify
- // libraries build by his project without using any linker flags or
- // file extensions. That is,
- // LINK_LIBRARIES( One Two )
- // instead of
- // LINK_LIBRARIES( -lOne ${binarypath}/libTwo.a )
- // The former is probably what most users would do, but it never
- // hurts to document the assumptions. :-) Therefore, in the analysis
- // code, the "canonical name" of a library is simply its name as
- // given to a LINK_LIBRARIES command.
- //
- // Also, we will leave the original link line intact; we will just add any
- // dependencies that were missing.
- //
- // There is a problem with recursive external libraries
- // (i.e. libraries with no dependency information that are
- // recursively dependent). We must make sure that the we emit one of
- // the libraries twice to satisfy the recursion, but we shouldn't
- // emit it more times than necessary. In particular, we must make
- // sure that handling this improbable case doesn't cost us when
- // dealing with the common case of non-recursive libraries. The
- // solution is to assume that the recursion is satisfied at one node
- // of the dependency tree. To illustrate, assume libA and libB are
- // extrenal and mutually dependent. Suppose libX depends on
- // libA, and libY on libA and libX. Then
- // TARGET_LINK_LIBRARIES( Y X A B A )
- // TARGET_LINK_LIBRARIES( X A B A )
- // TARGET_LINK_LIBRARIES( Exec Y )
- // would result in "-lY -lX -lA -lB -lA". This is the correct way to
- // specify the dependencies, since the mutual dependency of A and B
- // is resolved *every time libA is specified*.
- //
- // Something like
- // TARGET_LINK_LIBRARIES( Y X A B A )
- // TARGET_LINK_LIBRARIES( X A B )
- // TARGET_LINK_LIBRARIES( Exec Y )
- // would result in "-lY -lX -lA -lB", and the mutual dependency
- // information is lost. This is because in some case (Y), the mutual
- // dependency of A and B is listed, while in another other case (X),
- // it is not. Depending on which line actually emits A, the mutual
- // dependency may or may not be on the final link line. We can't
- // handle this pathalogical case cleanly without emitting extra
- // libraries for the normal cases. Besides, the dependency
- // information for X is wrong anyway: if we build an executable
- // depending on X alone, we would not have the mutual dependency on
- // A and B resolved.
- //
- // IMPROVEMENTS:
- // -- The current algorithm will not always pick the "optimal" link line
- // when recursive dependencies are present. It will instead break the
- // cycles at an aribtrary point. The majority of projects won't have
- // cyclic dependencies, so this is probably not a big deal. Note that
- // the link line is always correct, just not necessary optimal.
-
- {
- // Expand variables in link library names. This is for backwards
- // compatibility with very early CMake versions and should
- // eventually be removed. This code was moved here from the end of
- // old source list processing code which was called just before this
- // method.
- for(LinkLibraryVectorType::iterator p = this->LinkLibraries.begin();
- p != this->LinkLibraries.end(); ++p)
- {
- this->Makefile->ExpandVariablesInString(p->first, true, true);
- }
- }
-
- // The dependency map.
- DependencyMap dep_map;
-
- // 1. Build the dependency graph
- //
- for(LinkLibraryVectorType::reverse_iterator lib
- = this->LinkLibraries.rbegin();
- lib != this->LinkLibraries.rend(); ++lib)
- {
- this->GatherDependencies( mf, *lib, dep_map);
- }
-
- // 2. Remove any dependencies that are already satisfied in the original
- // link line.
- //
- for(LinkLibraryVectorType::iterator lib = this->LinkLibraries.begin();
- lib != this->LinkLibraries.end(); ++lib)
- {
- for( LinkLibraryVectorType::iterator lib2 = lib;
- lib2 != this->LinkLibraries.end(); ++lib2)
- {
- this->DeleteDependency( dep_map, *lib, *lib2);
- }
- }
-
-
- // 3. Create the new link line by simply emitting any dependencies that are
- // missing. Start from the back and keep adding.
- //
- std::set<DependencyMap::key_type> done, visited;
- std::vector<DependencyMap::key_type> newLinkLibraries;
- for(LinkLibraryVectorType::reverse_iterator lib =
- this->LinkLibraries.rbegin();
- lib != this->LinkLibraries.rend(); ++lib)
- {
- // skip zero size library entries, this may happen
- // if a variable expands to nothing.
- if (lib->first.size() != 0)
- {
- this->Emit( *lib, dep_map, done, visited, newLinkLibraries );
- }
- }
-
- // 4. Add the new libraries to the link line.
- //
- for( std::vector<DependencyMap::key_type>::reverse_iterator k =
- newLinkLibraries.rbegin();
- k != newLinkLibraries.rend(); ++k )
- {
- // get the llt from the dep_map
- this->LinkLibraries.push_back( std::make_pair(k->first,k->second) );
- }
- this->LinkLibrariesAnalyzed = true;
-}
-
-//----------------------------------------------------------------------------
void cmTarget::InsertDependency( DependencyMap& depMap,
const LibraryID& lib,
const LibraryID& dep)
@@ -1172,66 +956,6 @@ void cmTarget::Emit(const LibraryID lib,
}
//----------------------------------------------------------------------------
-void cmTarget::GatherDependencies( const cmMakefile& mf,
- const LibraryID& lib,
- DependencyMap& dep_map)
-{
- // If the library is already in the dependency map, then it has
- // already been fully processed.
- if( dep_map.find(lib) != dep_map.end() )
- {
- return;
- }
-
- const char* deps = mf.GetDefinition( (lib.first+"_LIB_DEPENDS").c_str() );
- if( deps && strcmp(deps,"") != 0 )
- {
- // Make sure this library is in the map, even if it has an empty
- // set of dependencies. This distinguishes the case of explicitly
- // no dependencies with that of unspecified dependencies.
- dep_map[lib];
-
- // Parse the dependency information, which is a set of
- // type, library pairs separated by ";". There is always a trailing ";".
- cmTarget::LinkLibraryType llt = cmTarget::GENERAL;
- std::string depline = deps;
- std::string::size_type start = 0;
- std::string::size_type end;
- end = depline.find( ";", start );
- while( end != std::string::npos )
- {
- std::string l = depline.substr( start, end-start );
- if( l.size() != 0 )
- {
- if (l == "debug")
- {
- llt = cmTarget::DEBUG;
- }
- else if (l == "optimized")
- {
- llt = cmTarget::OPTIMIZED;
- }
- else if (l == "general")
- {
- llt = cmTarget::GENERAL;
- }
- else
- {
- LibraryID lib2(l,llt);
- this->InsertDependency( dep_map, lib, lib2);
- this->GatherDependencies( mf, lib2, dep_map);
- llt = cmTarget::GENERAL;
- }
- }
- start = end+1; // skip the ;
- end = depline.find( ";", start );
- }
- // cannot depend on itself
- this->DeleteDependency( dep_map, lib, lib);
- }
-}
-
-//----------------------------------------------------------------------------
static bool whiteListedInterfaceProperty(const char *prop)
{
if(cmHasLiteralPrefix(prop, "INTERFACE_"))
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 22ec7e7..2d95949 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -168,23 +168,13 @@ public:
typedef std::pair<cmStdString, LinkLibraryType> LibraryID;
typedef std::vector<LibraryID > LinkLibraryVectorType;
- const LinkLibraryVectorType &GetLinkLibraries() const {
- return this->LinkLibraries;}
- const LinkLibraryVectorType &GetOriginalLinkLibraries() const
- {return this->OriginalLinkLibraries;}
/** Compute the link type to use for the given configuration. */
LinkLibraryType ComputeLinkType(const char* config) const;
- /**
- * Clear the dependency information recorded for this target, if any.
- */
- void ClearDependencyInformation(cmMakefile& mf, const char* target);
-
// Check to see if a library is a framework and treat it different on Mac
bool NameResolvesToFramework(const std::string& libname) const;
- void AddLinkLibrary(cmMakefile& mf,
- const char *target, const char* lib,
+ void AddLinkLibrary(const char *target, const char* lib,
LinkLibraryType llt);
enum TLLSignature {
KeywordTLLSignature,
@@ -193,7 +183,7 @@ public:
bool PushTLLCommandTrace(TLLSignature signature);
void GetTllSignatureTraces(cmOStringStream &s, TLLSignature sig) const;
- void MergeLinkLibraries( cmMakefile& mf, const char* selfname,
+ void MergeLinkLibraries( const char* selfname,
const LinkLibraryVectorType& libs );
const std::vector<std::string>& GetLinkDirectories() const;
@@ -440,16 +430,6 @@ private:
std::set<LibraryID>& visited,
DependencyList& link_line);
- /**
- * Finds the dependencies for \a lib and inserts them into \a
- * dep_map.
- */
- void GatherDependencies( const cmMakefile& mf,
- const LibraryID& lib,
- DependencyMap& dep_map);
-
- void AnalyzeLibDependencies( const cmMakefile& mf );
-
const char* GetSuffixVariableInternal(bool implib) const;
const char* GetPrefixVariableInternal(bool implib) const;
@@ -473,9 +453,7 @@ private:
TargetType TargetTypeValue;
std::vector<cmSourceFile*> SourceFiles;
std::vector<std::string> ObjectLibraries;
- LinkLibraryVectorType LinkLibraries;
LinkLibraryVectorType PrevLinkedLibraries;
- bool LinkLibrariesAnalyzed;
std::vector<std::string> LinkDirectories;
std::set<cmStdString> LinkDirectoriesEmmitted;
bool HaveInstallRule;
@@ -485,7 +463,6 @@ private:
std::set<cmStdString> Utilities;
bool RecordDependencies;
mutable cmPropertyMap Properties;
- LinkLibraryVectorType OriginalLinkLibraries;
bool DLLPlatform;
bool IsApple;
bool IsImportedTarget;
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt
index fcde44d..2824ebc 100644
--- a/Tests/Complex/CMakeLists.txt
+++ b/Tests/Complex/CMakeLists.txt
@@ -398,6 +398,3 @@ endif()
#
add_subdirectory(Library)
add_subdirectory(Executable)
-subdir_depends(Executable Library)
-export_library_dependencies(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake)
-include(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake OPTIONAL)
diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt
index a4a0e0e..0f9a71d 100644
--- a/Tests/ComplexOneConfig/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/CMakeLists.txt
@@ -368,6 +368,3 @@ endif()
#
add_subdirectory(Library)
add_subdirectory(Executable)
-subdir_depends(Executable Library)
-export_library_dependencies(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake)
-include(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake OPTIONAL)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-NEW-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0033-NEW-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0033-NEW-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0033-NEW-stderr.txt
deleted file mode 100644
index 8d210aa..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0033-NEW-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CMake Error at CMP0033-NEW.cmake:2 \(export_library_dependencies\):
- The export_library_dependencies command should not be called; see CMP0033.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0033-NEW.cmake
deleted file mode 100644
index 6f90f29..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0033-NEW.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0033 NEW)
-export_library_dependencies()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-OLD-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0033-OLD-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0033-OLD-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0033-OLD-stderr.txt
deleted file mode 100644
index e5dd2dd..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0033-OLD-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CMake Error at CMP0033-OLD.cmake:2 \(export_library_dependencies\):
- export_library_dependencies called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0033-OLD.cmake
deleted file mode 100644
index a3504b6..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0033-OLD.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0033 OLD)
-export_library_dependencies()
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-WARN-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0033-WARN-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0033-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0033-WARN-stderr.txt
deleted file mode 100644
index e561dac..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0033-WARN-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CMake Warning \(dev\) at CMP0033-WARN.cmake:1 \(export_library_dependencies\):
- Policy CMP0033 is not set: The export_library_dependencies command should
- not be called. Run "cmake --help-policy CMP0033" for policy details. Use
- the cmake_policy command to set the policy and suppress this warning.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
-
-CMake Error at CMP0033-WARN.cmake:1 \(export_library_dependencies\):
- export_library_dependencies called with incorrect number of arguments
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0033-WARN.cmake
deleted file mode 100644
index f897ddd..0000000
--- a/Tests/RunCMake/DisallowedCommands/CMP0033-WARN.cmake
+++ /dev/null
@@ -1 +0,0 @@
-export_library_dependencies()
diff --git a/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake b/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake
index 208ea20..af348f8 100644
--- a/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake
+++ b/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake
@@ -5,7 +5,6 @@ foreach(p
CMP0030
CMP0031
CMP0032
- CMP0033
CMP0034
CMP0035
CMP0036
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=00f42efe2c1c66c7ad64ff99b65b70b6848fea46
commit 00f42efe2c1c66c7ad64ff99b65b70b6848fea46
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Dec 10 11:04:20 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:08 2014 +0100
Move GetOutputName to cmGeneratorTarget.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 98f12e3..3f3155e 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -605,7 +605,7 @@ std::string cmGeneratorTarget::GetCFBundleDirectory(const char* config,
bool contentOnly) const
{
std::string fpath;
- fpath += this->Target->GetOutputName(config, false);
+ fpath += this->GetOutputName(config, false);
fpath += ".";
const char *ext = this->GetProperty("BUNDLE_EXTENSION");
if (!ext)
@@ -649,7 +649,7 @@ std::string cmGeneratorTarget::GetFrameworkDirectory(const char* config,
bool rootDir) const
{
std::string fpath;
- fpath += this->Target->GetOutputName(config, false);
+ fpath += this->GetOutputName(config, false);
fpath += ".framework";
if(!rootDir)
{
@@ -3539,7 +3539,7 @@ void cmGeneratorTarget::GetFullNameInternal(const char* config,
std::string fw_prefix;
if(this->Target->IsFrameworkOnApple())
{
- fw_prefix = this->Target->GetOutputName(config, false);
+ fw_prefix = this->GetOutputName(config, false);
fw_prefix += ".framework/";
targetPrefix = fw_prefix.c_str();
targetSuffix = 0;
@@ -3547,7 +3547,7 @@ void cmGeneratorTarget::GetFullNameInternal(const char* config,
if(this->Target->IsCFBundleOnApple())
{
- fw_prefix = this->Target->GetOutputName(config, false);
+ fw_prefix = this->GetOutputName(config, false);
fw_prefix += ".";
const char *ext = this->GetProperty("BUNDLE_EXTENSION");
if (!ext)
@@ -3564,7 +3564,7 @@ void cmGeneratorTarget::GetFullNameInternal(const char* config,
outPrefix = targetPrefix?targetPrefix:"";
// Append the target name or property-specified name.
- outBase += this->Target->GetOutputName(config, implib);
+ outBase += this->GetOutputName(config, implib);
// Append the per-configuration postfix.
outBase += configPostfix?configPostfix:"";
@@ -3792,6 +3792,44 @@ bool cmGeneratorTarget::HaveInstallTreeRPATH() const
}
//----------------------------------------------------------------------------
+std::string cmGeneratorTarget::GetOutputName(const char* config,
+ bool implib) const
+{
+ std::vector<std::string> props;
+ std::string type = this->Target->GetOutputTargetType(implib);
+ std::string configUpper = cmSystemTools::UpperCase(config? config : "");
+ if(!type.empty() && !configUpper.empty())
+ {
+ // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME_<CONFIG>
+ props.push_back(type + "_OUTPUT_NAME_" + configUpper);
+ }
+ if(!type.empty())
+ {
+ // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME
+ props.push_back(type + "_OUTPUT_NAME");
+ }
+ if(!configUpper.empty())
+ {
+ // OUTPUT_NAME_<CONFIG>
+ props.push_back("OUTPUT_NAME_" + configUpper);
+ // <CONFIG>_OUTPUT_NAME
+ props.push_back(configUpper + "_OUTPUT_NAME");
+ }
+ // OUTPUT_NAME
+ props.push_back("OUTPUT_NAME");
+
+ for(std::vector<std::string>::const_iterator i = props.begin();
+ i != props.end(); ++i)
+ {
+ if(const char* outName = this->GetProperty(i->c_str()))
+ {
+ return outName;
+ }
+ }
+ return this->GetName();
+}
+
+//----------------------------------------------------------------------------
void cmGeneratorTarget::GetDirectLinkLibraries(const char *config,
std::vector<std::string> &libs,
cmTarget const* head) const
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index ab089d6..9795a00 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -333,6 +333,8 @@ public:
std::vector<std::string> &,
cmTarget *head) const;
+ std::string GetOutputName(const char* config, bool implib) const;
+
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 6c15168..6c014bc 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2637,43 +2637,6 @@ bool cmTarget::UsesDefaultOutputDir(const char* config, bool implib) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetOutputName(const char* config, bool implib) const
-{
- std::vector<std::string> props;
- std::string type = this->GetOutputTargetType(implib);
- std::string configUpper = cmSystemTools::UpperCase(config? config : "");
- if(!type.empty() && !configUpper.empty())
- {
- // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME_<CONFIG>
- props.push_back(type + "_OUTPUT_NAME_" + configUpper);
- }
- if(!type.empty())
- {
- // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME
- props.push_back(type + "_OUTPUT_NAME");
- }
- if(!configUpper.empty())
- {
- // OUTPUT_NAME_<CONFIG>
- props.push_back("OUTPUT_NAME_" + configUpper);
- // <CONFIG>_OUTPUT_NAME
- props.push_back(configUpper + "_OUTPUT_NAME");
- }
- // OUTPUT_NAME
- props.push_back("OUTPUT_NAME");
-
- for(std::vector<std::string>::const_iterator i = props.begin();
- i != props.end(); ++i)
- {
- if(const char* outName = this->GetProperty(i->c_str()))
- {
- return outName;
- }
- }
- return this->GetName();
-}
-
-//----------------------------------------------------------------------------
std::string cmTarget::GetFrameworkVersion() const
{
assert(this->GetType() != INTERFACE_LIBRARY);
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 4dc4575..22ec7e7 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -460,9 +460,6 @@ private:
// Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type.
const char* GetOutputTargetType(bool implib) const;
- // Get the target base name.
- std::string GetOutputName(const char* config, bool implib) const;
-
std::string GetFullNameImported(const char* config, bool implib) const;
std::string ImportedGetFullPath(const char* config, bool implib) const;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6130982d4ae5c5720598418c7c9ad278e0c259cd
commit 6130982d4ae5c5720598418c7c9ad278e0c259cd
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Dec 10 10:57:56 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:08 2014 +0100
Move link libraries methods to cmGeneratorTarget.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index a17d4c7..98f12e3 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -119,13 +119,6 @@ const char *cmGeneratorTarget::GetProperty(const char *prop) const
return this->Target->GetProperty(prop);
}
-void cmGeneratorTarget::GetDirectLinkLibraries(const char *config,
- std::vector<std::string> &libs,
- cmTarget *head) const
-{
- this->Target->GetDirectLinkLibraries(config, libs, head);
-}
-
//----------------------------------------------------------------------------
std::vector<cmSourceFile*> const*
cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf) const
@@ -885,7 +878,7 @@ void cmGeneratorTarget::ComputeLinkImplementation(const char* config,
// Collect libraries directly linked in this configuration.
std::vector<std::string> llibs;
- this->Target->GetDirectLinkLibraries(config, llibs, head);
+ this->GetDirectLinkLibraries(config, llibs, head);
for(std::vector<std::string>::const_iterator li = llibs.begin();
li != llibs.end(); ++li)
{
@@ -3797,3 +3790,60 @@ bool cmGeneratorTarget::HaveInstallTreeRPATH() const
return (install_rpath && *install_rpath) &&
!this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH");
}
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::GetDirectLinkLibraries(const char *config,
+ std::vector<std::string> &libs,
+ cmTarget const* head) const
+{
+ const char *prop = this->GetProperty("LINK_LIBRARIES");
+ if (prop)
+ {
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
+
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt,
+ this->GetName(),
+ "LINK_LIBRARIES", 0, 0);
+ cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile,
+ config,
+ false,
+ head,
+ &dagChecker),
+ libs);
+
+ std::set<cmStdString> seenProps = cge->GetSeenTargetProperties();
+ for (std::set<cmStdString>::const_iterator it = seenProps.begin();
+ it != seenProps.end(); ++it)
+ {
+ if (!this->GetProperty(it->c_str()))
+ {
+ this->Target->LinkImplicitNullProperties.insert(*it);
+ }
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::GetInterfaceLinkLibraries(const char *config,
+ std::vector<std::string> &libs, cmTarget *head) const
+{
+ const char *prop = this->GetProperty("INTERFACE_LINK_LIBRARIES");
+ if (prop)
+ {
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
+
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt,
+ this->GetName(),
+ "INTERFACE_LINK_LIBRARIES", 0, 0);
+ cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile,
+ config,
+ false,
+ head,
+ &dagChecker),
+ libs);
+ }
+}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 389cb93..ab089d6 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -191,10 +191,6 @@ public:
/** Get the include directories for this target. */
std::vector<std::string> GetIncludeDirectories(const char *config) const;
- void GetDirectLinkLibraries(const char *config,
- std::vector<std::string> &libs,
- cmTarget *head) const;
-
bool IsSystemIncludeDirectory(const char *dir, const char *config) const;
/** Add the target output files to the global generator manifest. */
@@ -330,6 +326,13 @@ public:
bool HaveBuildTreeRPATH(const char *config) const;
bool HaveInstallTreeRPATH() const;
+ void GetDirectLinkLibraries(const char *config,
+ std::vector<std::string> &,
+ cmTarget const* head) const;
+ void GetInterfaceLinkLibraries(const char *config,
+ std::vector<std::string> &,
+ cmTarget *head) const;
+
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index a2709a7..6c15168 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -751,64 +751,6 @@ bool cmTarget::NameResolvesToFramework(const std::string& libname) const
}
//----------------------------------------------------------------------------
-void cmTarget::GetDirectLinkLibraries(const char *config,
- std::vector<std::string> &libs,
- cmTarget const* head) const
-{
- const char *prop = this->GetProperty("LINK_LIBRARIES");
- if (prop)
- {
- cmListFileBacktrace lfbt;
- cmGeneratorExpression ge(lfbt);
- const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
-
- cmGeneratorExpressionDAGChecker dagChecker(lfbt,
- this->GetName(),
- "LINK_LIBRARIES", 0, 0);
- cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile,
- config,
- false,
- head,
- &dagChecker),
- libs);
-
- std::set<cmStdString> seenProps = cge->GetSeenTargetProperties();
- for (std::set<cmStdString>::const_iterator it = seenProps.begin();
- it != seenProps.end(); ++it)
- {
- if (!this->GetProperty(it->c_str()))
- {
- this->LinkImplicitNullProperties.insert(*it);
- }
- }
- }
-}
-
-//----------------------------------------------------------------------------
-void cmTarget::GetInterfaceLinkLibraries(const char *config,
- std::vector<std::string> &libs,
- cmTarget const* head) const
-{
- const char *prop = this->GetProperty("INTERFACE_LINK_LIBRARIES");
- if (prop)
- {
- cmListFileBacktrace lfbt;
- cmGeneratorExpression ge(lfbt);
- const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
-
- cmGeneratorExpressionDAGChecker dagChecker(lfbt,
- this->GetName(),
- "INTERFACE_LINK_LIBRARIES", 0, 0);
- cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile,
- config,
- false,
- head,
- &dagChecker),
- libs);
- }
-}
-
-//----------------------------------------------------------------------------
std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value,
cmTarget::LinkLibraryType llt) const
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index a352d64..4dc4575 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -172,12 +172,6 @@ public:
return this->LinkLibraries;}
const LinkLibraryVectorType &GetOriginalLinkLibraries() const
{return this->OriginalLinkLibraries;}
- void GetDirectLinkLibraries(const char *config,
- std::vector<std::string> &,
- cmTarget const* head) const;
- void GetInterfaceLinkLibraries(const char *config,
- std::vector<std::string> &,
- cmTarget const* head) const;
/** Compute the link type to use for the given configuration. */
LinkLibraryType ComputeLinkType(const char* config) const;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5bdee48b5d0d047570fe6a9ee91a3ffaca2e4f08
commit 5bdee48b5d0d047570fe6a9ee91a3ffaca2e4f08
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Dec 10 10:54:42 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:08 2014 +0100
Port cmComputeTargetDepends to cmGeneratorTarget.
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 74b13e4..53f098c 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -16,7 +16,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
-#include "cmTarget.h"
+#include "cmGeneratorTarget.h"
#include "cmake.h"
#include <algorithm>
@@ -143,12 +143,12 @@ bool cmComputeTargetDepends::Compute()
//----------------------------------------------------------------------------
void
-cmComputeTargetDepends::GetTargetDirectDepends(cmTarget const* t,
+cmComputeTargetDepends::GetTargetDirectDepends(cmGeneratorTarget const* t,
cmTargetDependSet& deps)
{
// Lookup the index for this target. All targets should be known by
// this point.
- std::map<cmTarget const*, int>::const_iterator tii
+ std::map<cmGeneratorTarget const*, int>::const_iterator tii
= this->TargetIndex.find(t);
assert(tii != this->TargetIndex.end());
int i = tii->second;
@@ -157,7 +157,7 @@ cmComputeTargetDepends::GetTargetDirectDepends(cmTarget const* t,
EdgeList const& nl = this->FinalGraph[i];
for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
- cmTarget const* dep = this->Targets[*ni];
+ cmGeneratorTarget const* dep = this->Targets[*ni];
cmTargetDependSet::iterator di = deps.insert(dep).first;
di->SetType(ni->IsStrong());
}
@@ -171,11 +171,12 @@ void cmComputeTargetDepends::CollectTargets()
this->GlobalGenerator->GetLocalGenerators();
for(unsigned int i = 0; i < lgens.size(); ++i)
{
- const cmTargets& targets = lgens[i]->GetMakefile()->GetTargets();
- for(cmTargets::const_iterator ti = targets.begin();
+ const cmGeneratorTargetsType& targets = lgens[i]->GetMakefile()
+ ->GetGeneratorTargets();
+ for(cmGeneratorTargetsType::const_iterator ti = targets.begin();
ti != targets.end(); ++ti)
{
- cmTarget const* target = &ti->second;
+ cmGeneratorTarget const* target = ti->second;
int index = static_cast<int>(this->Targets.size());
this->TargetIndex[target] = index;
this->Targets.push_back(target);
@@ -200,7 +201,7 @@ void cmComputeTargetDepends::CollectDepends()
void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
{
// Get the depender.
- cmTarget const* depender = this->Targets[depender_index];
+ cmGeneratorTarget const* depender = this->Targets[depender_index];
if (depender->GetType() == cmTarget::INTERFACE_LIBRARY)
{
return;
@@ -214,7 +215,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
std::set<cmStdString> emitted;
{
std::vector<std::string> tlibs;
- depender->GetDirectLinkLibraries(0, tlibs, depender);
+ depender->GetDirectLinkLibraries(0, tlibs, depender->Target);
// A target should not depend on itself.
emitted.insert(depender->GetName());
for(std::vector<std::string>::const_iterator lib = tlibs.begin();
@@ -235,7 +236,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
it != configs.end(); ++it)
{
std::vector<std::string> tlibs;
- depender->GetDirectLinkLibraries(it->c_str(), tlibs, depender);
+ depender->GetDirectLinkLibraries(it->c_str(), tlibs, depender->Target);
// A target should not depend on itself.
emitted.insert(depender->GetName());
@@ -255,7 +256,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// Loop over all utility dependencies.
{
- std::set<cmStdString> const& tutils = depender->GetUtilities();
+ std::set<cmStdString> const& tutils = depender->Target->GetUtilities();
std::set<cmStdString> emitted;
// A target should not depend on itself.
emitted.insert(depender->GetName());
@@ -273,17 +274,15 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
//----------------------------------------------------------------------------
void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
- cmTarget const* dependee,
- const char *config,
- std::set<cmStdString> &emitted)
+ cmGeneratorTarget const* dependee,
+ const char *config,
+ std::set<cmStdString> &emitted)
{
- cmTarget const* depender = this->Targets[depender_index];
- cmGeneratorTarget *gtgt = depender->GetMakefile()->GetLocalGenerator()
- ->GetGlobalGenerator()
- ->GetGeneratorTarget(dependee);
+ cmGeneratorTarget const* depender = this->Targets[depender_index];
if(cmGeneratorTarget::LinkInterface const* iface =
- gtgt->GetLinkInterface(config, depender))
+ dependee->GetLinkInterface(config,
+ depender->Target))
{
for(std::vector<std::string>::const_iterator
lib = iface->Libraries.begin();
@@ -306,15 +305,15 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
bool linking,
std::set<cmStdString> &emitted)
{
- cmTarget const* depender = this->Targets[depender_index];
- cmTarget const* dependee =
- depender->GetMakefile()->FindTargetToUse(dependee_name);
+ cmGeneratorTarget const* depender = this->Targets[depender_index];
+ cmGeneratorTarget const* dependee =
+ depender->GetMakefile()->FindGeneratorTargetToUse(dependee_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(linking && dependee &&
dependee->GetType() == cmTarget::EXECUTABLE &&
- !dependee->IsExecutableWithExports())
+ !dependee->Target->IsExecutableWithExports())
{
dependee = 0;
}
@@ -323,7 +322,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
{
this->AddInterfaceDepends(depender_index, dependee, 0, emitted);
std::vector<std::string> configs;
- depender->GetMakefile()->GetConfigurations(configs);
+ depender->Target->GetMakefile()->GetConfigurations(configs);
for (std::vector<std::string>::const_iterator it = configs.begin();
it != configs.end(); ++it)
{
@@ -341,18 +340,18 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
bool linking)
{
// Get the depender.
- cmTarget const* depender = this->Targets[depender_index];
+ cmGeneratorTarget const* depender = this->Targets[depender_index];
// Check the target's makefile first.
- cmTarget const* dependee =
- depender->GetMakefile()->FindTargetToUse(dependee_name);
+ cmGeneratorTarget const* dependee =
+ depender->GetMakefile()->FindGeneratorTargetToUse(dependee_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(linking && dependee &&
dependee->GetType() == cmTarget::EXECUTABLE &&
- !dependee->IsExecutableWithExports())
+ !dependee->Target->IsExecutableWithExports())
{
dependee = 0;
}
@@ -365,18 +364,18 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
//----------------------------------------------------------------------------
void cmComputeTargetDepends::AddTargetDepend(int depender_index,
- cmTarget const* dependee,
+ cmGeneratorTarget const* dependee,
bool linking)
{
- if(dependee->IsImported())
+ if(dependee->Target->IsImported())
{
// Skip imported targets but follow their utility dependencies.
- std::set<cmStdString> const& utils = dependee->GetUtilities();
+ std::set<cmStdString> const& utils = dependee->Target->GetUtilities();
for(std::set<cmStdString>::const_iterator i = utils.begin();
i != utils.end(); ++i)
{
- if(cmTarget const* transitive_dependee =
- dependee->GetMakefile()->FindTargetToUse(i->c_str()))
+ if(cmGeneratorTarget const* transitive_dependee =
+ dependee->GetMakefile()->FindGeneratorTargetToUse(i->c_str()))
{
this->AddTargetDepend(depender_index, transitive_dependee, false);
}
@@ -386,7 +385,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
{
// Lookup the index for this target. All targets should be known by
// this point.
- std::map<cmTarget const*, int>::const_iterator tii =
+ std::map<cmGeneratorTarget const*, int>::const_iterator tii =
this->TargetIndex.find(dependee);
assert(tii != this->TargetIndex.end());
int dependee_index = tii->second;
@@ -406,13 +405,13 @@ cmComputeTargetDepends::DisplayGraph(Graph const& graph, const char* name)
for(int depender_index = 0; depender_index < n; ++depender_index)
{
EdgeList const& nl = graph[depender_index];
- cmTarget const* depender = this->Targets[depender_index];
+ cmGeneratorTarget const* depender = this->Targets[depender_index];
fprintf(stderr, "target %d is [%s]\n",
depender_index, depender->GetName());
for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
int dependee_index = *ni;
- cmTarget const* dependee = this->Targets[dependee_index];
+ cmGeneratorTarget const* dependee = this->Targets[dependee_index];
fprintf(stderr, " depends on target %d [%s] (%s)\n", dependee_index,
dependee->GetName(), ni->IsStrong()? "strong" : "weak");
}
@@ -499,11 +498,12 @@ cmComputeTargetDepends
{
// Get the depender.
int i = *ci;
- cmTarget const* depender = this->Targets[i];
+ cmGeneratorTarget const* depender = this->Targets[i];
// Describe the depender.
e << " \"" << depender->GetName() << "\" of type "
- << cmTarget::GetTargetTypeName(depender->GetType()) << "\n";
+ << cmTarget::GetTargetTypeName(cmTarget::TargetType(depender->GetType()))
+ << "\n";
// List its dependencies that are inside the component.
EdgeList const& nl = this->InitialGraph[i];
@@ -512,7 +512,7 @@ cmComputeTargetDepends
int j = *ni;
if(cmap[j] == c)
{
- cmTarget const* dependee = this->Targets[j];
+ cmGeneratorTarget const* dependee = this->Targets[j];
e << " depends on \"" << dependee->GetName() << "\""
<< " (" << (ni->IsStrong()? "strong" : "weak") << ")\n";
}
diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h
index 6cd6da0..54d237a 100644
--- a/Source/cmComputeTargetDepends.h
+++ b/Source/cmComputeTargetDepends.h
@@ -20,7 +20,7 @@
class cmComputeComponentGraph;
class cmGlobalGenerator;
-class cmTarget;
+class cmGeneratorTarget;
class cmTargetDependSet;
/** \class cmComputeTargetDepends
@@ -38,21 +38,23 @@ public:
bool Compute();
- std::vector<cmTarget const*> const&
+ std::vector<cmGeneratorTarget const*> const&
GetTargets() const { return this->Targets; }
- void GetTargetDirectDepends(cmTarget const* t, cmTargetDependSet& deps);
+ void GetTargetDirectDepends(cmGeneratorTarget const* t,
+ cmTargetDependSet& deps);
private:
void CollectTargets();
void CollectDepends();
void CollectTargetDepends(int depender_index);
void AddTargetDepend(int depender_index, const char* dependee_name,
bool linking);
- void AddTargetDepend(int depender_index, cmTarget const* dependee,
+ void AddTargetDepend(int depender_index, cmGeneratorTarget const* dependee,
bool linking);
bool ComputeFinalDepends(cmComputeComponentGraph const& ccg);
void AddInterfaceDepends(int depender_index, const char* dependee_name,
bool linking, std::set<cmStdString> &emitted);
- void AddInterfaceDepends(int depender_index, cmTarget const* dependee,
+ void AddInterfaceDepends(int depender_index,
+ cmGeneratorTarget const* dependee,
const char *config,
std::set<cmStdString> &emitted);
cmGlobalGenerator* GlobalGenerator;
@@ -60,8 +62,8 @@ private:
bool NoCycles;
// Collect all targets.
- std::vector<cmTarget const*> Targets;
- std::map<cmTarget const*, int> TargetIndex;
+ std::vector<cmGeneratorTarget const*> Targets;
+ std::map<cmGeneratorTarget const*, int> TargetIndex;
// Represent the target dependency graph. The entry at each
// top-level index corresponds to a depender whose dependencies are
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index f135276..5ff1510 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -948,19 +948,20 @@ void cmGlobalGenerator::ClearEnabledLanguages()
}
bool cmGlobalGenerator::IsDependedOn(const char* project,
- cmTarget const* targetIn)
+ cmGeneratorTarget const* targetIn)
{
// Get all local gens for this project
std::vector<cmLocalGenerator*>* gens = &this->ProjectMap[project];
// loop over local gens and get the targets for each one
for(unsigned int i = 0; i < gens->size(); ++i)
{
- cmTargets& targets = (*gens)[i]->GetMakefile()->GetTargets();
- for (cmTargets::iterator l = targets.begin();
+ const cmGeneratorTargetsType& targets = (*gens)[i]->GetMakefile()
+ ->GetGeneratorTargets();
+ for (cmGeneratorTargetsType::const_iterator l = targets.begin();
l != targets.end(); l++)
{
- cmTarget& target = l->second;
- TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
+ cmGeneratorTarget *target = l->second;
+ TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(*target);
if(tgtdeps.count(targetIn))
{
return true;
@@ -1234,9 +1235,9 @@ bool cmGlobalGenerator::ComputeTargetDepends()
{
return false;
}
- std::vector<cmTarget const*> const& targets = ctd.GetTargets();
- for(std::vector<cmTarget const*>::const_iterator ti = targets.begin();
- ti != targets.end(); ++ti)
+ std::vector<cmGeneratorTarget const*> const& targets = ctd.GetTargets();
+ for(std::vector<cmGeneratorTarget const*>::const_iterator ti
+ = targets.begin(); ti != targets.end(); ++ti)
{
ctd.GetTargetDirectDepends(*ti, this->TargetDependencies[*ti]);
}
@@ -1974,25 +1975,27 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap()
{
cmLocalGenerator* lg = *lgi;
cmMakefile* mf = lg->GetMakefile();
- cmTargets& targets = mf->GetTargets();
- for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
+ const cmGeneratorTargetsType& targets = mf->GetGeneratorTargets();
+ for(cmGeneratorTargetsType::const_iterator t = targets.begin();
+ t != targets.end(); ++t)
{
- cmTarget& target = t->second;
+ cmGeneratorTarget* target = t->second;
// Consider the directory containing the target and all its
// parents until something excludes the target.
- for(cmLocalGenerator* clg = lg; clg && !this->IsExcluded(clg, target);
+ for(cmLocalGenerator* clg = lg;
+ clg && !this->IsExcluded(clg, *target->Target);
clg = clg->GetParent())
{
// This local generator includes the target.
std::set<cmTarget const*>& targetSet =
this->LocalGeneratorToTargetMap[clg];
- targetSet.insert(&target);
+ targetSet.insert(target->Target);
// Add dependencies of the included target. An excluded
// target may still be included if it is a dependency of a
// non-excluded target.
- TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
+ TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(*target);
for(TargetDependSet::const_iterator ti = tgtdeps.begin();
ti != tgtdeps.end(); ++ti)
{
@@ -2529,7 +2532,7 @@ void cmGlobalGenerator::AppendDirectoryForConfig(const char*, const char*,
//----------------------------------------------------------------------------
cmGlobalGenerator::TargetDependSet const&
-cmGlobalGenerator::GetTargetDirectDepends(cmTarget const& target)
+cmGlobalGenerator::GetTargetDirectDepends(cmGeneratorTarget const& target)
{
return this->TargetDependencies[&target];
}
@@ -2625,18 +2628,19 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
}
cmMakefile* mf = (*i)->GetMakefile();
// Get the targets in the makefile
- cmTargets &tgts = mf->GetTargets();
+ const cmGeneratorTargetsType &tgts = mf->GetGeneratorTargets();
// loop over all the targets
- for (cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
+ for (cmGeneratorTargetsType::const_iterator l = tgts.begin();
+ l != tgts.end(); ++l)
{
- cmTarget* target = &l->second;
- if(this->IsRootOnlyTarget(target) &&
- target->GetMakefile() != root->GetMakefile())
+ cmGeneratorTarget* target = l->second;
+ if(this->IsRootOnlyTarget(target->Target) &&
+ target->Target->GetMakefile() != root->GetMakefile())
{
continue;
}
// put the target in the set of original targets
- originalTargets.insert(target);
+ originalTargets.insert(target->Target);
// Get the set of targets that depend on target
this->AddTargetDepends(target, projectTargets);
}
@@ -2651,7 +2655,7 @@ bool cmGlobalGenerator::IsRootOnlyTarget(cmTarget* target)
}
//----------------------------------------------------------------------------
-void cmGlobalGenerator::AddTargetDepends(cmTarget const* target,
+void cmGlobalGenerator::AddTargetDepends(cmGeneratorTarget const* target,
TargetDependSet& projectTargets)
{
// add the target itself
@@ -2663,7 +2667,11 @@ void cmGlobalGenerator::AddTargetDepends(cmTarget const* target,
for(TargetDependSet::const_iterator i = ts.begin(); i != ts.end(); ++i)
{
cmTarget const* dtarget = *i;
- this->AddTargetDepends(dtarget, projectTargets);
+ cmGeneratorTarget *gtgt = dtarget->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(dtarget);
+
+ this->AddTargetDepends(gtgt, projectTargets);
}
}
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 3c86537..b3f6827 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -220,7 +220,7 @@ public:
/** If check to see if the target is linked to by any other
target in the project */
- bool IsDependedOn(const char* project, cmTarget const* target);
+ bool IsDependedOn(const char* project, cmGeneratorTarget const* target);
///! Find a local generator by its startdirectory
cmLocalGenerator* FindLocalGenerator(const char* start_dir);
@@ -268,7 +268,8 @@ public:
// what targets does the specified target depend on directly
// via a target_link_libraries or add_dependencies
- TargetDependSet const& GetTargetDirectDepends(cmTarget const& target);
+ TargetDependSet const&
+ GetTargetDirectDepends(cmGeneratorTarget const& target);
/** Get per-target generator information. */
cmGeneratorTarget* GetGeneratorTarget(cmTarget const*) const;
@@ -327,7 +328,7 @@ protected:
TargetDependSet& originalTargets,
cmLocalGenerator* root, GeneratorVector const&);
virtual bool IsRootOnlyTarget(cmTarget* target);
- void AddTargetDepends(cmTarget const* target,
+ void AddTargetDepends(cmGeneratorTarget const* target,
TargetDependSet& projectTargets);
void SetLanguageEnabledFlag(const char* l, cmMakefile* mf);
void SetLanguageEnabledMaps(const char* l, cmMakefile* mf);
@@ -430,7 +431,7 @@ private:
std::vector<std::string> FilesReplacedDuringGenerate;
// Store computed inter-target dependencies.
- typedef std::map<cmTarget const*, TargetDependSet> TargetDependMap;
+ typedef std::map<cmGeneratorTarget const*, TargetDependSet> TargetDependMap;
TargetDependMap TargetDependencies;
// Per-target generator information.
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index a53cd9b..631962f 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -893,8 +893,12 @@ cmGlobalNinjaGenerator
std::set<cmStdString> const& utils = target->GetUtilities();
std::copy(utils.begin(), utils.end(), std::back_inserter(outputs));
} else {
+ cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
+
cmTargetDependSet const& targetDeps =
- this->GetTargetDirectDepends(*target);
+ this->GetTargetDirectDepends(*gtgt);
for (cmTargetDependSet::const_iterator i = targetDeps.begin();
i != targetDeps.end(); ++i)
{
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index c339058..e328589 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -926,7 +926,12 @@ cmGlobalUnixMakefileGenerator3
if(emitted.insert(target).second)
{
count = this->ProgressMap[target].Marks.size();
- TargetDependSet const& depends = this->GetTargetDirectDepends(*target);
+
+ cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
+
+ TargetDependSet const& depends = this->GetTargetDirectDepends(*gtgt);
for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
{
@@ -1015,7 +1020,11 @@ cmGlobalUnixMakefileGenerator3
::AppendGlobalTargetDepends(std::vector<std::string>& depends,
cmTarget& target)
{
- TargetDependSet const& depends_set = this->GetTargetDirectDepends(target);
+ cmGeneratorTarget *gtgt = target.GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(&target);
+
+ TargetDependSet const& depends_set = this->GetTargetDirectDepends(*gtgt);
for(TargetDependSet::const_iterator i = depends_set.begin();
i != depends_set.end(); ++i)
{
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index bb63289..52f1293 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -985,7 +985,10 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project,
{
return activeConfigs;
}
- if(type == cmTarget::UTILITY && !this->IsDependedOn(project, target))
+ cmGeneratorTarget const* gtgt = target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
+ if(type == cmTarget::UTILITY && !this->IsDependedOn(project, gtgt))
{
return activeConfigs;
}
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 12c240b..f106784 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -417,7 +417,10 @@ bool cmGlobalVisualStudio8Generator::ComputeTargetDepends()
void cmGlobalVisualStudio8Generator::WriteProjectDepends(
std::ostream& fout, const char*, const char*, cmTarget const& t)
{
- TargetDependSet const& unordered = this->GetTargetDirectDepends(t);
+ cmGeneratorTarget const* gtgt = t.GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(&t);
+ TargetDependSet const& unordered = this->GetTargetDirectDepends(*gtgt);
OrderedTargetDependSet depends(unordered);
for(OrderedTargetDependSet::const_iterator i = depends.begin();
i != depends.end(); ++i)
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 42492e6..7fa7cee 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -322,7 +322,10 @@ void cmGlobalVisualStudioGenerator::FillLinkClosure(cmTarget const* target,
{
if(linked.insert(target).second)
{
- TargetDependSet const& depends = this->GetTargetDirectDepends(*target);
+ cmGeneratorTarget const* gtgt = target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
+ TargetDependSet const& depends = this->GetTargetDirectDepends(*gtgt);
for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
{
@@ -361,7 +364,10 @@ void cmGlobalVisualStudioGenerator::FollowLinkDepends(
{
// Static library targets do not list their link dependencies so
// we must follow them transitively now.
- TargetDependSet const& depends = this->GetTargetDirectDepends(*target);
+ cmGeneratorTarget const* gtgt = target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
+ TargetDependSet const& depends = this->GetTargetDirectDepends(*gtgt);
for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
{
@@ -436,7 +442,10 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
target.GetType() != cmTarget::MODULE_LIBRARY &&
target.GetType() != cmTarget::EXECUTABLE);
- TargetDependSet const& depends = this->GetTargetDirectDepends(target);
+ cmGeneratorTarget const* gtgt = target.GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(&target);
+ TargetDependSet const& depends = this->GetTargetDirectDepends(*gtgt);
// Collect implicit link dependencies (target_link_libraries).
// Static libraries cannot depend on their link implementation
diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h
index 1feb072..ccfd95a 100644
--- a/Source/cmTargetDepend.h
+++ b/Source/cmTargetDepend.h
@@ -14,7 +14,7 @@
#include "cmStandardIncludes.h"
-class cmTarget;
+#include "cmGeneratorTarget.h"
/** One edge in the global target dependency graph.
It may be marked as a 'link' or 'util' edge or both. */
@@ -27,6 +27,8 @@ class cmTargetDepend
mutable bool Link;
mutable bool Util;
public:
+ cmTargetDepend(cmGeneratorTarget const* t)
+ : Target(t->Target), Link(false), Util(false) {}
cmTargetDepend(cmTarget const* t): Target(t), Link(false), Util(false) {}
operator cmTarget const*() const { return this->Target; }
cmTarget const* operator->() const { return this->Target; }
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 62fea2d..d04ea97 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1848,7 +1848,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
void cmVisualStudio10TargetGenerator::WriteProjectReferences()
{
cmGlobalGenerator::TargetDependSet const& unordered
- = this->GlobalGenerator->GetTargetDirectDepends(*this->Target);
+ = this->GlobalGenerator->GetTargetDirectDepends(*this->GeneratorTarget);
typedef cmGlobalVisualStudioGenerator::OrderedTargetDependSet
OrderedTargetDependSet;
OrderedTargetDependSet depends(unordered);
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=212048a7854b925e2e0d2d7a8787598482d11b6c
commit 212048a7854b925e2e0d2d7a8787598482d11b6c
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Dec 10 09:44:54 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:08 2014 +0100
Move HaveBuildTreeRPATH to cmGeneratorTarget.
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index cbe0f65..74102c6 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1910,10 +1910,10 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
(for_install ||
this->Target->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"));
bool use_install_rpath =
- (outputRuntime && this->Target->Target->HaveInstallTreeRPATH() &&
+ (outputRuntime && this->Target->HaveInstallTreeRPATH() &&
linking_for_install);
bool use_build_rpath =
- (outputRuntime && this->Target->Target->HaveBuildTreeRPATH(this->Config)
+ (outputRuntime && this->Target->HaveBuildTreeRPATH(this->Config)
&& !linking_for_install);
bool use_link_rpath =
outputRuntime && linking_for_install &&
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 1bc4cd0..a17d4c7 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -492,8 +492,8 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall(const char* config) const
// If either a build or install tree rpath is set then the rpath
// will likely change between the build tree and install tree and
// this target must be relinked.
- return this->Target->HaveBuildTreeRPATH(config)
- || this->Target->HaveInstallTreeRPATH();
+ return this->HaveBuildTreeRPATH(config)
+ || this->HaveInstallTreeRPATH();
}
//----------------------------------------------------------------------------
@@ -3777,3 +3777,23 @@ void cmGeneratorTarget::ComputeVersionedName(std::string& vName,
}
vName += apple ? suffix : std::string();
}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::HaveBuildTreeRPATH(const char *config) const
+{
+ if (this->GetPropertyAsBool("SKIP_BUILD_RPATH"))
+ {
+ return false;
+ }
+ std::vector<std::string> libs;
+ this->GetDirectLinkLibraries(config, libs, this->Target);
+ return !libs.empty();
+}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::HaveInstallTreeRPATH() const
+{
+ const char* install_rpath = this->GetProperty("INSTALL_RPATH");
+ return (install_rpath && *install_rpath) &&
+ !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH");
+}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 6633ff8..389cb93 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -327,6 +327,9 @@ public:
LinkImplementation const* GetLinkImplementation(const char* config,
cmTarget const* head) const;
+ bool HaveBuildTreeRPATH(const char *config) const;
+ bool HaveInstallTreeRPATH() const;
+
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 4cfdb6d..a2709a7 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2492,26 +2492,6 @@ void cmTarget::SetPropertyDefault(const char* property,
}
//----------------------------------------------------------------------------
-bool cmTarget::HaveBuildTreeRPATH(const char *config) const
-{
- if (this->GetPropertyAsBool("SKIP_BUILD_RPATH"))
- {
- return false;
- }
- std::vector<std::string> libs;
- this->GetDirectLinkLibraries(config, libs, this);
- return !libs.empty();
-}
-
-//----------------------------------------------------------------------------
-bool cmTarget::HaveInstallTreeRPATH() const
-{
- const char* install_rpath = this->GetProperty("INSTALL_RPATH");
- return (install_rpath && *install_rpath) &&
- !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH");
-}
-
-//----------------------------------------------------------------------------
const char* cmTarget::GetOutputTargetType(bool implib) const
{
switch(this->GetType())
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index a7f0f48..a352d64 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -296,9 +296,6 @@ public:
bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
const char* newExt = 0) const;
- bool HaveBuildTreeRPATH(const char *config) const;
- bool HaveInstallTreeRPATH() const;
-
// Get the properties
cmPropertyMap &GetProperties() const { return this->Properties; };
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d69841c7eb6561baebb218a620bf751f43a5ed40
commit d69841c7eb6561baebb218a620bf751f43a5ed40
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Dec 9 22:06:57 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:08 2014 +0100
Move ComputeVersionedName to cmGeneratorTarget.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 67b7b69..1bc4cd0 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3066,11 +3066,11 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name,
else
{
// The library's soname.
- this->Target->ComputeVersionedName(soName, prefix, base, suffix,
+ this->ComputeVersionedName(soName, prefix, base, suffix,
name, soversion);
// The library's real name on disk.
- this->Target->ComputeVersionedName(realName, prefix, base, suffix,
+ this->ComputeVersionedName(realName, prefix, base, suffix,
name, version);
}
@@ -3759,3 +3759,21 @@ bool cmGeneratorTarget::MacOSXRpathInstallNameDirDefault() const
return false;
}
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::ComputeVersionedName(std::string& vName,
+ std::string const& prefix,
+ std::string const& base,
+ std::string const& suffix,
+ std::string const& name,
+ const char* version) const
+{
+ const bool apple = this->Makefile->IsOn("APPLE");
+ vName = apple ? (prefix+base) : name;
+ if(version)
+ {
+ vName += ".";
+ vName += version;
+ }
+ vName += apple ? suffix : std::string();
+}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index b1b42dd..6633ff8 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -361,6 +361,12 @@ private:
LinkImplementation& impl,
cmTarget const* head) const;
+ void ComputeVersionedName(std::string& vName,
+ std::string const& prefix,
+ std::string const& base,
+ std::string const& suffix,
+ std::string const& name,
+ const char* version) const;
typedef std::map<TargetConfigPair, LinkClosure> LinkClosureMapType;
mutable LinkClosureMapType LinkClosureMap;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 3ce81a4..4cfdb6d 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2454,23 +2454,6 @@ cmTarget::ImportedGetFullPath(const char* config, bool implib) const
}
//----------------------------------------------------------------------------
-void cmTarget::ComputeVersionedName(std::string& vName,
- std::string const& prefix,
- std::string const& base,
- std::string const& suffix,
- std::string const& name,
- const char* version) const
-{
- vName = this->IsApple? (prefix+base) : name;
- if(version)
- {
- vName += ".";
- vName += version;
- }
- vName += this->IsApple? suffix : std::string();
-}
-
-//----------------------------------------------------------------------------
bool cmTarget::HasImplibGNUtoMS() const
{
return this->HasImportLibrary() && this->GetPropertyAsBool("GNUtoMS");
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 48bead1..a7f0f48 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -551,12 +551,6 @@ private:
cmTargetInternalPointer Internal;
void ConstructSourceFileFlags() const;
- void ComputeVersionedName(std::string& vName,
- std::string const& prefix,
- std::string const& base,
- std::string const& suffix,
- std::string const& name,
- const char* version) const;
};
typedef std::map<cmStdString,cmTarget> cmTargets;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eba2cc74da17c9e016b728027150ab24e2648efe
commit eba2cc74da17c9e016b728027150ab24e2648efe
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Oct 10 22:20:56 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:08 2014 +0100
Port part of cmLinkInformation to cmGeneratorTarget.
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 939a9e7..cbe0f65 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -240,12 +240,12 @@ because this need be done only for shared libraries without soname-s.
//----------------------------------------------------------------------------
cmComputeLinkInformation
-::cmComputeLinkInformation(cmTarget const* target, const char* config,
+::cmComputeLinkInformation(cmGeneratorTarget const* target, const char* config,
cmTarget const* headTarget)
{
// Store context information.
this->Target = target;
- this->Makefile = this->Target->GetMakefile();
+ this->Makefile = this->Target->Target->GetMakefile();
this->HeadTarget = this->Makefile->GetLocalGenerator()
->GetGlobalGenerator()
->GetGeneratorTarget(headTarget);
@@ -262,18 +262,15 @@ cmComputeLinkInformation
// Allocate internals.
this->OrderLinkerSearchPath =
- new cmOrderDirectories(this->GlobalGenerator, target,
+ new cmOrderDirectories(this->GlobalGenerator, target->Target,
"linker search path");
this->OrderRuntimeSearchPath =
- new cmOrderDirectories(this->GlobalGenerator, target,
+ new cmOrderDirectories(this->GlobalGenerator, target->Target,
"runtime search path");
this->OrderDependentRPath = 0;
- cmGeneratorTarget *gtgt = this->Target->GetMakefile()->GetLocalGenerator()
- ->GetGlobalGenerator()
- ->GetGeneratorTarget(this->Target);
// Get the language used for linking this target.
- this->LinkLanguage = gtgt->GetLinkerLanguage(config, headTarget);
+ this->LinkLanguage = this->Target->GetLinkerLanguage(config, headTarget);
if(!this->LinkLanguage)
{
// The Compute method will do nothing, so skip the rest of the
@@ -329,7 +326,7 @@ cmComputeLinkInformation
(this->Makefile->
GetSafeDefinition("CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH"));
- this->RuntimeUseChrpath = gtgt->IsChrpathUsed(config);
+ this->RuntimeUseChrpath = this->Target->IsChrpathUsed(config);
// Get options needed to help find dependent libraries.
std::string rlVar = "CMAKE_";
@@ -375,15 +372,15 @@ cmComputeLinkInformation
{
this->SharedDependencyMode = SharedDepModeDir;
this->OrderDependentRPath =
- new cmOrderDirectories(this->GlobalGenerator, target,
+ new cmOrderDirectories(this->GlobalGenerator, target->Target,
"dependent library path");
}
// Add the search path entries requested by the user to path ordering.
this->OrderLinkerSearchPath
- ->AddUserDirectories(this->Target->GetLinkDirectories());
+ ->AddUserDirectories(this->Target->Target->GetLinkDirectories());
this->OrderRuntimeSearchPath
- ->AddUserDirectories(this->Target->GetLinkDirectories());
+ ->AddUserDirectories(this->Target->Target->GetLinkDirectories());
// Set up the implicit link directories.
this->LoadImplicitLinkInfo();
@@ -411,12 +408,13 @@ cmComputeLinkInformation
// order to support such projects we need to add the directories
// containing libraries linked with a full path to the -L path.
this->OldLinkDirMode =
- this->Target->GetPolicyStatusCMP0003() != cmPolicies::NEW;
+ this->Target->Target->GetPolicyStatusCMP0003() != cmPolicies::NEW;
if(this->OldLinkDirMode)
{
// Construct a mask to not bother with this behavior for link
// 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();
for(std::vector<std::string>::const_iterator di = dirs.begin();
di != dirs.end(); ++di)
{
@@ -512,7 +510,7 @@ bool cmComputeLinkInformation::Compute()
}
// Compute the ordered link line items.
- cmComputeLinkDepends cld(this->Target, this->Config,
+ cmComputeLinkDepends cld(this->Target->Target, this->Config,
this->HeadTarget->Target);
cld.SetOldLinkDirMode(this->OldLinkDirMode);
cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute();
@@ -583,11 +581,8 @@ void cmComputeLinkInformation::AddImplicitLinkInfo()
{
// The link closure lists all languages whose implicit info is needed.
- cmGeneratorTarget *gtgt = this->Target->GetMakefile()->GetLocalGenerator()
- ->GetGlobalGenerator()
- ->GetGeneratorTarget(this->Target);
-
- cmGeneratorTarget::LinkClosure const* lc = gtgt->GetLinkClosure(this->Config,
+ cmGeneratorTarget::LinkClosure const* lc =
+ this->Target->GetLinkClosure(this->Config,
this->HeadTarget->Target);
for(std::vector<std::string>::const_iterator li = lc->Languages.begin();
li != lc->Languages.end(); ++li)
@@ -1152,7 +1147,7 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
// Full path libraries should specify a valid library file name.
// See documentation of CMP0008.
- if(this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW &&
+ if(this->Target->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW &&
(strstr(this->GlobalGenerator->GetName(), "Visual Studio") ||
strstr(this->GlobalGenerator->GetName(), "Xcode")))
{
@@ -1523,7 +1518,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
this->OrderLinkerSearchPath->AddLinkLibrary(item);
// Produce any needed message.
- switch(this->Target->GetPolicyStatusCMP0008())
+ switch(this->Target->Target->GetPolicyStatusCMP0008())
{
case cmPolicies::WARN:
{
@@ -1540,7 +1535,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
<< " " << item << "\n"
<< "which is a full-path but not a valid library file name.";
this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
- this->Target->GetBacktrace());
+ this->Target->Target->GetBacktrace());
}
}
case cmPolicies::OLD:
@@ -1559,7 +1554,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
<< " " << item << "\n"
<< "which is a full-path but not a valid library file name.";
this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(),
- this->Target->GetBacktrace());
+ this->Target->Target->GetBacktrace());
}
break;
}
@@ -1576,7 +1571,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
}
// Enforce policy constraints.
- switch(this->Target->GetPolicyStatusCMP0003())
+ switch(this->Target->Target->GetPolicyStatusCMP0003())
{
case cmPolicies::WARN:
if(!this->CMakeInstance->GetPropertyAsBool("CMP0003-WARNING-GIVEN"))
@@ -1585,7 +1580,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
cmOStringStream w;
this->PrintLinkPolicyDiagnosis(w);
this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
- this->Target->GetBacktrace());
+ this->Target->Target->GetBacktrace());
}
case cmPolicies::OLD:
// OLD behavior is to add the paths containing libraries with
@@ -1602,7 +1597,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
GetRequiredPolicyError(cmPolicies::CMP0003)) << "\n";
this->PrintLinkPolicyDiagnosis(e);
this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(),
- this->Target->GetBacktrace());
+ this->Target->Target->GetBacktrace());
return false;
}
}
@@ -1778,7 +1773,7 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
// @loader_path or full paths.
if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
- cmGeneratorTarget *gtgt = this->Target->GetMakefile()->GetLocalGenerator()
+ cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator()
->GetGlobalGenerator()
->GetGeneratorTarget(target);
if(!gtgt->HasMacOSXRpathInstallNameDir(this->Config))
@@ -1915,11 +1910,11 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
(for_install ||
this->Target->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"));
bool use_install_rpath =
- (outputRuntime && this->Target->HaveInstallTreeRPATH() &&
+ (outputRuntime && this->Target->Target->HaveInstallTreeRPATH() &&
linking_for_install);
bool use_build_rpath =
- (outputRuntime && this->Target->HaveBuildTreeRPATH(this->Config) &&
- !linking_for_install);
+ (outputRuntime && this->Target->Target->HaveBuildTreeRPATH(this->Config)
+ && !linking_for_install);
bool use_link_rpath =
outputRuntime && linking_for_install &&
!this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH") &&
@@ -2001,11 +1996,8 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
// Add runtime paths required by the languages to always be
// present. This is done even when skipping rpath support.
{
- cmGeneratorTarget *gtgt = this->Makefile->GetLocalGenerator()
- ->GetGlobalGenerator()
- ->GetGeneratorTarget(this->Target);
cmGeneratorTarget::LinkClosure const* lc =
- gtgt->GetLinkClosure(this->Config, this->HeadTarget->Target);
+ this->Target->GetLinkClosure(this->Config, this->HeadTarget->Target);
for(std::vector<std::string>::const_iterator li = lc->Languages.begin();
li != lc->Languages.end(); ++li)
{
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index f91f6cc..c39cb31 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -30,7 +30,7 @@ class cmOrderDirectories;
class cmComputeLinkInformation
{
public:
- cmComputeLinkInformation(cmTarget const* target, const char* config,
+ cmComputeLinkInformation(cmGeneratorTarget const* target, const char* config,
cmTarget const* headTarget);
~cmComputeLinkInformation();
bool Compute();
@@ -75,7 +75,7 @@ private:
std::set<cmTarget const*> SharedLibrariesLinked;
// Context information.
- cmTarget const* Target;
+ cmGeneratorTarget const* Target;
cmGeneratorTarget const* HeadTarget;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index ce2ce75..67b7b69 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -2178,7 +2178,7 @@ cmGeneratorTarget::GetLinkInformation(const char* config,
{
// Compute information for this configuration.
cmComputeLinkInformation* info =
- new cmComputeLinkInformation(this->Target, config, headTarget);
+ new cmComputeLinkInformation(this, config, headTarget);
if(!info || !info->Compute())
{
delete info;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95b8ea1c93f3322d8a988700dbed48e6e2a3af4f
commit 95b8ea1c93f3322d8a988700dbed48e6e2a3af4f
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 9 14:49:35 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:08 2014 +0100
Move HasMacOSXRPath to cmGeneratorTarget.
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index dd9968f..939a9e7 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1778,7 +1778,10 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
// @loader_path or full paths.
if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
- if(!target->HasMacOSXRpathInstallNameDir(this->Config))
+ cmGeneratorTarget *gtgt = this->Target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
+ if(!gtgt->HasMacOSXRpathInstallNameDir(this->Config))
{
return;
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index d903997..ce2ce75 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -683,7 +683,7 @@ cmGeneratorTarget::GetInstallNameDirForBuildTree(const char* config) const
!this->GetPropertyAsBool("SKIP_BUILD_RPATH"))
{
std::string dir;
- if(this->Target->MacOSXRpathInstallNameDirDefault())
+ if(this->MacOSXRpathInstallNameDirDefault())
{
dir = "@rpath";
}
@@ -719,7 +719,7 @@ std::string cmGeneratorTarget::GetInstallNameDirForInstallTree() const
}
if(!install_name_dir)
{
- if(this->Target->MacOSXRpathInstallNameDirDefault())
+ if(this->MacOSXRpathInstallNameDirDefault())
{
dir = "@rpath/";
}
@@ -3645,3 +3645,117 @@ bool cmStrictTargetComparison::operator()(cmTarget const* t1,
}
return nameResult < 0;
}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::HasMacOSXRpathInstallNameDir(const char* config) const
+{
+ bool install_name_is_rpath = false;
+ bool macosx_rpath = false;
+
+ if(!this->IsImported())
+ {
+ if(this->GetType() != cmTarget::SHARED_LIBRARY)
+ {
+ return false;
+ }
+ const char* install_name = this->GetProperty("INSTALL_NAME_DIR");
+ bool use_install_name =
+ this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH");
+ if(install_name && use_install_name &&
+ std::string(install_name) == "@rpath")
+ {
+ install_name_is_rpath = true;
+ }
+ else if(install_name && use_install_name)
+ {
+ return false;
+ }
+ if(!install_name_is_rpath)
+ {
+ macosx_rpath = this->MacOSXRpathInstallNameDirDefault();
+ }
+ }
+ else
+ {
+ // Lookup the imported soname.
+ if(cmTarget::ImportInfo const* info =
+ this->Target->GetImportInfo(config, this->Target))
+ {
+ if(!info->NoSOName && !info->SOName.empty())
+ {
+ if(info->SOName.find("@rpath/") == 0)
+ {
+ install_name_is_rpath = true;
+ }
+ }
+ else
+ {
+ std::string install_name;
+ cmSystemTools::GuessLibraryInstallName(info->Location, install_name);
+ if(install_name.find("@rpath") != std::string::npos)
+ {
+ install_name_is_rpath = true;
+ }
+ }
+ }
+ }
+
+ if(!install_name_is_rpath && !macosx_rpath)
+ {
+ return false;
+ }
+
+ if(!this->Makefile->IsSet("CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG"))
+ {
+ cmOStringStream w;
+ w << "Attempting to use";
+ if(macosx_rpath)
+ {
+ w << " MACOSX_RPATH";
+ }
+ else
+ {
+ w << " @rpath";
+ }
+ w << " without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being set.";
+ w << " This could be because you are using a Mac OS X version";
+ w << " less than 10.5 or because CMake's platform configuration is";
+ w << " corrupt.";
+ cmake* cm = this->Makefile->GetCMakeInstance();
+ cm->IssueMessage(cmake::FATAL_ERROR, w.str(),
+ this->Target->GetBacktrace());
+ }
+
+ return true;
+}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::MacOSXRpathInstallNameDirDefault() const
+{
+ // we can't do rpaths when unsupported
+ if(!this->Makefile->IsSet("CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG"))
+ {
+ return false;
+ }
+
+ const char* macosx_rpath_str = this->GetProperty("MACOSX_RPATH");
+ if(macosx_rpath_str)
+ {
+ return this->GetPropertyAsBool("MACOSX_RPATH");
+ }
+
+ cmPolicies::PolicyStatus cmp0042 = this->Target->GetPolicyStatusCMP0042();
+
+ if(cmp0042 == cmPolicies::WARN)
+ {
+ this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
+ AddCMP0042WarnTarget(this->GetName());
+ }
+
+ if(cmp0042 == cmPolicies::NEW)
+ {
+ return true;
+ }
+
+ return false;
+}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index df82891..b1b42dd 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -175,6 +175,12 @@ public:
cmMakefile* GetMakefile() const;
+ /** Whether this library has \@rpath and platform supports it. */
+ bool HasMacOSXRpathInstallNameDir(const char* config) const;
+
+ /** Whether this library defaults to \@rpath. */
+ bool MacOSXRpathInstallNameDirDefault() const;
+
void GetAppleArchs(const char* config,
std::vector<std::string>& archVec) const;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index c171739..3ce81a4 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2416,118 +2416,6 @@ const char* cmTarget::GetPrefixVariableInternal(bool implib) const
}
//----------------------------------------------------------------------------
-bool cmTarget::HasMacOSXRpathInstallNameDir(const char* config) const
-{
- bool install_name_is_rpath = false;
- bool macosx_rpath = false;
-
- if(!this->IsImportedTarget)
- {
- if(this->GetType() != cmTarget::SHARED_LIBRARY)
- {
- return false;
- }
- const char* install_name = this->GetProperty("INSTALL_NAME_DIR");
- bool use_install_name =
- this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH");
- if(install_name && use_install_name &&
- std::string(install_name) == "@rpath")
- {
- install_name_is_rpath = true;
- }
- else if(install_name && use_install_name)
- {
- return false;
- }
- if(!install_name_is_rpath)
- {
- macosx_rpath = this->MacOSXRpathInstallNameDirDefault();
- }
- }
- else
- {
- // Lookup the imported soname.
- if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, this))
- {
- if(!info->NoSOName && !info->SOName.empty())
- {
- if(info->SOName.find("@rpath/") == 0)
- {
- install_name_is_rpath = true;
- }
- }
- else
- {
- std::string install_name;
- cmSystemTools::GuessLibraryInstallName(info->Location, install_name);
- if(install_name.find("@rpath") != std::string::npos)
- {
- install_name_is_rpath = true;
- }
- }
- }
- }
-
- if(!install_name_is_rpath && !macosx_rpath)
- {
- return false;
- }
-
- if(!this->Makefile->IsSet("CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG"))
- {
- cmOStringStream w;
- w << "Attempting to use";
- if(macosx_rpath)
- {
- w << " MACOSX_RPATH";
- }
- else
- {
- w << " @rpath";
- }
- w << " without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being set.";
- w << " This could be because you are using a Mac OS X version";
- w << " less than 10.5 or because CMake's platform configuration is";
- w << " corrupt.";
- cmake* cm = this->Makefile->GetCMakeInstance();
- cm->IssueMessage(cmake::FATAL_ERROR, w.str(), this->GetBacktrace());
- }
-
- return true;
-}
-
-//----------------------------------------------------------------------------
-bool cmTarget::MacOSXRpathInstallNameDirDefault() const
-{
- // we can't do rpaths when unsupported
- if(!this->Makefile->IsSet("CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG"))
- {
- return false;
- }
-
- const char* macosx_rpath_str = this->GetProperty("MACOSX_RPATH");
- if(macosx_rpath_str)
- {
- return this->GetPropertyAsBool("MACOSX_RPATH");
- }
-
- cmPolicies::PolicyStatus cmp0042 = this->GetPolicyStatusCMP0042();
-
- if(cmp0042 == cmPolicies::WARN)
- {
- this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
- AddCMP0042WarnTarget(this->GetName());
- }
-
- if(cmp0042 == cmPolicies::NEW)
- {
- return true;
- }
-
- return false;
-}
-
-//----------------------------------------------------------------------------
bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) const
{
if(this->IsImported() && this->GetType() == cmTarget::SHARED_LIBRARY)
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 1df0f0f..48bead1 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -284,12 +284,6 @@ public:
*/
bool FindSourceFiles();
- /** Whether this library has \@rpath and platform supports it. */
- bool HasMacOSXRpathInstallNameDir(const char* config) const;
-
- /** Whether this library defaults to \@rpath. */
- bool MacOSXRpathInstallNameDirDefault() const;
-
/** Test for special case of a third-party shared library that has
no soname at all. */
bool IsImportedSharedLibWithoutSOName(const char* config) const;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=645e609b9a9d1491d0e48c61efb5285977be8aa4
commit 645e609b9a9d1491d0e48c61efb5285977be8aa4
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 9 01:56:54 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:08 2014 +0100
Move GetLinkImplementation to cmGeneratorTarget.
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 2c0328c..cc34132 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -547,9 +547,12 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index,
//----------------------------------------------------------------------------
void cmComputeLinkDepends::AddDirectLinkEntries()
{
+ cmGeneratorTarget *gtgt = this->Target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(this->Target);
// Add direct link dependencies in this configuration.
- cmTarget::LinkImplementation const* impl =
- this->Target->GetLinkImplementation(this->Config, this->HeadTarget);
+ cmGeneratorTarget::LinkImplementation const* impl =
+ gtgt->GetLinkImplementation(this->Config, this->HeadTarget);
this->AddLinkEntries(-1, impl->Libraries);
for(std::vector<std::string>::const_iterator
wi = impl->WrongConfigLibraries.begin();
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 8384045..5654b41 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -1093,7 +1093,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
else if (std::find_if(transBegin, transEnd,
cmStrCmp(interfacePropertyName)) != transEnd)
{
- const cmTarget::LinkImplementation *impl = target->GetLinkImplementation(
+ const cmGeneratorTarget::LinkImplementation *impl =
+ gtgt->GetLinkImplementation(
context->Config,
headTarget);
if(impl)
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 27ec2bf..d903997 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -119,6 +119,13 @@ const char *cmGeneratorTarget::GetProperty(const char *prop) const
return this->Target->GetProperty(prop);
}
+void cmGeneratorTarget::GetDirectLinkLibraries(const char *config,
+ std::vector<std::string> &libs,
+ cmTarget *head) const
+{
+ this->Target->GetDirectLinkLibraries(config, libs, head);
+}
+
//----------------------------------------------------------------------------
std::vector<cmSourceFile*> const*
cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf) const
@@ -320,8 +327,8 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
if (iter == this->SystemIncludesCache.end())
{
- cmTarget::LinkImplementation const* impl
- = this->Target->GetLinkImplementation(config, this->Target);
+ LinkImplementation const* impl
+ = this->GetLinkImplementation(config, this->Target);
if(!impl)
{
return false;
@@ -840,13 +847,182 @@ public:
};
//----------------------------------------------------------------------------
+cmGeneratorTarget::LinkImplementation const*
+cmGeneratorTarget::GetLinkImplementation(const char* config,
+ cmTarget const* head) const
+{
+ // There is no link implementation for imported targets.
+ if(this->Target->IsImported())
+ {
+ return 0;
+ }
+
+ // Lookup any existing link implementation for this configuration.
+ std::string key = cmSystemTools::UpperCase(config? config : "");
+
+ LinkImplMapType::iterator i = this->LinkImplMap.find(key);
+ if(i == this->LinkImplMap.end())
+ {
+ // Compute the link implementation for this configuration.
+ LinkImplementation impl;
+ this->ComputeLinkImplementation(config, impl, head);
+
+ // Store the information for this configuration.
+ LinkImplMapType::value_type entry(key, impl);
+ i = this->LinkImplMap.insert(entry).first;
+ }
+
+ return &i->second;
+}
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::ComputeLinkImplementation(const char* config,
+ LinkImplementation& impl,
+ cmTarget const* head) const
+{
+ // Compute which library configuration to link.
+ cmTarget::LinkLibraryType linkType = this->Target->ComputeLinkType(config);
+
+ // Collect libraries directly linked in this configuration.
+ std::vector<std::string> llibs;
+ this->Target->GetDirectLinkLibraries(config, llibs, head);
+ for(std::vector<std::string>::const_iterator li = llibs.begin();
+ li != llibs.end(); ++li)
+ {
+ // Skip entries that resolve to the target itself or are empty.
+ std::string item = this->Target->CheckCMP0004(*li);
+ if(item == this->GetName() || item.empty())
+ {
+ if(item == this->GetName())
+ {
+ bool noMessage = false;
+ cmake::MessageType messageType = cmake::FATAL_ERROR;
+ cmOStringStream e;
+ switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0038))
+ {
+ case cmPolicies::WARN:
+ {
+ e << (this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0038)) << "\n";
+ messageType = cmake::AUTHOR_WARNING;
+ }
+ break;
+ case cmPolicies::OLD:
+ noMessage = true;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ // Issue the fatal message.
+ break;
+ }
+
+ if(!noMessage)
+ {
+ e << "Target \"" << this->GetName() << "\" links to itself.";
+ this->Makefile->GetCMakeInstance()->IssueMessage(messageType,
+ e.str(),
+ this->Target->GetBacktrace());
+ if (messageType == cmake::FATAL_ERROR)
+ {
+ return;
+ }
+ }
+ }
+ continue;
+ }
+ cmTarget *tgt = this->Makefile->FindTargetToUse(li->c_str());
+
+ if(!tgt && std::string(item).find("::") != std::string::npos)
+ {
+ bool noMessage = false;
+ cmake::MessageType messageType = cmake::FATAL_ERROR;
+ cmOStringStream e;
+ switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0028))
+ {
+ case cmPolicies::WARN:
+ {
+ e << (this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0028)) << "\n";
+ messageType = cmake::AUTHOR_WARNING;
+ }
+ break;
+ case cmPolicies::OLD:
+ noMessage = true;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ // Issue the fatal message.
+ break;
+ }
+
+ if(!noMessage)
+ {
+ e << "Target \"" << this->GetName() << "\" links to target \"" << item
+ << "\" but the target was not found. Perhaps a find_package() "
+ "call is missing for an IMPORTED target, or an ALIAS target is "
+ "missing?";
+ this->Makefile->GetCMakeInstance()->IssueMessage(messageType,
+ e.str(),
+ this->Target->GetBacktrace());
+ if (messageType == cmake::FATAL_ERROR)
+ {
+ return;
+ }
+ }
+ }
+ // The entry is meant for this configuration.
+ impl.Libraries.push_back(item);
+ }
+
+ cmTarget::LinkLibraryVectorType const& oldllibs =
+ this->Target->GetOriginalLinkLibraries();
+ for(cmTarget::LinkLibraryVectorType::const_iterator li = oldllibs.begin();
+ li != oldllibs.end(); ++li)
+ {
+ if(li->second != cmTarget::GENERAL && li->second != linkType)
+ {
+ std::string item = this->Target->CheckCMP0004(li->first);
+ if(item == this->GetName() || item.empty())
+ {
+ continue;
+ }
+ // Support OLD behavior for CMP0003.
+ impl.WrongConfigLibraries.push_back(item);
+ }
+ }
+
+ // This target needs runtime libraries for its source languages.
+ std::set<cmStdString> languages;
+ // Get languages used in our source files.
+ this->Target->GetLanguages(languages);
+ // Get languages used in object library sources.
+ for(std::vector<std::string>::const_iterator
+ i = this->Target->GetObjectLibraries().begin();
+ i != this->Target->GetObjectLibraries().end(); ++i)
+ {
+ if(cmTarget* objLib = this->Makefile->FindTargetToUse(i->c_str()))
+ {
+ if(objLib->GetType() == cmTarget::OBJECT_LIBRARY)
+ {
+ objLib->GetLanguages(languages);
+ }
+ }
+ }
+ // Copy the set of langauges to the link implementation.
+ for(std::set<cmStdString>::iterator li = languages.begin();
+ li != languages.end(); ++li)
+ {
+ impl.Languages.push_back(*li);
+ }
+}
+
+//----------------------------------------------------------------------------
void cmGeneratorTarget::ComputeLinkClosure(const char* config, LinkClosure& lc,
cmTarget const* head) const
{
// Get languages built in this target.
std::set<cmStdString> languages;
- cmTarget::LinkImplementation const* impl =
- this->Target->GetLinkImplementation(config, head);
+ LinkImplementation const* impl = this->GetLinkImplementation(config, head);
for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
li != impl->Languages.end(); ++li)
{
@@ -2621,8 +2797,8 @@ cmGeneratorTarget::GetIncludeDirectories(const char *config) const
if(this->Makefile->IsOn("APPLE"))
{
- cmTarget::LinkImplementation const* impl =
- this->Target->GetLinkImplementation(config, this->Target);
+ LinkImplementation const* impl =
+ this->GetLinkImplementation(config, this->Target);
for(std::vector<std::string>::const_iterator
it = impl->Libraries.begin();
it != impl->Libraries.end(); ++it)
@@ -3129,8 +3305,8 @@ bool cmGeneratorTarget::ComputeLinkInterface(const char* config,
}
if (this->GetType() != cmTarget::INTERFACE_LIBRARY)
{
- cmTarget::LinkImplementation const* impl =
- this->Target->GetLinkImplementation(config, headTarget);
+ LinkImplementation const* impl =
+ this->GetLinkImplementation(config, headTarget);
for(std::vector<std::string>::const_iterator
li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li)
{
@@ -3169,8 +3345,8 @@ bool cmGeneratorTarget::ComputeLinkInterface(const char* config,
// to the link implementation.
{
// The link implementation is the default link interface.
- cmTarget::LinkImplementation const* impl =
- this->Target->GetLinkImplementation(config, headTarget);
+ LinkImplementation const* impl =
+ this->GetLinkImplementation(config, headTarget);
iface.ImplementationIsInterface = true;
iface.Libraries = impl->Libraries;
iface.WrongConfigLibraries = impl->WrongConfigLibraries;
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index e871bdd..df82891 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -185,6 +185,10 @@ public:
/** Get the include directories for this target. */
std::vector<std::string> GetIncludeDirectories(const char *config) const;
+ void GetDirectLinkLibraries(const char *config,
+ std::vector<std::string> &libs,
+ cmTarget *head) const;
+
bool IsSystemIncludeDirectory(const char *dir, const char *config) const;
/** Add the target output files to the global generator manifest. */
@@ -298,6 +302,25 @@ public:
const char* GetLinkerLanguage(const char* config = 0,
cmTarget const* head = 0) const;
+ /** The link implementation specifies the direct library
+ dependencies needed by the object files of the target. */
+ struct LinkImplementation
+ {
+ // Languages whose runtime libraries must be linked.
+ std::vector<std::string> Languages;
+
+ // Libraries linked directly in this configuration.
+ std::vector<std::string> Libraries;
+
+ // Libraries linked directly in other configurations.
+ // Needed only for OLD behavior of CMP0003.
+ std::vector<std::string> WrongConfigLibraries;
+ };
+ typedef std::map<cmStdString, LinkImplementation> LinkImplMapType;
+
+ LinkImplementation const* GetLinkImplementation(const char* config,
+ cmTarget const* head) const;
+
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
@@ -322,11 +345,16 @@ private:
mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
mutable LinkInterfaceMapType LinkInterfaceMap;
mutable bool PolicyWarnedCMP0022;
+ mutable LinkImplMapType LinkImplMap;
std::string GetFullNameInternal(const char* config, bool implib) const;
void GetFullNameInternal(const char* config, bool implib,
std::string& outPrefix, std::string& outBase,
std::string& outSuffix) const;
+ void ComputeLinkImplementation(const char* config,
+ LinkImplementation& impl,
+ cmTarget const* head) const;
+
typedef std::map<TargetConfigPair, LinkClosure> LinkClosureMapType;
mutable LinkClosureMapType LinkClosureMap;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index d74c84e..26e5c2a 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1241,8 +1241,8 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
if(!llang) { return; }
// If the language is compiled as a source trust Xcode to link with it.
- cmTarget::LinkImplementation const* impl =
- cmtarget.GetLinkImplementation("NOCONFIG", &cmtarget);
+ cmGeneratorTarget::LinkImplementation const* impl =
+ gtgt->GetLinkImplementation("NOCONFIG", &cmtarget);
for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
li != impl->Languages.end(); ++li)
{
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index c178481..c171739 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -87,11 +87,6 @@ public:
ImportInfoMapType;
ImportInfoMapType ImportInfoMap;
- // Cache link implementation computation from each configuration.
- typedef std::map<TargetConfigPair,
- cmTarget::LinkImplementation> LinkImplMapType;
- LinkImplMapType LinkImplMap;
-
typedef cmGeneratorTarget::TargetPropertyEntry TargetPropertyEntry;
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
@@ -386,7 +381,6 @@ void cmTarget::FinishConfigure()
//----------------------------------------------------------------------------
void cmTarget::ClearLinkMaps()
{
- this->Internal->LinkImplMap.clear();
}
//----------------------------------------------------------------------------
@@ -3318,174 +3312,6 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
}
//----------------------------------------------------------------------------
-cmTarget::LinkImplementation const*
-cmTarget::GetLinkImplementation(const char* config, cmTarget const* head) const
-{
- // There is no link implementation for imported targets.
- if(this->IsImported())
- {
- return 0;
- }
-
- // Lookup any existing link implementation for this configuration.
- TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : ""));
-
- cmTargetInternals::LinkImplMapType::iterator
- i = this->Internal->LinkImplMap.find(key);
- if(i == this->Internal->LinkImplMap.end())
- {
- // Compute the link implementation for this configuration.
- LinkImplementation impl;
- this->ComputeLinkImplementation(config, impl, head);
-
- // Store the information for this configuration.
- cmTargetInternals::LinkImplMapType::value_type entry(key, impl);
- i = this->Internal->LinkImplMap.insert(entry).first;
- }
-
- return &i->second;
-}
-
-//----------------------------------------------------------------------------
-void cmTarget::ComputeLinkImplementation(const char* config,
- LinkImplementation& impl,
- cmTarget const* head) const
-{
- // Collect libraries directly linked in this configuration.
- std::vector<std::string> llibs;
- this->GetDirectLinkLibraries(config, llibs, head);
- for(std::vector<std::string>::const_iterator li = llibs.begin();
- li != llibs.end(); ++li)
- {
- // Skip entries that resolve to the target itself or are empty.
- std::string item = this->CheckCMP0004(*li);
- if(item == this->GetName() || item.empty())
- {
- if(item == this->GetName())
- {
- bool noMessage = false;
- cmake::MessageType messageType = cmake::FATAL_ERROR;
- cmOStringStream e;
- switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0038))
- {
- case cmPolicies::WARN:
- {
- e << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0038)) << "\n";
- messageType = cmake::AUTHOR_WARNING;
- }
- break;
- case cmPolicies::OLD:
- noMessage = true;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- // Issue the fatal message.
- break;
- }
-
- if(!noMessage)
- {
- e << "Target \"" << this->GetName() << "\" links to itself.";
- this->Makefile->GetCMakeInstance()->IssueMessage(messageType,
- e.str(),
- this->GetBacktrace());
- if (messageType == cmake::FATAL_ERROR)
- {
- return;
- }
- }
- }
- continue;
- }
- cmTarget *tgt = this->Makefile->FindTargetToUse(li->c_str());
-
- if(!tgt && std::string(item).find("::") != std::string::npos)
- {
- bool noMessage = false;
- cmake::MessageType messageType = cmake::FATAL_ERROR;
- cmOStringStream e;
- switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0028))
- {
- case cmPolicies::WARN:
- {
- e << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0028)) << "\n";
- messageType = cmake::AUTHOR_WARNING;
- }
- break;
- case cmPolicies::OLD:
- noMessage = true;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- // Issue the fatal message.
- break;
- }
-
- if(!noMessage)
- {
- e << "Target \"" << this->GetName() << "\" links to target \"" << item
- << "\" but the target was not found. Perhaps a find_package() "
- "call is missing for an IMPORTED target, or an ALIAS target is "
- "missing?";
- this->Makefile->GetCMakeInstance()->IssueMessage(messageType,
- e.str(),
- this->GetBacktrace());
- if (messageType == cmake::FATAL_ERROR)
- {
- return;
- }
- }
- }
-
- // The entry is meant for this configuration.
- impl.Libraries.push_back(item);
- }
-
- cmTarget::LinkLibraryType linkType = this->ComputeLinkType(config);
- LinkLibraryVectorType const& oldllibs = this->GetOriginalLinkLibraries();
- for(cmTarget::LinkLibraryVectorType::const_iterator li = oldllibs.begin();
- li != oldllibs.end(); ++li)
- {
- if(li->second != cmTarget::GENERAL && li->second != linkType)
- {
- std::string item = this->CheckCMP0004(li->first);
- if(item == this->GetName() || item.empty())
- {
- continue;
- }
- // Support OLD behavior for CMP0003.
- impl.WrongConfigLibraries.push_back(item);
- }
- }
-
- // This target needs runtime libraries for its source languages.
- std::set<cmStdString> languages;
- // Get languages used in our source files.
- this->GetLanguages(languages);
- // Get languages used in object library sources.
- for(std::vector<std::string>::const_iterator
- i = this->ObjectLibraries.begin();
- i != this->ObjectLibraries.end(); ++i)
- {
- if(cmTarget* objLib = this->Makefile->FindTargetToUse(i->c_str()))
- {
- if(objLib->GetType() == cmTarget::OBJECT_LIBRARY)
- {
- objLib->GetLanguages(languages);
- }
- }
- }
- // Copy the set of langauges to the link implementation.
- for(std::set<cmStdString>::iterator li = languages.begin();
- li != languages.end(); ++li)
- {
- impl.Languages.push_back(*li);
- }
-}
-
-//----------------------------------------------------------------------------
std::string cmTarget::CheckCMP0004(std::string const& item) const
{
// Strip whitespace off the library names because we used to do this
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 648db6e..1df0f0f 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -250,23 +250,6 @@ public:
bool IsImported() const {return this->IsImportedTarget;}
- /** The link implementation specifies the direct library
- dependencies needed by the object files of the target. */
- struct LinkImplementation
- {
- // Languages whose runtime libraries must be linked.
- std::vector<std::string> Languages;
-
- // Libraries linked directly in this configuration.
- std::vector<std::string> Libraries;
-
- // Libraries linked directly in other configurations.
- // Needed only for OLD behavior of CMP0003.
- std::vector<std::string> WrongConfigLibraries;
- };
- LinkImplementation const* GetLinkImplementation(const char* config,
- cmTarget const* head) const;
-
/** Strip off leading and trailing whitespace from an item named in
the link dependencies of this target. */
std::string CheckCMP0004(std::string const& item) const;
@@ -549,10 +532,6 @@ private:
void ComputeImportInfo(std::string const& desired_config, ImportInfo& info,
cmTarget const* head) const;
- void ComputeLinkImplementation(const char* config,
- LinkImplementation& impl,
- cmTarget const* head) const;
-
void ClearLinkMaps();
void MaybeInvalidatePropertyCache(const char* prop);
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=411082b879ed82dfbe581bd44ec3201424819699
commit 411082b879ed82dfbe581bd44ec3201424819699
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Oct 8 20:31:37 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:07 2014 +0100
Move GetLinkInterface to cmGeneratorTarget.
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 1be5980..2c0328c 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -353,8 +353,11 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
if(entry.Target)
{
// Follow the target dependencies.
- if(cmTarget::LinkInterface const* iface =
- entry.Target->GetLinkInterface(this->Config, this->HeadTarget))
+ cmGeneratorTarget *gtgt = entry.Target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(entry.Target);
+ if(cmGeneratorTarget::LinkInterface const* iface =
+ gtgt->GetLinkInterface(this->Config, this->HeadTarget))
{
const bool isIface =
entry.Target->GetType() == cmTarget::INTERFACE_LIBRARY;
@@ -388,7 +391,8 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
//----------------------------------------------------------------------------
void
cmComputeLinkDepends
-::FollowSharedDeps(int depender_index, cmTarget::LinkInterface const* iface,
+::FollowSharedDeps(int depender_index,
+ cmGeneratorTarget::LinkInterface const* iface,
bool follow_interface)
{
// Follow dependencies if we have not followed them already.
@@ -452,8 +456,11 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
// Target items may have their own dependencies.
if(entry.Target)
{
- if(cmTarget::LinkInterface const* iface =
- entry.Target->GetLinkInterface(this->Config, this->HeadTarget))
+ cmGeneratorTarget *gtgt = entry.Target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(entry.Target);
+ if(cmGeneratorTarget::LinkInterface const* iface =
+ gtgt->GetLinkInterface(this->Config, this->HeadTarget))
{
// Follow public and private dependencies transitively.
this->FollowSharedDeps(index, iface, true);
@@ -952,8 +959,11 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl)
{
if(cmTarget const* target = this->EntryList[*ni].Target)
{
- if(cmTarget::LinkInterface const* iface =
- target->GetLinkInterface(this->Config, this->HeadTarget))
+ cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
+ if(cmGeneratorTarget::LinkInterface const* iface =
+ gtgt->GetLinkInterface(this->Config, this->HeadTarget))
{
if(iface->Multiplicity > count)
{
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index cf227fb..bf0b55c 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -109,7 +109,7 @@ private:
std::queue<SharedDepEntry> SharedDepQueue;
std::set<int> SharedDepFollowed;
void FollowSharedDeps(int depender_index,
- cmTarget::LinkInterface const* iface,
+ cmGeneratorTarget::LinkInterface const* iface,
bool follow_interface = false);
void QueueSharedDependencies(int depender_index,
std::vector<std::string> const& deps);
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 73a8e27..74b13e4 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -278,8 +278,12 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
std::set<cmStdString> &emitted)
{
cmTarget const* depender = this->Targets[depender_index];
- if(cmTarget::LinkInterface const* iface =
- dependee->GetLinkInterface(config, depender))
+ cmGeneratorTarget *gtgt = depender->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(dependee);
+
+ if(cmGeneratorTarget::LinkInterface const* iface =
+ gtgt->GetLinkInterface(config, depender))
{
for(std::vector<std::string>::const_iterator
lib = iface->Libraries.begin();
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 4ece383..3cc56d7 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -694,7 +694,7 @@ cmExportFileGenerator
std::vector<std::string>& missingTargets)
{
// Add the transitive link dependencies for this configuration.
- cmTarget::LinkInterface const* iface = target->Target->GetLinkInterface(
+ cmGeneratorTarget::LinkInterface const* iface = target->GetLinkInterface(
config,
target->Target);
if (!iface)
@@ -806,9 +806,8 @@ cmExportFileGenerator
}
// Add the transitive link dependencies for this configuration.
- if(cmTarget::LinkInterface const* iface =
- target->Target
- ->GetLinkInterface(config, target->Target))
+ if(cmGeneratorTarget::LinkInterface const* iface =
+ target->GetLinkInterface(config, target->Target))
{
this->SetImportLinkProperty(suffix, target,
"IMPORTED_LINK_INTERFACE_LANGUAGES",
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index c38fc11..8384045 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -1079,7 +1079,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
{
std::vector<std::string> libs;
- target->GetTransitivePropertyLinkLibraries(context->Config,
+ gtgt->GetTransitivePropertyLinkLibraries(context->Config,
headTarget, libs);
if (!libs.empty())
{
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 57bb597..27ec2bf 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -58,7 +58,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
this->DebugIncludesDone = false;
-
+ this->PolicyWarnedCMP0022 = false;
}
//----------------------------------------------------------------------------
@@ -353,9 +353,10 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
{
if (uniqueDeps.insert(*li).second)
{
- cmTarget* tgt = this->Makefile->FindTargetToUse(li->c_str());
+ cmGeneratorTarget* gtgt
+ = this->Makefile->FindGeneratorTargetToUse(li->c_str());
- if (!tgt)
+ if (!gtgt)
{
continue;
}
@@ -364,7 +365,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
&dagChecker, result, excludeImported);
std::vector<std::string> deps;
- tgt->GetTransitivePropertyLinkLibraries(config, this->Target, deps);
+ gtgt->GetTransitivePropertyLinkLibraries(config, this->Target, deps);
for(std::vector<std::string>::const_iterator di = deps.begin();
di != deps.end(); ++di)
@@ -742,8 +743,8 @@ public:
return;
}
- cmTarget::LinkInterface const* iface =
- target->Target->GetLinkInterface(this->Config, this->HeadTarget);
+ cmGeneratorTarget::LinkInterface const* iface =
+ target->GetLinkInterface(this->Config, this->HeadTarget);
if(!iface) { return; }
for(std::vector<std::string>::const_iterator
@@ -1123,6 +1124,47 @@ cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs) const
}
//----------------------------------------------------------------------------
+void cmGeneratorTarget::GetTransitivePropertyLinkLibraries(
+ const char* config,
+ cmTarget const *headTarget,
+ std::vector<std::string> &libs) const
+{
+ LinkInterface const* iface = this->GetLinkInterface(config, headTarget);
+ if (!iface)
+ {
+ return;
+ }
+ if(this->GetType() != cmTarget::STATIC_LIBRARY
+ || this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN
+ || this->Target->GetPolicyStatusCMP0022() == cmPolicies::OLD)
+ {
+ libs = iface->Libraries;
+ return;
+ }
+
+ const char* linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
+ const char* interfaceLibs = this->GetProperty(linkIfaceProp);
+
+ if (!interfaceLibs)
+ {
+ return;
+ }
+
+ // The interface libraries have been explicitly set.
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(),
+ linkIfaceProp, 0, 0);
+ dagChecker.SetTransitivePropertiesOnly();
+ cmSystemTools::ExpandListArgument(ge.Parse(interfaceLibs)->Evaluate(
+ this->Makefile,
+ config,
+ false,
+ headTarget,
+ this->Target, &dagChecker), libs);
+}
+
+//----------------------------------------------------------------------------
template<typename PropertyType>
PropertyType getTypedProperty(cmTarget const* tgt, const char *prop,
PropertyType *);
@@ -2934,6 +2976,297 @@ void cmGeneratorTarget::GetExecutableNames(std::string& name,
}
//----------------------------------------------------------------------------
+cmGeneratorTarget::LinkInterface const*
+cmGeneratorTarget::GetLinkInterface(const char* config,
+ cmTarget const* head) const
+{
+ // Imported targets have their own link interface.
+ if(this->Target->IsImported())
+ {
+ if(cmTarget::ImportInfo const* info = this->Target->GetImportInfo(config,
+ head))
+ {
+ return &info->LinkInterface;
+ }
+ return 0;
+ }
+
+ // Link interfaces are not supported for executables that do not
+ // export symbols.
+ if(this->GetType() == cmTarget::EXECUTABLE &&
+ !this->Target->IsExecutableWithExports())
+ {
+ return 0;
+ }
+
+ // Lookup any existing link interface for this configuration.
+ TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : ""));
+ LinkInterfaceMapType::iterator
+ i = this->LinkInterfaceMap.find(key);
+ if(i == this->LinkInterfaceMap.end())
+ {
+ // Compute the link interface for this configuration.
+ OptionalLinkInterface iface;
+ iface.Exists = this->ComputeLinkInterface(config, iface, head);
+
+ // Store the information for this configuration.
+ LinkInterfaceMapType::value_type entry(key, iface);
+ i = this->LinkInterfaceMap.insert(entry).first;
+ }
+
+ return i->second.Exists? &i->second : 0;
+}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::ComputeLinkInterface(const char* config,
+ LinkInterface& iface,
+ cmTarget const *headTarget) const
+{
+ // Construct the property name suffix for this configuration.
+ std::string suffix = "_";
+ if(config && *config)
+ {
+ suffix += cmSystemTools::UpperCase(config);
+ }
+ else
+ {
+ suffix += "NOCONFIG";
+ }
+
+ // An explicit list of interface libraries may be set for shared
+ // libraries and executables that export symbols.
+ const char* explicitLibraries = 0;
+ std::string linkIfaceProp;
+ if(this->Target->PolicyStatusCMP0022 != cmPolicies::OLD &&
+ this->Target->PolicyStatusCMP0022 != cmPolicies::WARN)
+ {
+ // CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES.
+ linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
+ explicitLibraries = this->GetProperty(linkIfaceProp.c_str());
+ }
+ else if(this->GetType() == cmTarget::SHARED_LIBRARY ||
+ this->Target->IsExecutableWithExports())
+ {
+ // CMP0022 OLD behavior is to use LINK_INTERFACE_LIBRARIES if set on a
+ // shared lib or executable.
+
+ // Lookup the per-configuration property.
+ linkIfaceProp = "LINK_INTERFACE_LIBRARIES";
+ linkIfaceProp += suffix;
+ explicitLibraries = this->GetProperty(linkIfaceProp.c_str());
+
+ // If not set, try the generic property.
+ if(!explicitLibraries)
+ {
+ linkIfaceProp = "LINK_INTERFACE_LIBRARIES";
+ explicitLibraries = this->GetProperty(linkIfaceProp.c_str());
+ }
+ }
+
+ if(explicitLibraries
+ && this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN
+ && !this->PolicyWarnedCMP0022)
+ {
+ // Compare the explicitly set old link interface properties to the
+ // preferred new link interface property one and warn if different.
+ const char* newExplicitLibraries =
+ this->GetProperty("INTERFACE_LINK_LIBRARIES");
+ if (newExplicitLibraries
+ && strcmp(newExplicitLibraries, explicitLibraries) != 0)
+ {
+ cmOStringStream w;
+ w <<
+ (this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n"
+ "Target \"" << this->GetName() << "\" has an "
+ "INTERFACE_LINK_LIBRARIES property which differs from its " <<
+ linkIfaceProp << " properties."
+ "\n"
+ "INTERFACE_LINK_LIBRARIES:\n"
+ " " << newExplicitLibraries << "\n" <<
+ linkIfaceProp << ":\n"
+ " " << (explicitLibraries ? explicitLibraries : "(empty)") << "\n";
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ this->PolicyWarnedCMP0022 = true;
+ }
+ }
+
+ // There is no implicit link interface for executables or modules
+ // so if none was explicitly set then there is no link interface.
+ if(!explicitLibraries &&
+ (this->GetType() == cmTarget::EXECUTABLE ||
+ (this->GetType() == cmTarget::MODULE_LIBRARY)))
+ {
+ return false;
+ }
+
+ if(explicitLibraries)
+ {
+ // The interface libraries have been explicitly set.
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(),
+ linkIfaceProp, 0, 0);
+ cmSystemTools::ExpandListArgument(ge.Parse(explicitLibraries)->Evaluate(
+ this->Makefile,
+ config,
+ false,
+ headTarget,
+ this->Target, &dagChecker),
+ iface.Libraries);
+
+ if(this->GetType() == cmTarget::SHARED_LIBRARY
+ || this->GetType() == cmTarget::STATIC_LIBRARY
+ || this->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ // Shared libraries may have runtime implementation dependencies
+ // on other shared libraries that are not in the interface.
+ std::set<cmStdString> emitted;
+ for(std::vector<std::string>::const_iterator
+ li = iface.Libraries.begin(); li != iface.Libraries.end(); ++li)
+ {
+ emitted.insert(*li);
+ }
+ if (this->GetType() != cmTarget::INTERFACE_LIBRARY)
+ {
+ cmTarget::LinkImplementation const* impl =
+ this->Target->GetLinkImplementation(config, headTarget);
+ for(std::vector<std::string>::const_iterator
+ li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li)
+ {
+ if(emitted.insert(*li).second)
+ {
+ if(cmTarget* tgt = this->Makefile->FindTargetToUse(li->c_str()))
+ {
+ // This is a runtime dependency on another shared library.
+ if(tgt->GetType() == cmTarget::SHARED_LIBRARY)
+ {
+ iface.SharedDeps.push_back(*li);
+ }
+ }
+ else
+ {
+ // TODO: Recognize shared library file names. Perhaps this
+ // should be moved to cmComputeLinkInformation, but that creates
+ // a chicken-and-egg problem since this list is needed for its
+ // construction.
+ }
+ }
+ }
+ if(this->Target->LinkLanguagePropagatesToDependents())
+ {
+ // Targets using this archive need its language runtime libraries.
+ iface.Languages = impl->Languages;
+ }
+ }
+ }
+ }
+ else if (this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN
+ || this->Target->GetPolicyStatusCMP0022() == cmPolicies::OLD)
+ // If CMP0022 is NEW then the plain tll signature sets the
+ // INTERFACE_LINK_LIBRARIES, so if we get here then the project
+ // cleared the property explicitly and we should not fall back
+ // to the link implementation.
+ {
+ // The link implementation is the default link interface.
+ cmTarget::LinkImplementation const* impl =
+ this->Target->GetLinkImplementation(config, headTarget);
+ iface.ImplementationIsInterface = true;
+ iface.Libraries = impl->Libraries;
+ iface.WrongConfigLibraries = impl->WrongConfigLibraries;
+ if(this->Target->LinkLanguagePropagatesToDependents())
+ {
+ // Targets using this archive need its language runtime libraries.
+ iface.Languages = impl->Languages;
+ }
+
+ if(this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
+ !this->PolicyWarnedCMP0022)
+ {
+ // Compare the link implementation fallback link interface to the
+ // preferred new link interface property and warn if different.
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(),
+ "INTERFACE_LINK_LIBRARIES", 0, 0);
+ std::vector<std::string> ifaceLibs;
+ const char* newExplicitLibraries =
+ this->GetProperty("INTERFACE_LINK_LIBRARIES");
+ cmSystemTools::ExpandListArgument(
+ ge.Parse(newExplicitLibraries)->Evaluate(this->Makefile,
+ config,
+ false,
+ headTarget,
+ this->Target, &dagChecker),
+ ifaceLibs);
+ if (ifaceLibs != impl->Libraries)
+ {
+ std::string oldLibraries;
+ std::string newLibraries;
+ const char *sep = "";
+ for(std::vector<std::string>::const_iterator it
+ = impl->Libraries.begin(); it != impl->Libraries.end(); ++it)
+ {
+ oldLibraries += sep;
+ oldLibraries += *it;
+ sep = ";";
+ }
+ sep = "";
+ for(std::vector<std::string>::const_iterator it
+ = ifaceLibs.begin(); it != ifaceLibs.end(); ++it)
+ {
+ newLibraries += sep;
+ newLibraries += *it;
+ sep = ";";
+ }
+ if(oldLibraries.empty())
+ { oldLibraries = "(empty)"; }
+ if(newLibraries.empty())
+ { newLibraries = "(empty)"; }
+
+ cmOStringStream w;
+ w <<
+ (this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n"
+ "Target \"" << this->GetName() << "\" has an "
+ "INTERFACE_LINK_LIBRARIES property. "
+ "This should be preferred as the source of the link interface "
+ "for this library but because CMP0022 is not set CMake is "
+ "ignoring the property and using the link implementation "
+ "as the link interface instead."
+ "\n"
+ "INTERFACE_LINK_LIBRARIES:\n"
+ " " << newLibraries << "\n"
+ "Link implementation:\n"
+ " " << oldLibraries << "\n";
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ this->PolicyWarnedCMP0022 = true;
+ }
+ }
+ }
+
+ if(this->GetType() == cmTarget::STATIC_LIBRARY)
+ {
+ // How many repetitions are needed if this library has cyclic
+ // dependencies?
+ std::string propName = "LINK_INTERFACE_MULTIPLICITY";
+ propName += suffix;
+ if(const char* config_reps = this->GetProperty(propName.c_str()))
+ {
+ sscanf(config_reps, "%u", &iface.Multiplicity);
+ }
+ else if(const char* reps =
+ this->GetProperty("LINK_INTERFACE_MULTIPLICITY"))
+ {
+ sscanf(reps, "%u", &iface.Multiplicity);
+ }
+ }
+
+ return true;
+}
+
+
+//----------------------------------------------------------------------------
std::string
cmGeneratorTarget::GetFullNameInternal(const char* config, bool implib) const
{
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index d4a7ce2..e871bdd 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -196,6 +196,52 @@ public:
*/
void TraceDependencies();
+ /** The link interface specifies transitive library dependencies and
+ other information needed by targets that link to this target. */
+ struct LinkInterface
+ {
+ // Languages whose runtime libraries must be linked.
+ std::vector<std::string> Languages;
+
+ // Libraries listed in the interface.
+ std::vector<std::string> Libraries;
+
+ // Shared library dependencies needed for linking on some platforms.
+ std::vector<std::string> SharedDeps;
+
+ // Number of repetitions of a strongly connected component of two
+ // or more static libraries.
+ int Multiplicity;
+
+ // Libraries listed for other configurations.
+ // Needed only for OLD behavior of CMP0003.
+ std::vector<std::string> WrongConfigLibraries;
+
+ bool ImplementationIsInterface;
+
+ LinkInterface(): Multiplicity(0), ImplementationIsInterface(false) {}
+ };
+
+ // Cache link interface computation from each configuration.
+ struct OptionalLinkInterface: public LinkInterface
+ {
+ OptionalLinkInterface(): Exists(false) {}
+ bool Exists;
+ };
+ typedef std::map<TargetConfigPair, OptionalLinkInterface>
+ LinkInterfaceMapType;
+
+ /** Get the link interface for the given configuration. Returns 0
+ if the target cannot be linked. */
+ LinkInterface const* GetLinkInterface(const char* config,
+ cmTarget const*) const;
+ void GetTransitivePropertyLinkLibraries(const char* config,
+ cmTarget const *headTarget,
+ std::vector<std::string> &libs) const;
+
+ bool ComputeLinkInterface(const char* config, LinkInterface& iface,
+ cmTarget const*headTarget) const;
+
void ClassifySources();
void LookupObjectLibraries();
@@ -274,6 +320,8 @@ private:
CachedLinkInterfaceIncludeDirectoriesEntries;
mutable std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
+ mutable LinkInterfaceMapType LinkInterfaceMap;
+ mutable bool PolicyWarnedCMP0022;
std::string GetFullNameInternal(const char* config, bool implib) const;
void GetFullNameInternal(const char* config, bool implib,
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index cf44561..c178481 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -66,12 +66,10 @@ class cmTargetInternals
public:
cmTargetInternals()
{
- this->PolicyWarnedCMP0022 = false;
this->SourceFileFlagsConstructed = false;
}
cmTargetInternals(cmTargetInternals const&)
{
- this->PolicyWarnedCMP0022 = false;
this->SourceFileFlagsConstructed = false;
}
~cmTargetInternals();
@@ -82,17 +80,6 @@ public:
// The backtrace when the target was created.
cmListFileBacktrace Backtrace;
- // Cache link interface computation from each configuration.
- struct OptionalLinkInterface: public cmTarget::LinkInterface
- {
- OptionalLinkInterface(): Exists(false) {}
- bool Exists;
- };
- typedef std::map<TargetConfigPair, OptionalLinkInterface>
- LinkInterfaceMapType;
- LinkInterfaceMapType LinkInterfaceMap;
- bool PolicyWarnedCMP0022;
-
typedef std::map<cmStdString, cmTarget::OutputInfo> OutputInfoMapType;
OutputInfoMapType OutputInfoMap;
@@ -400,7 +387,6 @@ void cmTarget::FinishConfigure()
void cmTarget::ClearLinkMaps()
{
this->Internal->LinkImplMap.clear();
- this->Internal->LinkInterfaceMap.clear();
}
//----------------------------------------------------------------------------
@@ -3332,334 +3318,6 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
}
//----------------------------------------------------------------------------
-cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config,
- cmTarget const* head) const
-{
- // Imported targets have their own link interface.
- if(this->IsImported())
- {
- if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, head))
- {
- return &info->LinkInterface;
- }
- return 0;
- }
-
- // Link interfaces are not supported for executables that do not
- // export symbols.
- if(this->GetType() == cmTarget::EXECUTABLE &&
- !this->IsExecutableWithExports())
- {
- return 0;
- }
-
- // Lookup any existing link interface for this configuration.
- TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : ""));
-
- cmTargetInternals::LinkInterfaceMapType::iterator
- i = this->Internal->LinkInterfaceMap.find(key);
- if(i == this->Internal->LinkInterfaceMap.end())
- {
- // Compute the link interface for this configuration.
- cmTargetInternals::OptionalLinkInterface iface;
- iface.Exists = this->ComputeLinkInterface(config, iface, head);
-
- // Store the information for this configuration.
- cmTargetInternals::LinkInterfaceMapType::value_type entry(key, iface);
- i = this->Internal->LinkInterfaceMap.insert(entry).first;
- }
-
- return i->second.Exists? &i->second : 0;
-}
-
-//----------------------------------------------------------------------------
-void cmTarget::GetTransitivePropertyLinkLibraries(
- const char* config,
- cmTarget const* headTarget,
- std::vector<std::string> &libs) const
-{
- cmTarget::LinkInterface const* iface = this->GetLinkInterface(config,
- headTarget);
- if (!iface)
- {
- return;
- }
- if(this->GetType() != STATIC_LIBRARY
- || this->GetPolicyStatusCMP0022() == cmPolicies::WARN
- || this->GetPolicyStatusCMP0022() == cmPolicies::OLD)
- {
- libs = iface->Libraries;
- return;
- }
-
- const char* linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
- const char* interfaceLibs = this->GetProperty(linkIfaceProp);
-
- if (!interfaceLibs)
- {
- return;
- }
-
- // The interface libraries have been explicitly set.
- cmListFileBacktrace lfbt;
- cmGeneratorExpression ge(lfbt);
- cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(),
- linkIfaceProp, 0, 0);
- dagChecker.SetTransitivePropertiesOnly();
- cmSystemTools::ExpandListArgument(ge.Parse(interfaceLibs)->Evaluate(
- this->Makefile,
- config,
- false,
- headTarget,
- this, &dagChecker), libs);
-}
-
-//----------------------------------------------------------------------------
-bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
- cmTarget const* headTarget) const
-{
- // Construct the property name suffix for this configuration.
- std::string suffix = "_";
- if(config && *config)
- {
- suffix += cmSystemTools::UpperCase(config);
- }
- else
- {
- suffix += "NOCONFIG";
- }
-
- // An explicit list of interface libraries may be set for shared
- // libraries and executables that export symbols.
- const char* explicitLibraries = 0;
- std::string linkIfaceProp;
- if(this->PolicyStatusCMP0022 != cmPolicies::OLD &&
- this->PolicyStatusCMP0022 != cmPolicies::WARN)
- {
- // CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES.
- linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
- explicitLibraries = this->GetProperty(linkIfaceProp.c_str());
- }
- else if(this->GetType() == cmTarget::SHARED_LIBRARY ||
- this->IsExecutableWithExports())
- {
- // CMP0022 OLD behavior is to use LINK_INTERFACE_LIBRARIES if set on a
- // shared lib or executable.
-
- // Lookup the per-configuration property.
- linkIfaceProp = "LINK_INTERFACE_LIBRARIES";
- linkIfaceProp += suffix;
- explicitLibraries = this->GetProperty(linkIfaceProp.c_str());
-
- // If not set, try the generic property.
- if(!explicitLibraries)
- {
- linkIfaceProp = "LINK_INTERFACE_LIBRARIES";
- explicitLibraries = this->GetProperty(linkIfaceProp.c_str());
- }
- }
-
- if(explicitLibraries && this->PolicyStatusCMP0022 == cmPolicies::WARN &&
- !this->Internal->PolicyWarnedCMP0022)
- {
- // Compare the explicitly set old link interface properties to the
- // preferred new link interface property one and warn if different.
- const char* newExplicitLibraries =
- this->GetProperty("INTERFACE_LINK_LIBRARIES");
- if (newExplicitLibraries
- && strcmp(newExplicitLibraries, explicitLibraries) != 0)
- {
- cmOStringStream w;
- w <<
- (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n"
- "Target \"" << this->GetName() << "\" has an "
- "INTERFACE_LINK_LIBRARIES property which differs from its " <<
- linkIfaceProp << " properties."
- "\n"
- "INTERFACE_LINK_LIBRARIES:\n"
- " " << newExplicitLibraries << "\n" <<
- linkIfaceProp << ":\n"
- " " << (explicitLibraries ? explicitLibraries : "(empty)") << "\n";
- this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
- this->Internal->PolicyWarnedCMP0022 = true;
- }
- }
-
- // There is no implicit link interface for executables or modules
- // so if none was explicitly set then there is no link interface.
- if(!explicitLibraries &&
- (this->GetType() == cmTarget::EXECUTABLE ||
- (this->GetType() == cmTarget::MODULE_LIBRARY)))
- {
- return false;
- }
-
- if(explicitLibraries)
- {
- // The interface libraries have been explicitly set.
- cmListFileBacktrace lfbt;
- cmGeneratorExpression ge(lfbt);
- cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(),
- linkIfaceProp, 0, 0);
- cmSystemTools::ExpandListArgument(ge.Parse(explicitLibraries)->Evaluate(
- this->Makefile,
- config,
- false,
- headTarget,
- this, &dagChecker), iface.Libraries);
-
- if(this->GetType() == cmTarget::SHARED_LIBRARY
- || this->GetType() == cmTarget::STATIC_LIBRARY
- || this->GetType() == cmTarget::INTERFACE_LIBRARY)
- {
- // Shared libraries may have runtime implementation dependencies
- // on other shared libraries that are not in the interface.
- std::set<cmStdString> emitted;
- for(std::vector<std::string>::const_iterator
- li = iface.Libraries.begin(); li != iface.Libraries.end(); ++li)
- {
- emitted.insert(*li);
- }
- if (this->GetType() != cmTarget::INTERFACE_LIBRARY)
- {
- LinkImplementation const* impl = this->GetLinkImplementation(config,
- headTarget);
- for(std::vector<std::string>::const_iterator
- li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li)
- {
- if(emitted.insert(*li).second)
- {
- if(cmTarget* tgt = this->Makefile->FindTargetToUse(li->c_str()))
- {
- // This is a runtime dependency on another shared library.
- if(tgt->GetType() == cmTarget::SHARED_LIBRARY)
- {
- iface.SharedDeps.push_back(*li);
- }
- }
- else
- {
- // TODO: Recognize shared library file names. Perhaps this
- // should be moved to cmComputeLinkInformation, but that creates
- // a chicken-and-egg problem since this list is needed for its
- // construction.
- }
- }
- }
- if(this->LinkLanguagePropagatesToDependents())
- {
- // Targets using this archive need its language runtime libraries.
- iface.Languages = impl->Languages;
- }
- }
- }
- }
- else if (this->PolicyStatusCMP0022 == cmPolicies::WARN
- || this->PolicyStatusCMP0022 == cmPolicies::OLD)
- // If CMP0022 is NEW then the plain tll signature sets the
- // INTERFACE_LINK_LIBRARIES, so if we get here then the project
- // cleared the property explicitly and we should not fall back
- // to the link implementation.
- {
- // The link implementation is the default link interface.
- LinkImplementation const* impl = this->GetLinkImplementation(config,
- headTarget);
- iface.ImplementationIsInterface = true;
- iface.Libraries = impl->Libraries;
- iface.WrongConfigLibraries = impl->WrongConfigLibraries;
- if(this->LinkLanguagePropagatesToDependents())
- {
- // Targets using this archive need its language runtime libraries.
- iface.Languages = impl->Languages;
- }
-
- if(this->PolicyStatusCMP0022 == cmPolicies::WARN &&
- !this->Internal->PolicyWarnedCMP0022)
- {
- // Compare the link implementation fallback link interface to the
- // preferred new link interface property and warn if different.
- cmListFileBacktrace lfbt;
- cmGeneratorExpression ge(lfbt);
- cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(),
- "INTERFACE_LINK_LIBRARIES", 0, 0);
- std::vector<std::string> ifaceLibs;
- const char* newExplicitLibraries =
- this->GetProperty("INTERFACE_LINK_LIBRARIES");
- cmSystemTools::ExpandListArgument(
- ge.Parse(newExplicitLibraries)->Evaluate(this->Makefile,
- config,
- false,
- headTarget,
- this, &dagChecker),
- ifaceLibs);
- if (ifaceLibs != impl->Libraries)
- {
- std::string oldLibraries;
- std::string newLibraries;
- const char *sep = "";
- for(std::vector<std::string>::const_iterator it
- = impl->Libraries.begin(); it != impl->Libraries.end(); ++it)
- {
- oldLibraries += sep;
- oldLibraries += *it;
- sep = ";";
- }
- sep = "";
- for(std::vector<std::string>::const_iterator it
- = ifaceLibs.begin(); it != ifaceLibs.end(); ++it)
- {
- newLibraries += sep;
- newLibraries += *it;
- sep = ";";
- }
- if(oldLibraries.empty())
- { oldLibraries = "(empty)"; }
- if(newLibraries.empty())
- { newLibraries = "(empty)"; }
-
- cmOStringStream w;
- w <<
- (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n"
- "Target \"" << this->GetName() << "\" has an "
- "INTERFACE_LINK_LIBRARIES property. "
- "This should be preferred as the source of the link interface "
- "for this library but because CMP0022 is not set CMake is "
- "ignoring the property and using the link implementation "
- "as the link interface instead."
- "\n"
- "INTERFACE_LINK_LIBRARIES:\n"
- " " << newLibraries << "\n"
- "Link implementation:\n"
- " " << oldLibraries << "\n";
- this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
- this->Internal->PolicyWarnedCMP0022 = true;
- }
- }
- }
-
- if(this->GetType() == cmTarget::STATIC_LIBRARY)
- {
- // How many repetitions are needed if this library has cyclic
- // dependencies?
- std::string propName = "LINK_INTERFACE_MULTIPLICITY";
- propName += suffix;
- if(const char* config_reps = this->GetProperty(propName.c_str()))
- {
- sscanf(config_reps, "%u", &iface.Multiplicity);
- }
- else if(const char* reps =
- this->GetProperty("LINK_INTERFACE_MULTIPLICITY"))
- {
- sscanf(reps, "%u", &iface.Multiplicity);
- }
- }
-
- return true;
-}
-
-//----------------------------------------------------------------------------
cmTarget::LinkImplementation const*
cmTarget::GetLinkImplementation(const char* config, cmTarget const* head) const
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 622522d..648db6e 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -250,40 +250,6 @@ public:
bool IsImported() const {return this->IsImportedTarget;}
- /** The link interface specifies transitive library dependencies and
- other information needed by targets that link to this target. */
- struct LinkInterface
- {
- // Languages whose runtime libraries must be linked.
- std::vector<std::string> Languages;
-
- // Libraries listed in the interface.
- std::vector<std::string> Libraries;
-
- // Shared library dependencies needed for linking on some platforms.
- std::vector<std::string> SharedDeps;
-
- // Number of repetitions of a strongly connected component of two
- // or more static libraries.
- int Multiplicity;
-
- // Libraries listed for other configurations.
- // Needed only for OLD behavior of CMP0003.
- std::vector<std::string> WrongConfigLibraries;
-
- bool ImplementationIsInterface;
-
- LinkInterface(): Multiplicity(0), ImplementationIsInterface(false) {}
- };
-
- /** Get the link interface for the given configuration. Returns 0
- if the target cannot be linked. */
- LinkInterface const* GetLinkInterface(const char* config,
- cmTarget const* headTarget) const;
- void GetTransitivePropertyLinkLibraries(const char* config,
- cmTarget const* headTarget,
- std::vector<std::string> &libs) const;
-
/** The link implementation specifies the direct library
dependencies needed by the object files of the target. */
struct LinkImplementation
@@ -576,17 +542,13 @@ private:
std::string Location;
std::string SOName;
std::string ImportLibrary;
- cmTarget::LinkInterface LinkInterface;
+ cmGeneratorTarget::LinkInterface LinkInterface;
};
ImportInfo const* GetImportInfo(const char* config,
cmTarget const* workingTarget) const;
void ComputeImportInfo(std::string const& desired_config, ImportInfo& info,
cmTarget const* head) const;
-
- bool ComputeLinkInterface(const char* config, LinkInterface& iface,
- cmTarget const* head) const;
-
void ComputeLinkImplementation(const char* config,
LinkImplementation& impl,
cmTarget const* head) const;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a7a784530cbf51a24850180fdf4fbaac3d73a657
commit a7a784530cbf51a24850180fdf4fbaac3d73a657
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Oct 10 21:43:28 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:07 2014 +0100
Move GetLinkClosure to cmGeneratorTarget.
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index f28b93c..dd9968f 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -18,6 +18,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmTarget.h"
+#include "cmGeneratorTarget.h"
#include "cmake.h"
#include <ctype.h>
@@ -244,8 +245,10 @@ cmComputeLinkInformation
{
// Store context information.
this->Target = target;
- this->HeadTarget = headTarget;
this->Makefile = this->Target->GetMakefile();
+ this->HeadTarget = this->Makefile->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(headTarget);
this->LocalGenerator = this->Makefile->GetLocalGenerator();
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
@@ -509,7 +512,8 @@ bool cmComputeLinkInformation::Compute()
}
// Compute the ordered link line items.
- cmComputeLinkDepends cld(this->Target, this->Config, this->HeadTarget);
+ cmComputeLinkDepends cld(this->Target, this->Config,
+ this->HeadTarget->Target);
cld.SetOldLinkDirMode(this->OldLinkDirMode);
cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute();
@@ -578,8 +582,13 @@ bool cmComputeLinkInformation::Compute()
void cmComputeLinkInformation::AddImplicitLinkInfo()
{
// The link closure lists all languages whose implicit info is needed.
- cmTarget::LinkClosure const* lc=this->Target->GetLinkClosure(this->Config,
- this->HeadTarget);
+
+ cmGeneratorTarget *gtgt = this->Target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(this->Target);
+
+ cmGeneratorTarget::LinkClosure const* lc = gtgt->GetLinkClosure(this->Config,
+ this->HeadTarget->Target);
for(std::vector<std::string>::const_iterator li = lc->Languages.begin();
li != lc->Languages.end(); ++li)
{
@@ -1989,8 +1998,11 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
// Add runtime paths required by the languages to always be
// present. This is done even when skipping rpath support.
{
- cmTarget::LinkClosure const* lc =
- this->Target->GetLinkClosure(this->Config, this->HeadTarget);
+ cmGeneratorTarget *gtgt = this->Makefile->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(this->Target);
+ cmGeneratorTarget::LinkClosure const* lc =
+ gtgt->GetLinkClosure(this->Config, this->HeadTarget->Target);
for(std::vector<std::string>::const_iterator li = lc->Languages.begin();
li != lc->Languages.end(); ++li)
{
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 356e6ed..f91f6cc 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -21,6 +21,7 @@ class cmGlobalGenerator;
class cmLocalGenerator;
class cmMakefile;
class cmTarget;
+class cmGeneratorTarget;
class cmOrderDirectories;
/** \class cmComputeLinkInformation
@@ -75,7 +76,7 @@ private:
// Context information.
cmTarget const* Target;
- cmTarget const* HeadTarget;
+ cmGeneratorTarget const* HeadTarget;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;
cmGlobalGenerator* GlobalGenerator;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 55c92b6..57bb597 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -725,6 +725,185 @@ std::string cmGeneratorTarget::GetInstallNameDirForInstallTree() const
}
//----------------------------------------------------------------------------
+class cmTargetCollectLinkLanguages
+{
+public:
+ cmTargetCollectLinkLanguages(cmGeneratorTarget const* target,
+ const char* config,
+ std::set<cmStdString>& languages,
+ cmTarget const* head):
+ Config(config), Languages(languages), HeadTarget(head)
+ { this->Visited.insert(target); }
+
+ void Visit(cmGeneratorTarget const* target)
+ {
+ if(!target || !this->Visited.insert(target).second)
+ {
+ return;
+ }
+
+ cmTarget::LinkInterface const* iface =
+ target->Target->GetLinkInterface(this->Config, this->HeadTarget);
+ if(!iface) { return; }
+
+ for(std::vector<std::string>::const_iterator
+ li = iface->Languages.begin(); li != iface->Languages.end(); ++li)
+ {
+ this->Languages.insert(*li);
+ }
+
+ cmMakefile* mf = target->GetMakefile();
+ for(std::vector<std::string>::const_iterator
+ li = iface->Libraries.begin(); li != iface->Libraries.end(); ++li)
+ {
+ this->Visit(mf->FindGeneratorTargetToUse(li->c_str()));
+ }
+ }
+private:
+ const char* Config;
+ std::set<cmStdString>& Languages;
+ cmTarget const* HeadTarget;
+ std::set<cmGeneratorTarget const*> Visited;
+};
+
+//----------------------------------------------------------------------------
+cmGeneratorTarget::LinkClosure const*
+cmGeneratorTarget::GetLinkClosure(const char* config,
+ cmTarget const* head) const
+{
+ TargetConfigPair key(head, cmSystemTools::UpperCase(config ? config : ""));
+ LinkClosureMapType::iterator
+ i = this->LinkClosureMap.find(key);
+ if(i == this->LinkClosureMap.end())
+ {
+ LinkClosure lc;
+ this->ComputeLinkClosure(config, lc, head);
+ LinkClosureMapType::value_type entry(key, lc);
+ i = this->LinkClosureMap.insert(entry).first;
+ }
+ return &i->second;
+}
+
+//----------------------------------------------------------------------------
+class cmTargetSelectLinker
+{
+ int Preference;
+ cmGeneratorTarget const* Target;
+ cmMakefile* Makefile;
+ cmGlobalGenerator* GG;
+ std::set<cmStdString> Preferred;
+public:
+ cmTargetSelectLinker(cmGeneratorTarget const* target)
+ : Preference(0), Target(target)
+ {
+ this->Makefile = this->Target->Makefile;
+ this->GG = this->Makefile->GetLocalGenerator()->GetGlobalGenerator();
+ }
+ void Consider(const char* lang)
+ {
+ int preference = this->GG->GetLinkerPreference(lang);
+ if(preference > this->Preference)
+ {
+ this->Preference = preference;
+ this->Preferred.clear();
+ }
+ if(preference == this->Preference)
+ {
+ this->Preferred.insert(lang);
+ }
+ }
+ std::string Choose()
+ {
+ if(this->Preferred.empty())
+ {
+ return "";
+ }
+ else if(this->Preferred.size() > 1)
+ {
+ cmOStringStream e;
+ e << "Target " << this->Target->GetName()
+ << " contains multiple languages with the highest linker preference"
+ << " (" << this->Preference << "):\n";
+ for(std::set<cmStdString>::const_iterator
+ li = this->Preferred.begin(); li != this->Preferred.end(); ++li)
+ {
+ e << " " << *li << "\n";
+ }
+ e << "Set the LINKER_LANGUAGE property for this target.";
+ cmake* cm = this->Makefile->GetCMakeInstance();
+ cm->IssueMessage(cmake::FATAL_ERROR, e.str(),
+ this->Target->Target->GetBacktrace());
+ }
+ return *this->Preferred.begin();
+ }
+};
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::ComputeLinkClosure(const char* config, LinkClosure& lc,
+ cmTarget const* head) const
+{
+ // Get languages built in this target.
+ std::set<cmStdString> languages;
+ cmTarget::LinkImplementation const* impl =
+ this->Target->GetLinkImplementation(config, head);
+ for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
+ li != impl->Languages.end(); ++li)
+ {
+ languages.insert(*li);
+ }
+
+ // Add interface languages from linked targets.
+ cmTargetCollectLinkLanguages cll(this, config, languages, head);
+ for(std::vector<std::string>::const_iterator li = impl->Libraries.begin();
+ li != impl->Libraries.end(); ++li)
+ {
+ cll.Visit(this->Makefile->FindGeneratorTargetToUse(li->c_str()));
+ }
+
+ // Store the transitive closure of languages.
+ for(std::set<cmStdString>::const_iterator li = languages.begin();
+ li != languages.end(); ++li)
+ {
+ lc.Languages.push_back(*li);
+ }
+
+ // Choose the language whose linker should be used.
+ if(this->GetProperty("HAS_CXX"))
+ {
+ lc.LinkerLanguage = "CXX";
+ }
+ else if(const char* linkerLang = this->GetProperty("LINKER_LANGUAGE"))
+ {
+ lc.LinkerLanguage = linkerLang;
+ }
+ else
+ {
+ // Find the language with the highest preference value.
+ cmTargetSelectLinker tsl(this);
+
+ // First select from the languages compiled directly in this target.
+ for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
+ li != impl->Languages.end(); ++li)
+ {
+ tsl.Consider(li->c_str());
+ }
+
+ // Now consider languages that propagate from linked targets.
+ for(std::set<cmStdString>::const_iterator sit = languages.begin();
+ sit != languages.end(); ++sit)
+ {
+ std::string propagates = "CMAKE_"+*sit+"_LINKER_PREFERENCE_PROPAGATES";
+ if(this->Makefile->IsOn(propagates.c_str()))
+ {
+ tsl.Consider(sit->c_str());
+ }
+ }
+
+ lc.LinkerLanguage = tsl.Choose();
+ }
+}
+
+//----------------------------------------------------------------------------
void cmGeneratorTarget::GetFullNameComponents(std::string& prefix,
std::string& base,
std::string& suffix, const char* config,
@@ -2909,7 +3088,7 @@ const char* cmGeneratorTarget::GetLinkerLanguage(const char* config,
cmTarget const* head) const
{
cmTarget const* headTarget = head ? head : this->Target;
- const char* lang = this->Target->GetLinkClosure(config, headTarget)
+ const char* lang = this->GetLinkClosure(config, headTarget)
->LinkerLanguage.c_str();
return *lang? lang : 0;
}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index d527ad5..d4a7ce2 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -34,6 +34,11 @@ struct cmTargetLinkInformationMap:
~cmTargetLinkInformationMap();
};
+struct TargetConfigPair : public std::pair<cmTarget const*, std::string> {
+ TargetConfigPair(cmTarget const* tgt, const std::string &config)
+ : std::pair<cmTarget const*, std::string>(tgt, config) {}
+};
+
class cmGeneratorTarget
{
public:
@@ -119,6 +124,22 @@ public:
std::string ModuleDefinitionFile;
+ /** 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 char* config,
+ cmTarget const* head) const;
+ void ComputeLinkClosure(const char* config, LinkClosure& lc,
+ cmTarget const* head) const;
+
/** Full path with trailing slash to the top-level directory
holding object files for this target. Includes the build
time config name placeholder if needed for the generator. */
@@ -259,6 +280,9 @@ private:
std::string& outPrefix, std::string& outBase,
std::string& outSuffix) const;
+ typedef std::map<TargetConfigPair, LinkClosure> LinkClosureMapType;
+ mutable LinkClosureMapType LinkClosureMap;
+
cmGeneratorTarget(cmGeneratorTarget const&);
void operator=(cmGeneratorTarget const&);
};
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 93aabb7..cf44561 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -105,10 +105,6 @@ public:
cmTarget::LinkImplementation> LinkImplMapType;
LinkImplMapType LinkImplMap;
- typedef std::map<TargetConfigPair, cmTarget::LinkClosure>
- LinkClosureMapType;
- LinkClosureMapType LinkClosureMap;
-
typedef cmGeneratorTarget::TargetPropertyEntry TargetPropertyEntry;
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
@@ -405,7 +401,6 @@ void cmTarget::ClearLinkMaps()
{
this->Internal->LinkImplMap.clear();
this->Internal->LinkInterfaceMap.clear();
- this->Internal->LinkClosureMap.clear();
}
//----------------------------------------------------------------------------
@@ -2391,182 +2386,6 @@ bool cmTarget::GetPropertyAsBool(const char* prop) const
{
return cmSystemTools::IsOn(this->GetProperty(prop));
}
-
-//----------------------------------------------------------------------------
-class cmTargetCollectLinkLanguages
-{
-public:
- cmTargetCollectLinkLanguages(cmTarget const* target, const char* config,
- std::set<cmStdString>& languages,
- cmTarget const* head):
- Config(config), Languages(languages), HeadTarget(head)
- { this->Visited.insert(target); }
-
- void Visit(cmTarget const* target)
- {
- if(!target || !this->Visited.insert(target).second)
- {
- return;
- }
-
- cmTarget::LinkInterface const* iface =
- target->GetLinkInterface(this->Config, this->HeadTarget);
- if(!iface) { return; }
-
- for(std::vector<std::string>::const_iterator
- li = iface->Languages.begin(); li != iface->Languages.end(); ++li)
- {
- this->Languages.insert(*li);
- }
-
- cmMakefile* mf = target->GetMakefile();
- for(std::vector<std::string>::const_iterator
- li = iface->Libraries.begin(); li != iface->Libraries.end(); ++li)
- {
- this->Visit(mf->FindTargetToUse(li->c_str()));
- }
- }
-private:
- const char* Config;
- std::set<cmStdString>& Languages;
- cmTarget const* HeadTarget;
- std::set<cmTarget const*> Visited;
-};
-
-//----------------------------------------------------------------------------
-cmTarget::LinkClosure const* cmTarget::GetLinkClosure(const char* config,
- cmTarget const* head) const
-{
- TargetConfigPair key(head, cmSystemTools::UpperCase(config ? config : ""));
- cmTargetInternals::LinkClosureMapType::iterator
- i = this->Internal->LinkClosureMap.find(key);
- if(i == this->Internal->LinkClosureMap.end())
- {
- LinkClosure lc;
- this->ComputeLinkClosure(config, lc, head);
- cmTargetInternals::LinkClosureMapType::value_type entry(key, lc);
- i = this->Internal->LinkClosureMap.insert(entry).first;
- }
- return &i->second;
-}
-
-//----------------------------------------------------------------------------
-class cmTargetSelectLinker
-{
- int Preference;
- cmTarget const* Target;
- cmMakefile* Makefile;
- cmGlobalGenerator* GG;
- std::set<cmStdString> Preferred;
-public:
- cmTargetSelectLinker(cmTarget const* target): Preference(0), Target(target)
- {
- this->Makefile = this->Target->GetMakefile();
- this->GG = this->Makefile->GetLocalGenerator()->GetGlobalGenerator();
- }
- void Consider(const char* lang)
- {
- int preference = this->GG->GetLinkerPreference(lang);
- if(preference > this->Preference)
- {
- this->Preference = preference;
- this->Preferred.clear();
- }
- if(preference == this->Preference)
- {
- this->Preferred.insert(lang);
- }
- }
- std::string Choose()
- {
- if(this->Preferred.empty())
- {
- return "";
- }
- else if(this->Preferred.size() > 1)
- {
- cmOStringStream e;
- e << "Target " << this->Target->GetName()
- << " contains multiple languages with the highest linker preference"
- << " (" << this->Preference << "):\n";
- for(std::set<cmStdString>::const_iterator
- li = this->Preferred.begin(); li != this->Preferred.end(); ++li)
- {
- e << " " << *li << "\n";
- }
- e << "Set the LINKER_LANGUAGE property for this target.";
- cmake* cm = this->Makefile->GetCMakeInstance();
- cm->IssueMessage(cmake::FATAL_ERROR, e.str(),
- this->Target->GetBacktrace());
- }
- return *this->Preferred.begin();
- }
-};
-
-//----------------------------------------------------------------------------
-void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc,
- cmTarget const* head) const
-{
- // Get languages built in this target.
- std::set<cmStdString> languages;
- LinkImplementation const* impl = this->GetLinkImplementation(config, head);
- for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
- li != impl->Languages.end(); ++li)
- {
- languages.insert(*li);
- }
-
- // Add interface languages from linked targets.
- cmTargetCollectLinkLanguages cll(this, config, languages, head);
- for(std::vector<std::string>::const_iterator li = impl->Libraries.begin();
- li != impl->Libraries.end(); ++li)
- {
- cll.Visit(this->Makefile->FindTargetToUse(li->c_str()));
- }
-
- // Store the transitive closure of languages.
- for(std::set<cmStdString>::const_iterator li = languages.begin();
- li != languages.end(); ++li)
- {
- lc.Languages.push_back(*li);
- }
-
- // Choose the language whose linker should be used.
- if(this->GetProperty("HAS_CXX"))
- {
- lc.LinkerLanguage = "CXX";
- }
- else if(const char* linkerLang = this->GetProperty("LINKER_LANGUAGE"))
- {
- lc.LinkerLanguage = linkerLang;
- }
- else
- {
- // Find the language with the highest preference value.
- cmTargetSelectLinker tsl(this);
-
- // First select from the languages compiled directly in this target.
- for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
- li != impl->Languages.end(); ++li)
- {
- tsl.Consider(li->c_str());
- }
-
- // Now consider languages that propagate from linked targets.
- for(std::set<cmStdString>::const_iterator sit = languages.begin();
- sit != languages.end(); ++sit)
- {
- std::string propagates = "CMAKE_"+*sit+"_LINKER_PREFERENCE_PROPAGATES";
- if(this->Makefile->IsOn(propagates.c_str()))
- {
- tsl.Consider(sit->c_str());
- }
- }
-
- lc.LinkerLanguage = tsl.Choose();
- }
-}
-
//----------------------------------------------------------------------------
const char* cmTarget::GetSuffixVariableInternal(bool implib) const
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index ce03985..622522d 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -53,11 +53,6 @@ private:
cmTargetInternals* Pointer;
};
-struct TargetConfigPair : public std::pair<cmTarget const*, std::string> {
- TargetConfigPair(cmTarget const* tgt, const std::string &config)
- : std::pair<cmTarget const*, std::string>(tgt, config) {}
-};
-
/** \class cmTarget
* \brief Represent a library or executable target loaded from a makefile.
*
@@ -306,19 +301,6 @@ public:
LinkImplementation const* GetLinkImplementation(const char* config,
cmTarget const* head) 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 char* config,
- cmTarget const* head) const;
-
/** Strip off leading and trailing whitespace from an item named in
the link dependencies of this target. */
std::string CheckCMP0004(std::string const& item) const;
@@ -608,8 +590,6 @@ private:
void ComputeLinkImplementation(const char* config,
LinkImplementation& impl,
cmTarget const* head) const;
- void ComputeLinkClosure(const char* config, LinkClosure& lc,
- cmTarget const* head) const;
void ClearLinkMaps();
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49ff6dd2b73b4b803de96f23f5399d5ad511d6e2
commit 49ff6dd2b73b4b803de96f23f5399d5ad511d6e2
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Nov 3 16:33:25 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:07 2014 +0100
Move GetLinkerLanguage to cmGeneratorTarget.
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 485b85d..f28b93c 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -266,8 +266,11 @@ cmComputeLinkInformation
"runtime search path");
this->OrderDependentRPath = 0;
+ cmGeneratorTarget *gtgt = this->Target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(this->Target);
// Get the language used for linking this target.
- this->LinkLanguage = this->Target->GetLinkerLanguage(config, headTarget);
+ this->LinkLanguage = gtgt->GetLinkerLanguage(config, headTarget);
if(!this->LinkLanguage)
{
// The Compute method will do nothing, so skip the rest of the
@@ -323,9 +326,6 @@ cmComputeLinkInformation
(this->Makefile->
GetSafeDefinition("CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH"));
- cmGeneratorTarget *gtgt = this->Target->GetMakefile()->GetLocalGenerator()
- ->GetGlobalGenerator()
- ->GetGeneratorTarget(this->Target);
this->RuntimeUseChrpath = gtgt->IsChrpathUsed(config);
// Get options needed to help find dependent libraries.
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index d21ea9c..c38fc11 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -976,7 +976,11 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
"link libraries for a static library");
return std::string();
}
- const char *lang = target->GetLinkerLanguage(context->Config);
+
+ cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
+ const char *lang = gtgt->GetLinkerLanguage(context->Config);
return lang ? lang : "";
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 7a84da2..55c92b6 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -420,7 +420,7 @@ bool cmGeneratorTarget::HasSOName(const char* config) const
return ((this->GetType() == cmTarget::SHARED_LIBRARY ||
this->GetType() == cmTarget::MODULE_LIBRARY) &&
!this->GetPropertyAsBool("NO_SONAME") &&
- this->Makefile->GetSONameFlag(this->Target->GetLinkerLanguage(config,
+ this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config,
this->Target)));
}
@@ -462,7 +462,7 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall(const char* config) const
}
// Check for rpath support on this platform.
- if(const char* ll = this->Target->GetLinkerLanguage(config, this->Target))
+ if(const char* ll = this->GetLinkerLanguage(config, this->Target))
{
std::string flagVar = "CMAKE_SHARED_LIBRARY_RUNTIME_";
flagVar += ll;
@@ -532,7 +532,7 @@ bool cmGeneratorTarget::IsChrpathUsed(const char* config) const
#if defined(CMAKE_USE_ELF_PARSER)
// Enable if the rpath flag uses a separator and the target uses ELF
// binaries.
- if(const char* ll = this->Target->GetLinkerLanguage(config, this->Target))
+ if(const char* ll = this->GetLinkerLanguage(config, this->Target))
{
std::string sepVar = "CMAKE_SHARED_LIBRARY_RUNTIME_";
sepVar += ll;
@@ -2829,7 +2829,7 @@ void cmGeneratorTarget::GetFullNameInternal(const char* config,
const char* suffixVar = this->Target->GetSuffixVariableInternal(implib);
// Check for language-specific default prefix and suffix.
- if(const char* ll = this->Target->GetLinkerLanguage(config, this->Target))
+ if(const char* ll = this->GetLinkerLanguage(config, this->Target))
{
if(!targetSuffix && suffixVar && *suffixVar)
{
@@ -2905,6 +2905,16 @@ void cmGeneratorTarget::GetFullNameInternal(const char* config,
//----------------------------------------------------------------------------
+const char* cmGeneratorTarget::GetLinkerLanguage(const char* config,
+ cmTarget const* head) const
+{
+ cmTarget const* headTarget = head ? head : this->Target;
+ const char* lang = this->Target->GetLinkClosure(config, headTarget)
+ ->LinkerLanguage.c_str();
+ return *lang? lang : 0;
+}
+
+//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetPDBName(const char* config) const
{
std::string prefix;
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index b02d62f..d527ad5 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -227,6 +227,10 @@ public:
/** Return true if builtin chrpath will work for this target */
bool IsChrpathUsed(const char* config) const;
+ ///! Return the preferred linker language for this target
+ const char* GetLinkerLanguage(const char* config = 0,
+ cmTarget const* head = 0) const;
+
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index b857fce..d74c84e 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1236,7 +1236,8 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
return;
}
- const char* llang = cmtarget.GetLinkerLanguage("NOCONFIG");
+ cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&cmtarget);
+ const char* llang = gtgt->GetLinkerLanguage("NOCONFIG");
if(!llang) { return; }
// If the language is compiled as a source trust Xcode to link with it.
@@ -1709,7 +1710,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
(target.GetType() == cmTarget::EXECUTABLE) ||
shared);
- const char* lang = target.GetLinkerLanguage(configName);
+ cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
+ const char* lang = gtgt->GetLinkerLanguage(configName);
std::string cflags;
if(lang)
{
@@ -1761,7 +1763,6 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// Add the export symbol definition for shared library objects.
this->AppendDefines(ppDefs, exportMacro);
}
- cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
std::vector<std::string> targetDefines;
target.GetCompileDefinitions(targetDefines, configName);
this->AppendDefines(ppDefs, targetDefines);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 6750e0d..8d882ff 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -774,7 +774,7 @@ void cmLocalGenerator
case cmTarget::MODULE_LIBRARY:
case cmTarget::EXECUTABLE:
{
- const char* llang = target.Target->GetLinkerLanguage();
+ const char* llang = target.GetLinkerLanguage();
if(!llang)
{
cmSystemTools::Error
@@ -1681,7 +1681,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
linkFlags += this->Makefile->GetSafeDefinition(build.c_str());
linkFlags += " ";
}
- const char* linkLanguage = target->Target->GetLinkerLanguage();
+ const char* linkLanguage = target->GetLinkerLanguage();
if(!linkLanguage)
{
cmSystemTools::Error
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index a901aa4..5d42205 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1249,14 +1249,14 @@ void cmLocalVisualStudio6Generator
extraLinkOptionsRelWithDebInfo += targetLinkFlags;
}
-
-
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(&target);
// Get standard libraries for this language.
if(targetBuilds)
{
// Get the language to use for linking.
- const char* linkLanguage = target.GetLinkerLanguage();
+ const char* linkLanguage = gt->GetLinkerLanguage();
if(!linkLanguage)
{
cmSystemTools::Error
@@ -1678,7 +1678,7 @@ void cmLocalVisualStudio6Generator
if(target.GetType() >= cmTarget::EXECUTABLE &&
target.GetType() <= cmTarget::OBJECT_LIBRARY)
{
- const char* linkLanguage = target.GetLinkerLanguage();
+ const char* linkLanguage = gt->GetLinkerLanguage();
if(!linkLanguage)
{
cmSystemTools::Error
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index e2630b0..d4a1e9e 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -657,6 +657,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
const char* configType = "10";
const char* projectType = 0;
bool targetBuilds = true;
+
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(&target);
+
switch(target.GetType())
{
case cmTarget::OBJECT_LIBRARY:
@@ -688,7 +692,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
if(strcmp(configType, "10") != 0)
{
const char* linkLanguage = (this->FortranProject? "Fortran":
- target.GetLinkerLanguage(configName));
+ gt->GetLinkerLanguage(configName));
if(!linkLanguage)
{
cmSystemTools::Error
@@ -750,8 +754,6 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.Parse(flags.c_str());
targetOptions.Parse(defineFlags.c_str());
targetOptions.ParseFinish();
- cmGeneratorTarget* gt =
- this->GlobalGenerator->GetGeneratorTarget(&target);
std::vector<std::string> targetDefines;
target.GetCompileDefinitions(targetDefines, configName);
targetOptions.AddDefines(targetDefines);
@@ -1544,7 +1546,7 @@ cmLocalVisualStudio7GeneratorFCInfo
lg->GlobalGenerator->GetLanguageFromExtension
(sf.GetExtension().c_str());
const char* sourceLang = lg->GetSourceFileLanguage(sf);
- const char* linkLanguage = target.GetLinkerLanguage(i->c_str());
+ const char* linkLanguage = gt->GetLinkerLanguage(i->c_str());
bool needForceLang = false;
// source file does not match its extension language
if(lang && sourceLang && strcmp(lang, sourceLang) != 0)
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index c1959ac..8f9589d 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -157,7 +157,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Get the language to use for linking this executable.
const char* linkLanguage =
- this->Target->GetLinkerLanguage(this->ConfigName);
+ this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
// Make sure we have a link language.
if(!linkLanguage)
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 0f6b9f2..153c019 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -132,7 +132,7 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
{
const char* linkLanguage =
- this->Target->GetLinkerLanguage(this->ConfigName);
+ this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_";
if (linkLanguage)
{
@@ -161,7 +161,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
return;
}
const char* linkLanguage =
- this->Target->GetLinkerLanguage(this->ConfigName);
+ this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_";
if (linkLanguage)
{
@@ -188,7 +188,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
{
const char* linkLanguage =
- this->Target->GetLinkerLanguage(this->ConfigName);
+ this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_";
if (linkLanguage)
{
@@ -214,7 +214,7 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink)
{
const char* linkLanguage =
- this->Target->GetLinkerLanguage(this->ConfigName);
+ this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_";
if (linkLanguage)
{
@@ -249,7 +249,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
// Get the language to use for linking this library.
const char* linkLanguage =
- this->Target->GetLinkerLanguage(this->ConfigName);
+ this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
// Make sure we have a link language.
if(!linkLanguage)
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 9c9501d..9425f55 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1673,7 +1673,7 @@ std::string cmMakefileTargetGenerator::GetLinkRule(const char* linkRuleVar)
if(this->Target->HasImplibGNUtoMS())
{
std::string ruleVar = "CMAKE_";
- ruleVar += this->Target->GetLinkerLanguage(this->ConfigName);
+ ruleVar += this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
ruleVar += "_GNUtoMS_RULE";
if(const char* rule = this->Makefile->GetDefinition(ruleVar.c_str()))
{
@@ -1836,7 +1836,8 @@ cmMakefileTargetGenerator
// Lookup the response file reference flag.
std::string responseFlagVar = "CMAKE_";
- responseFlagVar += this->Target->GetLinkerLanguage(this->ConfigName);
+ responseFlagVar += this->GeneratorTarget
+ ->GetLinkerLanguage(this->ConfigName);
responseFlagVar += "_RESPONSE_FILE_LINK_FLAG";
const char* responseFlag =
this->Makefile->GetDefinition(responseFlagVar.c_str());
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 7994ec0..1faed1d 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -37,8 +37,7 @@ cmNinjaNormalTargetGenerator(cmGeneratorTarget* target)
, TargetNamePDB()
, TargetLinkLanguage(0)
{
- this->TargetLinkLanguage = target->Target
- ->GetLinkerLanguage(this->GetConfigName());
+ this->TargetLinkLanguage = target->GetLinkerLanguage(this->GetConfigName());
if (target->GetType() == cmTarget::EXECUTABLE)
this->GetGeneratorTarget()->GetExecutableNames(this->TargetNameOut,
this->TargetNameReal,
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 967b1c6..93aabb7 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2434,16 +2434,6 @@ private:
};
//----------------------------------------------------------------------------
-const char* cmTarget::GetLinkerLanguage(const char* config,
- cmTarget const* head) const
-{
- cmTarget const* headTarget = head ? head : this;
- const char* lang = this->GetLinkClosure(config, headTarget)
- ->LinkerLanguage.c_str();
- return *lang? lang : 0;
-}
-
-//----------------------------------------------------------------------------
cmTarget::LinkClosure const* cmTarget::GetLinkClosure(const char* config,
cmTarget const* head) const
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 7632556..ce03985 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -353,10 +353,6 @@ public:
*/
bool FindSourceFiles();
- ///! Return the preferred linker language for this target
- const char* GetLinkerLanguage(const char* config = 0,
- cmTarget const* head = 0) const;
-
/** Whether this library has \@rpath and platform supports it. */
bool HasMacOSXRpathInstallNameDir(const char* config) const;
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 93fd700..62fea2d 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1112,7 +1112,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
this->GlobalGenerator->GetLanguageFromExtension
(sf.GetExtension().c_str());
const char* sourceLang = this->LocalGenerator->GetSourceFileLanguage(sf);
- const char* linkLanguage = this->Target->GetLinkerLanguage();
+ const char* linkLanguage = this->GeneratorTarget->GetLinkerLanguage();
bool needForceLang = false;
// source file does not match its extension language
if(lang && sourceLang && strcmp(lang, sourceLang) != 0)
@@ -1342,7 +1342,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
if(this->Target->GetType() < cmTarget::UTILITY)
{
const char* linkLanguage =
- this->Target->GetLinkerLanguage(configName.c_str());
+ this->GeneratorTarget->GetLinkerLanguage(configName.c_str());
if(!linkLanguage)
{
cmSystemTools::Error
@@ -1515,7 +1515,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
Options& linkOptions = *pOptions;
const char* linkLanguage =
- this->Target->GetLinkerLanguage(config.c_str());
+ this->GeneratorTarget->GetLinkerLanguage(config.c_str());
if(!linkLanguage)
{
cmSystemTools::Error
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e406308b7cd2a98210125366231f3d87deaf516d
commit e406308b7cd2a98210125366231f3d87deaf516d
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Oct 22 16:27:40 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:07 2014 +0100
Make ForceLinkerLanguages virtual.
This way it can be called at the appropriate time (after
cmGeneratorTargets have been created).
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 9780188..f135276 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1126,6 +1126,7 @@ void cmGlobalGenerator::Generate()
// Create per-target generator information.
this->CreateGeneratorTargets();
+ this->ForceLinkerLanguages();
#ifdef CMAKE_BUILD_WITH_CMAKE
for (AutogensType::iterator it = autogens.begin(); it != autogens.end();
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 77d3fd8..3c86537 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -414,6 +414,8 @@ private:
void CheckRuleHashes(std::string const& pfile, std::string const& home);
void WriteRuleHashes(std::string const& pfile);
+ virtual void ForceLinkerLanguages() {}
+
void WriteSummary();
void WriteSummary(cmTarget* target);
void FinalizeTargetCompileInfo();
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index e97875c..b857fce 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -346,7 +346,6 @@ void cmGlobalXCodeGenerator::Generate()
// add ALL_BUILD, INSTALL, etc
this->AddExtraTargets(root, it->second);
}
- this->ForceLinkerLanguages();
this->cmGlobalGenerator::Generate();
if(cmSystemTools::GetErrorOccuredFlag())
{
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b1d2fe596a424c80db06b868f2fb0c5d0d3c806f
commit b1d2fe596a424c80db06b868f2fb0c5d0d3c806f
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 9 19:01:39 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:07 2014 +0100
Move GetFullNameInternal to cmGeneratorTarget.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index f5453d3..7a84da2 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -639,7 +639,7 @@ cmGeneratorTarget::GetFullName(const char* config, bool implib) const
}
else
{
- return this->Target->GetFullNameInternal(config, implib);
+ return this->GetFullNameInternal(config, implib);
}
}
@@ -730,7 +730,7 @@ void cmGeneratorTarget::GetFullNameComponents(std::string& prefix,
std::string& suffix, const char* config,
bool implib) const
{
- this->Target->GetFullNameInternal(config, implib, prefix, base, suffix);
+ this->GetFullNameInternal(config, implib, prefix, base, suffix);
}
//----------------------------------------------------------------------------
@@ -2652,7 +2652,7 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name,
std::string prefix;
std::string base;
std::string suffix;
- this->Target->GetFullNameInternal(config, false, prefix, base, suffix);
+ this->GetFullNameInternal(config, false, prefix, base, suffix);
// The library name.
name = prefix+base+suffix;
@@ -2681,7 +2681,7 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name,
if(this->GetType() == cmTarget::SHARED_LIBRARY ||
this->GetType() == cmTarget::MODULE_LIBRARY)
{
- impName = this->Target->GetFullNameInternal(config, true);
+ impName = this->GetFullNameInternal(config, true);
}
else
{
@@ -2727,7 +2727,7 @@ void cmGeneratorTarget::GetExecutableNames(std::string& name,
std::string prefix;
std::string base;
std::string suffix;
- this->Target->GetFullNameInternal(config, false, prefix, base, suffix);
+ this->GetFullNameInternal(config, false, prefix, base, suffix);
// The executable name.
name = prefix+base+suffix;
@@ -2748,19 +2748,169 @@ void cmGeneratorTarget::GetExecutableNames(std::string& name,
#endif
// The import library name.
- impName = this->Target->GetFullNameInternal(config, true);
+ impName = this->GetFullNameInternal(config, true);
// The program database file name.
pdbName = this->GetPDBName(config);
}
//----------------------------------------------------------------------------
+std::string
+cmGeneratorTarget::GetFullNameInternal(const char* config, bool implib) const
+{
+ std::string prefix;
+ std::string base;
+ std::string suffix;
+ this->GetFullNameInternal(config, implib, prefix, base, suffix);
+ return prefix+base+suffix;
+}
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::GetFullNameInternal(const char* config,
+ bool implib,
+ std::string& outPrefix,
+ std::string& outBase,
+ std::string& outSuffix) const
+{
+ // Use just the target name for non-main target types.
+ if(this->GetType() != cmTarget::STATIC_LIBRARY &&
+ this->GetType() != cmTarget::SHARED_LIBRARY &&
+ this->GetType() != cmTarget::MODULE_LIBRARY &&
+ this->GetType() != cmTarget::EXECUTABLE)
+ {
+ outPrefix = "";
+ outBase = this->GetName();
+ outSuffix = "";
+ return;
+ }
+
+ // Return an empty name for the import library if this platform
+ // does not support import libraries.
+ if(implib &&
+ !this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"))
+ {
+ outPrefix = "";
+ outBase = "";
+ outSuffix = "";
+ return;
+ }
+
+ // The implib option is only allowed for shared libraries, module
+ // libraries, and executables.
+ if(this->GetType() != cmTarget::SHARED_LIBRARY &&
+ this->GetType() != cmTarget::MODULE_LIBRARY &&
+ this->GetType() != cmTarget::EXECUTABLE)
+ {
+ implib = false;
+ }
+
+ // Compute the full name for main target types.
+ const char* targetPrefix = (implib
+ ? this->GetProperty("IMPORT_PREFIX")
+ : this->GetProperty("PREFIX"));
+ const char* targetSuffix = (implib
+ ? this->GetProperty("IMPORT_SUFFIX")
+ : this->GetProperty("SUFFIX"));
+ const char* configPostfix = 0;
+ if(config && *config)
+ {
+ std::string configProp = cmSystemTools::UpperCase(config);
+ configProp += "_POSTFIX";
+ configPostfix = this->GetProperty(configProp.c_str());
+ // Mac application bundles and frameworks have no postfix.
+ if(configPostfix &&
+ (this->Target->IsAppBundleOnApple()
+ || this->Target->IsFrameworkOnApple()))
+ {
+ configPostfix = 0;
+ }
+ }
+ const char* prefixVar = this->Target->GetPrefixVariableInternal(implib);
+ const char* suffixVar = this->Target->GetSuffixVariableInternal(implib);
+
+ // Check for language-specific default prefix and suffix.
+ if(const char* ll = this->Target->GetLinkerLanguage(config, this->Target))
+ {
+ if(!targetSuffix && suffixVar && *suffixVar)
+ {
+ std::string langSuff = suffixVar + std::string("_") + ll;
+ targetSuffix = this->Makefile->GetDefinition(langSuff.c_str());
+ }
+ if(!targetPrefix && prefixVar && *prefixVar)
+ {
+ std::string langPrefix = prefixVar + std::string("_") + ll;
+ targetPrefix = this->Makefile->GetDefinition(langPrefix.c_str());
+ }
+ }
+
+ // if there is no prefix on the target use the cmake definition
+ if(!targetPrefix && prefixVar)
+ {
+ targetPrefix = this->Makefile->GetSafeDefinition(prefixVar);
+ }
+ // if there is no suffix on the target use the cmake definition
+ if(!targetSuffix && suffixVar)
+ {
+ targetSuffix = this->Makefile->GetSafeDefinition(suffixVar);
+ }
+
+ // frameworks have directory prefix but no suffix
+ std::string fw_prefix;
+ if(this->Target->IsFrameworkOnApple())
+ {
+ fw_prefix = this->Target->GetOutputName(config, false);
+ fw_prefix += ".framework/";
+ targetPrefix = fw_prefix.c_str();
+ targetSuffix = 0;
+ }
+
+ if(this->Target->IsCFBundleOnApple())
+ {
+ fw_prefix = this->Target->GetOutputName(config, false);
+ fw_prefix += ".";
+ const char *ext = this->GetProperty("BUNDLE_EXTENSION");
+ if (!ext)
+ {
+ ext = "bundle";
+ }
+ fw_prefix += ext;
+ fw_prefix += "/Contents/MacOS/";
+ targetPrefix = fw_prefix.c_str();
+ targetSuffix = 0;
+ }
+
+ // Begin the final name with the prefix.
+ outPrefix = targetPrefix?targetPrefix:"";
+
+ // Append the target name or property-specified name.
+ outBase += this->Target->GetOutputName(config, implib);
+
+ // Append the per-configuration postfix.
+ outBase += configPostfix?configPostfix:"";
+
+ // Name shared libraries with their version number on some platforms.
+ if(const char* soversion = this->GetProperty("SOVERSION"))
+ {
+ if(this->GetType() == cmTarget::SHARED_LIBRARY && !implib &&
+ this->Makefile->IsOn("CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION"))
+ {
+ outBase += "-";
+ outBase += soversion;
+ }
+ }
+
+ // Append the suffix.
+ outSuffix = targetSuffix?targetSuffix:"";
+}
+
+
+//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetPDBName(const char* config) const
{
std::string prefix;
std::string base;
std::string suffix;
- this->Target->GetFullNameInternal(config, false, prefix, base, suffix);
+ this->GetFullNameInternal(config, false, prefix, base, suffix);
std::vector<std::string> props;
std::string configUpper =
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 37a2566..b02d62f 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -250,6 +250,11 @@ private:
mutable std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
+ std::string GetFullNameInternal(const char* config, bool implib) const;
+ void GetFullNameInternal(const char* config, bool implib,
+ std::string& outPrefix, std::string& outBase,
+ std::string& outSuffix) const;
+
cmGeneratorTarget(cmGeneratorTarget const&);
void operator=(cmGeneratorTarget const&);
};
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d5be388..967b1c6 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2777,154 +2777,6 @@ cmTarget::ImportedGetFullPath(const char* config, bool implib) const
}
//----------------------------------------------------------------------------
-std::string
-cmTarget::GetFullNameInternal(const char* config, bool implib) const
-{
- std::string prefix;
- std::string base;
- std::string suffix;
- this->GetFullNameInternal(config, implib, prefix, base, suffix);
- return prefix+base+suffix;
-}
-
-//----------------------------------------------------------------------------
-void cmTarget::GetFullNameInternal(const char* config,
- bool implib,
- std::string& outPrefix,
- std::string& outBase,
- std::string& outSuffix) const
-{
- // Use just the target name for non-main target types.
- if(this->GetType() != cmTarget::STATIC_LIBRARY &&
- this->GetType() != cmTarget::SHARED_LIBRARY &&
- this->GetType() != cmTarget::MODULE_LIBRARY &&
- this->GetType() != cmTarget::EXECUTABLE)
- {
- outPrefix = "";
- outBase = this->GetName();
- outSuffix = "";
- return;
- }
-
- // Return an empty name for the import library if this platform
- // does not support import libraries.
- if(implib &&
- !this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"))
- {
- outPrefix = "";
- outBase = "";
- outSuffix = "";
- return;
- }
-
- // The implib option is only allowed for shared libraries, module
- // libraries, and executables.
- if(this->GetType() != cmTarget::SHARED_LIBRARY &&
- this->GetType() != cmTarget::MODULE_LIBRARY &&
- this->GetType() != cmTarget::EXECUTABLE)
- {
- implib = false;
- }
-
- // Compute the full name for main target types.
- const char* targetPrefix = (implib
- ? this->GetProperty("IMPORT_PREFIX")
- : this->GetProperty("PREFIX"));
- const char* targetSuffix = (implib
- ? this->GetProperty("IMPORT_SUFFIX")
- : this->GetProperty("SUFFIX"));
- const char* configPostfix = 0;
- if(config && *config)
- {
- std::string configProp = cmSystemTools::UpperCase(config);
- configProp += "_POSTFIX";
- configPostfix = this->GetProperty(configProp.c_str());
- // Mac application bundles and frameworks have no postfix.
- if(configPostfix &&
- (this->IsAppBundleOnApple() || this->IsFrameworkOnApple()))
- {
- configPostfix = 0;
- }
- }
- const char* prefixVar = this->GetPrefixVariableInternal(implib);
- const char* suffixVar = this->GetSuffixVariableInternal(implib);
-
- // Check for language-specific default prefix and suffix.
- if(const char* ll = this->GetLinkerLanguage(config, this))
- {
- if(!targetSuffix && suffixVar && *suffixVar)
- {
- std::string langSuff = suffixVar + std::string("_") + ll;
- targetSuffix = this->Makefile->GetDefinition(langSuff.c_str());
- }
- if(!targetPrefix && prefixVar && *prefixVar)
- {
- std::string langPrefix = prefixVar + std::string("_") + ll;
- targetPrefix = this->Makefile->GetDefinition(langPrefix.c_str());
- }
- }
-
- // if there is no prefix on the target use the cmake definition
- if(!targetPrefix && prefixVar)
- {
- targetPrefix = this->Makefile->GetSafeDefinition(prefixVar);
- }
- // if there is no suffix on the target use the cmake definition
- if(!targetSuffix && suffixVar)
- {
- targetSuffix = this->Makefile->GetSafeDefinition(suffixVar);
- }
-
- // frameworks have directory prefix but no suffix
- std::string fw_prefix;
- if(this->IsFrameworkOnApple())
- {
- fw_prefix = this->GetOutputName(config, false);
- fw_prefix += ".framework/";
- targetPrefix = fw_prefix.c_str();
- targetSuffix = 0;
- }
-
- if(this->IsCFBundleOnApple())
- {
- fw_prefix = this->GetOutputName(config, false);
- fw_prefix += ".";
- const char *ext = this->GetProperty("BUNDLE_EXTENSION");
- if (!ext)
- {
- ext = "bundle";
- }
- fw_prefix += ext;
- fw_prefix += "/Contents/MacOS/";
- targetPrefix = fw_prefix.c_str();
- targetSuffix = 0;
- }
-
- // Begin the final name with the prefix.
- outPrefix = targetPrefix?targetPrefix:"";
-
- // Append the target name or property-specified name.
- outBase += this->GetOutputName(config, implib);
-
- // Append the per-configuration postfix.
- outBase += configPostfix?configPostfix:"";
-
- // Name shared libraries with their version number on some platforms.
- if(const char* soversion = this->GetProperty("SOVERSION"))
- {
- if(this->GetType() == cmTarget::SHARED_LIBRARY && !implib &&
- this->Makefile->IsOn("CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION"))
- {
- outBase += "-";
- outBase += soversion;
- }
- }
-
- // Append the suffix.
- outSuffix = targetSuffix?targetSuffix:"";
-}
-
-//----------------------------------------------------------------------------
void cmTarget::ComputeVersionedName(std::string& vName,
std::string const& prefix,
std::string const& base,
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index c7c7b15..7632556 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -540,10 +540,6 @@ private:
const char* GetSuffixVariableInternal(bool implib) const;
const char* GetPrefixVariableInternal(bool implib) const;
- std::string GetFullNameInternal(const char* config, bool implib) const;
- void GetFullNameInternal(const char* 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.
// If the variable is not defined use the given default instead.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6df00db520ff9c97705b9852ac8c3301d789b82b
commit 6df00db520ff9c97705b9852ac8c3301d789b82b
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 9 01:26:16 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:07 2014 +0100
Move GetFullName to cmGeneratorTarget.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index ec18535..f5453d3 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -299,7 +299,7 @@ const char* cmGeneratorTarget::NormalGetLocation(const char* config) const
}
}
location += "/";
- location += this->Target->GetFullName(config, false);
+ location += this->GetFullName(config, false);
return location.c_str();
}
@@ -622,7 +622,7 @@ std::string cmGeneratorTarget::GetCFBundleDirectory(const char* config,
std::string cmGeneratorTarget::GetAppBundleDirectory(const char* config,
bool contentOnly) const
{
- std::string fpath = this->Target->GetFullName(config, false);
+ std::string fpath = this->GetFullName(config, false);
fpath += ".app/Contents";
if(!contentOnly)
fpath += "/MacOS";
@@ -630,6 +630,20 @@ std::string cmGeneratorTarget::GetAppBundleDirectory(const char* config,
}
//----------------------------------------------------------------------------
+std::string
+cmGeneratorTarget::GetFullName(const char* config, bool implib) const
+{
+ if(this->Target->IsImported())
+ {
+ return this->Target->GetFullNameImported(config, implib);
+ }
+ else
+ {
+ return this->Target->GetFullNameInternal(config, implib);
+ }
+}
+
+//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetFrameworkDirectory(const char* config,
bool rootDir) const
{
@@ -2539,7 +2553,7 @@ std::string cmGeneratorTarget::NormalGetFullPath(const char* config,
// Add the full name of the target.
if(implib)
{
- fpath += this->Target->GetFullName(config, true);
+ fpath += this->GetFullName(config, true);
}
else if(realname)
{
@@ -2547,7 +2561,7 @@ std::string cmGeneratorTarget::NormalGetFullPath(const char* config,
}
else
{
- fpath += this->Target->GetFullName(config, false);
+ fpath += this->GetFullName(config, false);
}
return fpath;
}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index c68dbad..37a2566 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -73,6 +73,10 @@ public:
bool realname) const;
std::string NormalGetRealName(const char* config) const;
+ /** Get the full name of the target according to the settings in its
+ makefile. */
+ std::string GetFullName(const char* config=0, bool implib = false) const;
+
/** @return the Mac framework directory without the base. */
std::string GetFrameworkDirectory(const char* config, bool rootDir) const;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index c82ef45..e97875c 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2609,7 +2609,8 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
}
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("refType", this->CreateString("0"));
@@ -3571,7 +3572,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
std::string universalFile = universal;
universalFile += *arch;
universalFile += "/";
- universalFile += t->GetFullName(configName);
+ universalFile += gt->GetFullName(configName);
makefileStream << "\t/bin/rm -f "
<<
this->ConvertToRelativeForMake(universalFile.c_str())
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index cbd8fce..6750e0d 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -687,7 +687,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang,
std::string createRule = "CMAKE_";
createRule += llang;
createRule += target.GetCreateRuleVariable();
- std::string targetName = target.Target->GetFullName();
+ std::string targetName = target.GetFullName();
// Executable :
// Shared Library:
// Static Library:
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 168de6c..a901aa4 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1102,7 +1102,8 @@ void cmLocalVisualStudio6Generator
// Compute the proper name to use to link this library.
std::string lib;
std::string libDebug;
- cmTarget* tgt = this->GlobalGenerator->FindTarget(0, j->first.c_str());
+ cmGeneratorTarget* tgt =
+ this->GlobalGenerator->FindGeneratorTarget(0, j->first.c_str());
if(tgt)
{
lib = cmSystemTools::GetFilenameWithoutExtension
@@ -1305,11 +1306,11 @@ void cmLocalVisualStudio6Generator
target.GetType() == cmTarget::SHARED_LIBRARY ||
target.GetType() == cmTarget::MODULE_LIBRARY)
{
- outputName = target.GetFullName();
- outputNameDebug = target.GetFullName("Debug");
- outputNameRelease = target.GetFullName("Release");
- outputNameMinSizeRel = target.GetFullName("MinSizeRel");
- outputNameRelWithDebInfo = target.GetFullName("RelWithDebInfo");
+ outputName = gt->GetFullName();
+ outputNameDebug = gt->GetFullName("Debug");
+ outputNameRelease = gt->GetFullName("Release");
+ outputNameMinSizeRel = gt->GetFullName("MinSizeRel");
+ outputNameRelWithDebInfo = gt->GetFullName("RelWithDebInfo");
}
else if(target.GetType() == cmTarget::OBJECT_LIBRARY)
{
@@ -1406,10 +1407,10 @@ void cmLocalVisualStudio6Generator
fullPathImpRelease += "/";
fullPathImpMinSizeRel += "/";
fullPathImpRelWithDebInfo += "/";
- fullPathImpDebug += target.GetFullName("Debug", true);
- fullPathImpRelease += target.GetFullName("Release", true);
- fullPathImpMinSizeRel += target.GetFullName("MinSizeRel", true);
- fullPathImpRelWithDebInfo += target.GetFullName("RelWithDebInfo", true);
+ fullPathImpDebug += gt->GetFullName("Debug", true);
+ fullPathImpRelease += gt->GetFullName("Release", true);
+ fullPathImpMinSizeRel += gt->GetFullName("MinSizeRel", true);
+ fullPathImpRelWithDebInfo += gt->GetFullName("RelWithDebInfo", true);
targetImplibFlagDebug = "/implib:";
targetImplibFlagRelease = "/implib:";
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index d3f8ed6..e2630b0 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -999,6 +999,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
this->ConvertToXMLOutputPath(this->ModuleDefinitionFile.c_str());
linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str());
}
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(&target);
+
switch(target.GetType())
{
case cmTarget::UNKNOWN_LIBRARY:
@@ -1021,7 +1024,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
}
case cmTarget::STATIC_LIBRARY:
{
- std::string targetNameFull = target.GetFullName(configName);
+ std::string targetNameFull = gt->GetFullName(configName);
std::string libpath = target.GetDirectory(configName);
libpath += "/";
libpath += targetNameFull;
@@ -1064,8 +1067,6 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
targetNameImport, targetNamePDB, configName);
// Compute the link library and directory information.
- cmGeneratorTarget* gt =
- this->GlobalGenerator->GetGeneratorTarget(&target);
cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName);
if(!pcli)
{
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 252100b..d5be388 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2752,19 +2752,6 @@ bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetFullName(const char* config, bool implib) const
-{
- if(this->IsImported())
- {
- return this->GetFullNameImported(config, implib);
- }
- else
- {
- return this->GetFullNameInternal(config, implib);
- }
-}
-
-//----------------------------------------------------------------------------
std::string
cmTarget::GetFullNameImported(const char* config, bool implib) const
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 7547508..c7c7b15 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -357,10 +357,6 @@ public:
const char* GetLinkerLanguage(const char* config = 0,
cmTarget const* head = 0) const;
- /** Get the full name of the target according to the settings in its
- makefile. */
- std::string GetFullName(const char* config=0, bool implib = false) const;
-
/** Whether this library has \@rpath and platform supports it. */
bool HasMacOSXRpathInstallNameDir(const char* config) const;
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index c35e92f..93fd700 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1233,7 +1233,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
else
{
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(outDir);
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=912d9e803446aba832b539e79b1f5b7b9434c8aa
commit 912d9e803446aba832b539e79b1f5b7b9434c8aa
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 9 01:22:42 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:07 2014 +0100
Move GetFrameworkDirectory to cmGeneratorTarget.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index e4e647e..ec18535 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -600,6 +600,51 @@ std::string cmGeneratorTarget::GetSOName(const char* config) const
}
//----------------------------------------------------------------------------
+std::string cmGeneratorTarget::GetCFBundleDirectory(const char* config,
+ bool contentOnly) const
+{
+ std::string fpath;
+ fpath += this->Target->GetOutputName(config, false);
+ fpath += ".";
+ const char *ext = this->GetProperty("BUNDLE_EXTENSION");
+ if (!ext)
+ {
+ ext = "bundle";
+ }
+ fpath += ext;
+ fpath += "/Contents";
+ if(!contentOnly)
+ fpath += "/MacOS";
+ return fpath;
+}
+
+//----------------------------------------------------------------------------
+std::string cmGeneratorTarget::GetAppBundleDirectory(const char* config,
+ bool contentOnly) const
+{
+ std::string fpath = this->Target->GetFullName(config, false);
+ fpath += ".app/Contents";
+ if(!contentOnly)
+ fpath += "/MacOS";
+ return fpath;
+}
+
+//----------------------------------------------------------------------------
+std::string cmGeneratorTarget::GetFrameworkDirectory(const char* config,
+ bool rootDir) const
+{
+ std::string fpath;
+ fpath += this->Target->GetOutputName(config, false);
+ fpath += ".framework";
+ if(!rootDir)
+ {
+ fpath += "/Versions/";
+ fpath += this->Target->GetFrameworkVersion();
+ }
+ return fpath;
+}
+
+//----------------------------------------------------------------------------
std::string
cmGeneratorTarget::GetInstallNameDirForBuildTree(const char* config) const
{
@@ -683,15 +728,15 @@ cmGeneratorTarget::BuildMacContentDirectory(const std::string& base,
std::string fpath = base;
if(this->Target->IsAppBundleOnApple())
{
- fpath += this->Target->GetAppBundleDirectory(config, contentOnly);
+ fpath += this->GetAppBundleDirectory(config, contentOnly);
}
if(this->Target->IsFrameworkOnApple())
{
- fpath += this->Target->GetFrameworkDirectory(config, contentOnly);
+ fpath += this->GetFrameworkDirectory(config, contentOnly);
}
if(this->Target->IsCFBundleOnApple())
{
- fpath += this->Target->GetCFBundleDirectory(config, contentOnly);
+ fpath += this->GetCFBundleDirectory(config, contentOnly);
}
return fpath;
}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 2bc5455..c68dbad 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -73,6 +73,16 @@ public:
bool realname) const;
std::string NormalGetRealName(const char* config) const;
+ /** @return the Mac framework directory without the base. */
+ std::string GetFrameworkDirectory(const char* config, bool rootDir) const;
+
+ /** @return the Mac CFBundle directory without the base */
+ std::string GetCFBundleDirectory(const char* config, bool contentOnly) const;
+
+ /** @return the Mac App directory without the base */
+ std::string GetAppBundleDirectory(const char* 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". */
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index 5875b6d..439052e 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -48,7 +48,7 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
// Compute bundle directory names.
std::string out = outpath;
out += "/";
- out += this->Target->GetAppBundleDirectory(this->ConfigName, false);
+ out += this->GeneratorTarget->GetAppBundleDirectory(this->ConfigName, false);
cmSystemTools::MakeDirectory(out.c_str());
this->Makefile->AddCMakeOutputFile(out);
@@ -58,7 +58,8 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
// to be set.
std::string plist = outpath;
plist += "/";
- plist += this->Target->GetAppBundleDirectory(this->ConfigName, true);
+ plist += this->GeneratorTarget->GetAppBundleDirectory(this->ConfigName,
+ true);
plist += "/Info.plist";
this->LocalGenerator->GenerateAppleInfoPList(this->Target,
targetName.c_str(),
@@ -78,11 +79,11 @@ void cmOSXBundleGenerator::CreateFramework(
// Compute the location of the top-level foo.framework directory.
std::string contentdir = outpath + "/" +
- this->Target->GetFrameworkDirectory(this->ConfigName, true);
+ this->GeneratorTarget->GetFrameworkDirectory(this->ConfigName, true);
contentdir += "/";
std::string newoutpath = outpath + "/" +
- this->Target->GetFrameworkDirectory(this->ConfigName, false);
+ this->GeneratorTarget->GetFrameworkDirectory(this->ConfigName, false);
std::string frameworkVersion = this->Target->GetFrameworkVersion();
@@ -173,14 +174,14 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName,
// Compute bundle directory names.
std::string out = root;
out += "/";
- out += this->Target->GetCFBundleDirectory(this->ConfigName, false);
+ out += this->GeneratorTarget->GetCFBundleDirectory(this->ConfigName, false);
cmSystemTools::MakeDirectory(out.c_str());
this->Makefile->AddCMakeOutputFile(out);
// Configure the Info.plist file. Note that it needs the executable name
// to be set.
std::string plist =
- this->Target->GetCFBundleDirectory(this->ConfigName, true);
+ this->GeneratorTarget->GetCFBundleDirectory(this->ConfigName, true);
plist += "/Info.plist";
this->LocalGenerator->GenerateAppleInfoPList(this->Target,
targetName.c_str(),
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 661a334..252100b 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -4239,51 +4239,6 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetFrameworkDirectory(const char* config,
- bool rootDir) const
-{
- std::string fpath;
- fpath += this->GetOutputName(config, false);
- fpath += ".framework";
- if(!rootDir)
- {
- fpath += "/Versions/";
- fpath += this->GetFrameworkVersion();
- }
- return fpath;
-}
-
-//----------------------------------------------------------------------------
-std::string cmTarget::GetCFBundleDirectory(const char* config,
- bool contentOnly) const
-{
- std::string fpath;
- fpath += this->GetOutputName(config, false);
- fpath += ".";
- const char *ext = this->GetProperty("BUNDLE_EXTENSION");
- if (!ext)
- {
- ext = "bundle";
- }
- fpath += ext;
- fpath += "/Contents";
- if(!contentOnly)
- fpath += "/MacOS";
- return fpath;
-}
-
-//----------------------------------------------------------------------------
-std::string cmTarget::GetAppBundleDirectory(const char* config,
- bool contentOnly) const
-{
- std::string fpath = this->GetFullName(config, false);
- fpath += ".app/Contents";
- if(!contentOnly)
- fpath += "/MacOS";
- return fpath;
-}
-
-//----------------------------------------------------------------------------
cmTargetInternalPointer::cmTargetInternalPointer()
{
this->Pointer = new cmTargetInternals;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 6c39aef..7547508 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -451,16 +451,6 @@ public:
/** @return whether this target have a well defined output file name. */
bool HaveWellDefinedOutputFiles() const;
- /** @return the Mac framework directory without the base. */
- std::string GetFrameworkDirectory(const char* config, bool rootDir) const;
-
- /** @return the Mac CFBundle directory without the base */
- std::string GetCFBundleDirectory(const char* config, bool contentOnly) const;
-
- /** @return the Mac App directory without the base */
- std::string GetAppBundleDirectory(const char* config,
- bool contentOnly) const;
-
std::vector<std::string> GetIncludeDirectories(const char *config) const;
void InsertInclude(const cmValueWithOrigin &entry,
bool before = false);
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7034bb80d30cfb718db1621f7837e8f3241dd008
commit 7034bb80d30cfb718db1621f7837e8f3241dd008
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 9 01:20:27 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:07 2014 +0100
Move GetInstallNameDir* to cmGeneratorTarget.
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 75e1a51..9788e46 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -324,7 +324,7 @@ cmExportBuildFileGenerator
}
std::string
-cmExportBuildFileGenerator::InstallNameDir(cmTarget* target,
+cmExportBuildFileGenerator::InstallNameDir(cmGeneratorTarget* target,
const std::string& config)
{
std::string install_name_dir;
diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h
index 9f23b6b..325d702 100644
--- a/Source/cmExportBuildFileGenerator.h
+++ b/Source/cmExportBuildFileGenerator.h
@@ -71,7 +71,8 @@ protected:
cmGeneratorTarget* target,
ImportPropertyMap& properties);
- std::string InstallNameDir(cmTarget* target, const std::string& config);
+ std::string InstallNameDir(cmGeneratorTarget* target,
+ const std::string& config);
std::vector<std::string>
FindNamespaces(cmMakefile* mf, const std::string& name);
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index cec88bd..4ece383 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -790,7 +790,7 @@ cmExportFileGenerator
{
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
- value = this->InstallNameDir(target->Target, config);
+ value = this->InstallNameDir(target, config);
}
prop = "IMPORTED_SONAME";
value += target->GetSOName(config);
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index a7d9658..966f6d3 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -176,7 +176,7 @@ private:
virtual void ReplaceInstallPrefix(std::string &input);
- virtual std::string InstallNameDir(cmTarget* target,
+ virtual std::string InstallNameDir(cmGeneratorTarget* target,
const std::string& config) = 0;
};
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 79f74dd..674d034 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -540,7 +540,7 @@ cmExportInstallFileGenerator
}
std::string
-cmExportInstallFileGenerator::InstallNameDir(cmTarget* target,
+cmExportInstallFileGenerator::InstallNameDir(cmGeneratorTarget* target,
const std::string&)
{
std::string install_name_dir;
diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h
index 7c634a4..a67c726 100644
--- a/Source/cmExportInstallFileGenerator.h
+++ b/Source/cmExportInstallFileGenerator.h
@@ -85,7 +85,8 @@ protected:
void ComplainAboutImportPrefix(cmInstallTargetGenerator* itgen);
- std::string InstallNameDir(cmTarget* target, const std::string& config);
+ std::string InstallNameDir(cmGeneratorTarget* target,
+ const std::string& config);
cmInstallExportGenerator* IEGen;
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index 8d37b62..a748e44 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -119,7 +119,7 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target,
}
}
std::string
-cmExportTryCompileFileGenerator::InstallNameDir(cmTarget* target,
+cmExportTryCompileFileGenerator::InstallNameDir(cmGeneratorTarget* target,
const std::string& config)
{
std::string install_name_dir;
diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h
index 71ac0dd..41e8d83 100644
--- a/Source/cmExportTryCompileFileGenerator.h
+++ b/Source/cmExportTryCompileFileGenerator.h
@@ -43,7 +43,7 @@ protected:
ImportPropertyMap& properties,
std::set<cmTarget const*> &emitted);
- std::string InstallNameDir(cmTarget* target,
+ std::string InstallNameDir(cmGeneratorTarget* target,
const std::string& config);
private:
std::string FindTargets(const char *prop, cmTarget const* tgt,
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 93bcb71..e4e647e 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -600,6 +600,72 @@ std::string cmGeneratorTarget::GetSOName(const char* config) const
}
//----------------------------------------------------------------------------
+std::string
+cmGeneratorTarget::GetInstallNameDirForBuildTree(const char* config) const
+{
+ // If building directly for installation then the build tree install_name
+ // is the same as the install tree.
+ if(this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"))
+ {
+ return this->GetInstallNameDirForInstallTree();
+ }
+
+ // Use the build tree directory for the target.
+ if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME") &&
+ !this->Makefile->IsOn("CMAKE_SKIP_RPATH") &&
+ !this->GetPropertyAsBool("SKIP_BUILD_RPATH"))
+ {
+ std::string dir;
+ if(this->Target->MacOSXRpathInstallNameDirDefault())
+ {
+ dir = "@rpath";
+ }
+ else
+ {
+ dir = this->Target->GetDirectory(config);
+ }
+ dir += "/";
+ return dir;
+ }
+ else
+ {
+ return "";
+ }
+}
+
+//----------------------------------------------------------------------------
+std::string cmGeneratorTarget::GetInstallNameDirForInstallTree() const
+{
+ if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
+ {
+ std::string dir;
+ const char* install_name_dir = this->GetProperty("INSTALL_NAME_DIR");
+
+ if(!this->Makefile->IsOn("CMAKE_SKIP_RPATH") &&
+ !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH"))
+ {
+ if(install_name_dir && *install_name_dir)
+ {
+ dir = install_name_dir;
+ dir += "/";
+ }
+ }
+ if(!install_name_dir)
+ {
+ if(this->Target->MacOSXRpathInstallNameDirDefault())
+ {
+ dir = "@rpath/";
+ }
+ }
+ return dir;
+ }
+ else
+ {
+ return "";
+ }
+}
+
+//----------------------------------------------------------------------------
void cmGeneratorTarget::GetFullNameComponents(std::string& prefix,
std::string& base,
std::string& suffix, const char* config,
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 12a7d53..2bc5455 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -73,6 +73,15 @@ public:
bool realname) const;
std::string NormalGetRealName(const char* 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 char* 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 char* config) const;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index edf0786..c82ef45 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2237,7 +2237,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
if(target.GetType() == cmTarget::SHARED_LIBRARY)
{
// 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.
// That is, if the INSTALL_PATH is empty, or if we have versioning
// of dylib libraries, we want to specify the install_name.
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 75d5ffd..54aa0b7 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -552,11 +552,15 @@ cmInstallTargetGenerator
continue;
}
+ cmGeneratorTarget *gtgt = tgt->GetMakefile()
+ ->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(tgt);
// If the build tree and install tree use different path
// components of the install_name field then we need to create a
// mapping to be applied after installation.
- std::string for_build = tgt->GetInstallNameDirForBuildTree(config);
- std::string for_install = tgt->GetInstallNameDirForInstallTree();
+ std::string for_build = gtgt->GetInstallNameDirForBuildTree(config);
+ std::string for_install = gtgt->GetInstallNameDirForInstallTree();
if(for_build != for_install)
{
// The directory portions differ. Append the filename to
@@ -581,9 +585,9 @@ cmInstallTargetGenerator
if(this->Target->GetType() == cmTarget::SHARED_LIBRARY)
{
std::string for_build =
- this->Target->GetInstallNameDirForBuildTree(config);
+ this->GeneratorTarget->GetInstallNameDirForBuildTree(config);
std::string for_install =
- this->Target->GetInstallNameDirForInstallTree();
+ this->GeneratorTarget->GetInstallNameDirForInstallTree();
if(this->Target->IsFrameworkOnApple() && for_install.empty())
{
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 806fc8b..0f6b9f2 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -601,7 +601,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
{
// Get the install_name directory for the build tree.
install_name_dir =
- this->Target->GetInstallNameDirForBuildTree(this->ConfigName);
+ this->GeneratorTarget->GetInstallNameDirForBuildTree(this->ConfigName);
// Set the rule variable replacement value.
if(install_name_dir.empty())
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 49d3e98..7994ec0 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -492,7 +492,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
this->GetMakefile()->GetSONameFlag(this->TargetLinkLanguage);
vars["SONAME"] = this->TargetNameSO;
if (targetType == cmTarget::SHARED_LIBRARY) {
- std::string install_name_dir = this->GetTarget()
+ std::string install_name_dir = this->GetGeneratorTarget()
->GetInstallNameDirForBuildTree(this->GetConfigName());
if (!install_name_dir.empty()) {
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index f33afc9..661a334 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -3013,72 +3013,6 @@ bool cmTarget::HaveInstallTreeRPATH() const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetInstallNameDirForBuildTree(const char* config) const
-{
- // If building directly for installation then the build tree install_name
- // is the same as the install tree.
- if(this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"))
- {
- return GetInstallNameDirForInstallTree();
- }
-
- // Use the build tree directory for the target.
- if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME") &&
- !this->Makefile->IsOn("CMAKE_SKIP_RPATH") &&
- !this->GetPropertyAsBool("SKIP_BUILD_RPATH"))
- {
- std::string dir;
- bool macosx_rpath = this->MacOSXRpathInstallNameDirDefault();
- if(macosx_rpath)
- {
- dir = "@rpath";
- }
- else
- {
- dir = this->GetDirectory(config);
- }
- dir += "/";
- return dir;
- }
- else
- {
- return "";
- }
-}
-
-//----------------------------------------------------------------------------
-std::string cmTarget::GetInstallNameDirForInstallTree() const
-{
- if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
- {
- std::string dir;
- const char* install_name_dir = this->GetProperty("INSTALL_NAME_DIR");
-
- if(!this->Makefile->IsOn("CMAKE_SKIP_RPATH") &&
- !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH"))
- {
- if(install_name_dir && *install_name_dir)
- {
- dir = install_name_dir;
- dir += "/";
- }
- }
- if(!install_name_dir)
- {
- if(this->MacOSXRpathInstallNameDirDefault())
- {
- dir = "@rpath/";
- }
- }
- return dir;
- }
- else
- {
- return "";
- }
-}
-
-//----------------------------------------------------------------------------
const char* cmTarget::GetOutputTargetType(bool implib) const
{
switch(this->GetType())
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 351fe60..6c39aef 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -382,15 +382,6 @@ public:
bool HaveBuildTreeRPATH(const char *config) const;
bool HaveInstallTreeRPATH() 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 char* 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 properties
cmPropertyMap &GetProperties() const { return this->Properties; };
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65ca1f0bf6abfa1810dea64bea762967de0bc283
commit 65ca1f0bf6abfa1810dea64bea762967de0bc283
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 9 01:13:20 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:07 2014 +0100
Move GetMacContentDirectory to cmGeneratorTarget.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index aef4308..93bcb71 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -289,9 +289,9 @@ const char* cmGeneratorTarget::NormalGetLocation(const char* config) const
if(this->Target->IsAppBundleOnApple())
{
- std::string macdir = this->Target->BuildMacContentDirectory("",
- config,
- false);
+ std::string macdir = this->BuildMacContentDirectory("",
+ config,
+ false);
if(!macdir.empty())
{
location += "/";
@@ -609,6 +609,46 @@ void cmGeneratorTarget::GetFullNameComponents(std::string& prefix,
}
//----------------------------------------------------------------------------
+std::string
+cmGeneratorTarget::BuildMacContentDirectory(const std::string& base,
+ const char* config,
+ bool contentOnly) const
+{
+ std::string fpath = base;
+ if(this->Target->IsAppBundleOnApple())
+ {
+ fpath += this->Target->GetAppBundleDirectory(config, contentOnly);
+ }
+ if(this->Target->IsFrameworkOnApple())
+ {
+ fpath += this->Target->GetFrameworkDirectory(config, contentOnly);
+ }
+ if(this->Target->IsCFBundleOnApple())
+ {
+ fpath += this->Target->GetCFBundleDirectory(config, contentOnly);
+ }
+ return fpath;
+}
+
+//----------------------------------------------------------------------------
+std::string cmGeneratorTarget::GetMacContentDirectory(const char* config,
+ bool implib) const
+{
+ // Start with the output directory for the target.
+ std::string fpath = this->Target->GetDirectory(config, implib);
+ fpath += "/";
+ bool contentOnly = true;
+ if(this->Target->IsFrameworkOnApple())
+ {
+ // additional files with a framework go into the version specific
+ // directory
+ contentOnly = false;
+ }
+ fpath = this->BuildMacContentDirectory(fpath, config, contentOnly);
+ return fpath;
+}
+
+//----------------------------------------------------------------------------
void cmGeneratorTarget::ClassifySources()
{
cmsys::RegularExpression header(CM_HEADER_REGEX);
@@ -2381,7 +2421,7 @@ std::string cmGeneratorTarget::NormalGetFullPath(const char* config,
fpath += "/";
if(this->Target->IsAppBundleOnApple())
{
- fpath = this->Target->BuildMacContentDirectory(fpath, config, false);
+ fpath = this->BuildMacContentDirectory(fpath, config, false);
fpath += "/";
}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index b3527f0..12a7d53 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -80,6 +80,15 @@ public:
std::string& base, std::string& suffix,
const char* config=0, bool implib = false) const;
+ /** Append to @a base the mac content directory and return it. */
+ std::string BuildMacContentDirectory(const std::string& base,
+ const char* config = 0,
+ bool contentOnly = true) const;
+
+ /** @return the mac content directory for this target. */
+ std::string GetMacContentDirectory(const char* config = 0,
+ bool implib = false) const;
+
cmTarget* Target;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index 9a340dc..5875b6d 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -21,6 +21,7 @@ cmOSXBundleGenerator::
cmOSXBundleGenerator(cmGeneratorTarget* target,
const char* configName)
: Target(target->Target)
+ , GeneratorTarget(target)
, Makefile(target->Target->GetMakefile())
, LocalGenerator(Makefile->GetLocalGenerator())
, ConfigName(configName)
@@ -215,7 +216,7 @@ cmOSXBundleGenerator::InitMacOSXContentDirectory(const char* pkgloc)
// Construct the full path to the content subdirectory.
std::string macdir =
- this->Target->GetMacContentDirectory(this->ConfigName,
+ this->GeneratorTarget->GetMacContentDirectory(this->ConfigName,
/*implib*/ false);
macdir += "/";
macdir += pkgloc;
diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h
index 29b7611..660c5be 100644
--- a/Source/cmOSXBundleGenerator.h
+++ b/Source/cmOSXBundleGenerator.h
@@ -19,6 +19,7 @@
#include <set>
class cmTarget;
+class cmGeneratorTarget;
class cmMakefile;
class cmLocalGenerator;
class cmGeneratorTarget;
@@ -60,6 +61,7 @@ private:
private:
cmTarget* Target;
+ cmGeneratorTarget* GeneratorTarget;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;
const char* ConfigName;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 34a02bf..f33afc9 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -4350,45 +4350,6 @@ std::string cmTarget::GetAppBundleDirectory(const char* config,
}
//----------------------------------------------------------------------------
-std::string cmTarget::BuildMacContentDirectory(const std::string& base,
- const char* config,
- bool contentOnly) const
-{
- std::string fpath = base;
- if(this->IsAppBundleOnApple())
- {
- fpath += this->GetAppBundleDirectory(config, contentOnly);
- }
- if(this->IsFrameworkOnApple())
- {
- fpath += this->GetFrameworkDirectory(config, contentOnly);
- }
- if(this->IsCFBundleOnApple())
- {
- fpath += this->GetCFBundleDirectory(config, contentOnly);
- }
- return fpath;
-}
-
-//----------------------------------------------------------------------------
-std::string cmTarget::GetMacContentDirectory(const char* config,
- bool implib) const
-{
- // Start with the output directory for the target.
- std::string fpath = this->GetDirectory(config, implib);
- fpath += "/";
- bool contentOnly = true;
- if(this->IsFrameworkOnApple())
- {
- // additional files with a framework go into the version specific
- // directory
- contentOnly = false;
- }
- fpath = this->BuildMacContentDirectory(fpath, config, contentOnly);
- return fpath;
-}
-
-//----------------------------------------------------------------------------
cmTargetInternalPointer::cmTargetInternalPointer()
{
this->Pointer = new cmTargetInternals;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 83576d6..351fe60 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -457,10 +457,6 @@ public:
directory. */
bool UsesDefaultOutputDir(const char* config, bool implib) const;
- /** @return the mac content directory for this target. */
- std::string GetMacContentDirectory(const char* config,
- bool implib) const;
-
/** @return whether this target have a well defined output file name. */
bool HaveWellDefinedOutputFiles() const;
@@ -586,10 +582,6 @@ private:
std::string ImportedGetFullPath(const char* config, bool implib) const;
- /** Append to @a base the mac content directory and return it. */
- std::string BuildMacContentDirectory(const std::string& base,
- const char* config,
- bool contentOnly) const;
private:
std::string Name;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7beea6870e66d990f2ecd12580169bfef14ae40b
commit 7beea6870e66d990f2ecd12580169bfef14ae40b
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 9 00:40:34 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:06 2014 +0100
Move GetFullNameComponents to cmGeneratorTarget.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 6e00dc3..aef4308 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -600,6 +600,15 @@ std::string cmGeneratorTarget::GetSOName(const char* config) const
}
//----------------------------------------------------------------------------
+void cmGeneratorTarget::GetFullNameComponents(std::string& prefix,
+ std::string& base,
+ std::string& suffix, const char* config,
+ bool implib) const
+{
+ this->Target->GetFullNameInternal(config, implib, prefix, base, suffix);
+}
+
+//----------------------------------------------------------------------------
void cmGeneratorTarget::ClassifySources()
{
cmsys::RegularExpression header(CM_HEADER_REGEX);
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 21e44d7..b3527f0 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -76,6 +76,10 @@ public:
/** Get the soname of the target. Allowed only for a shared library. */
std::string GetSOName(const char* config) const;
+ void GetFullNameComponents(std::string& prefix,
+ std::string& base, std::string& suffix,
+ const char* config=0, bool implib = false) const;
+
cmTarget* Target;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 9894eb9..edf0786 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1852,7 +1852,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
std::string pnprefix;
std::string pnbase;
std::string pnsuffix;
- target.GetFullNameComponents(pnprefix, pnbase, pnsuffix, configName);
+ gtgt->GetFullNameComponents(pnprefix, pnbase, pnsuffix, configName);
const char* version = target.GetProperty("VERSION");
const char* soversion = target.GetProperty("SOVERSION");
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index ff65bbd..49d3e98 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -520,7 +520,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
std::string prefix;
std::string base;
std::string suffix;
- this->GetTarget()->GetFullNameComponents(prefix, base, suffix);
+ this->GetGeneratorTarget()->GetFullNameComponents(prefix, base, suffix);
std::string dbg_suffix = ".dbg";
// TODO: Where to document?
if (mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX"))
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index cfffe84..34a02bf 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2773,14 +2773,6 @@ cmTarget::GetFullNameImported(const char* config, bool implib) const
}
//----------------------------------------------------------------------------
-void cmTarget::GetFullNameComponents(std::string& prefix, std::string& base,
- std::string& suffix, const char* config,
- bool implib) const
-{
- this->GetFullNameInternal(config, implib, prefix, base, suffix);
-}
-
-//----------------------------------------------------------------------------
std::string
cmTarget::ImportedGetFullPath(const char* config, bool implib) const
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 56be89a..83576d6 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -360,9 +360,6 @@ public:
/** Get the full name of the target according to the settings in its
makefile. */
std::string GetFullName(const char* config=0, bool implib = false) const;
- void GetFullNameComponents(std::string& prefix,
- std::string& base, std::string& suffix,
- const char* config=0, bool implib = false) const;
/** Whether this library has \@rpath and platform supports it. */
bool HasMacOSXRpathInstallNameDir(const char* config) const;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=636906a03952d6f8c116a2cfb5976de9cfa5e38e
commit 636906a03952d6f8c116a2cfb5976de9cfa5e38e
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Nov 3 12:26:44 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:06 2014 +0100
Move IsChrPathUsed to cmGeneratorTarget.
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 101685b..485b85d 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -322,7 +322,11 @@ cmComputeLinkInformation
this->RuntimeAlways =
(this->Makefile->
GetSafeDefinition("CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH"));
- this->RuntimeUseChrpath = this->Target->IsChrpathUsed(config);
+
+ cmGeneratorTarget *gtgt = this->Target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(this->Target);
+ this->RuntimeUseChrpath = gtgt->IsChrpathUsed(config);
// Get options needed to help find dependent libraries.
std::string rlVar = "CMAKE_";
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 7c1f6d2..6e00dc3 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -456,7 +456,7 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall(const char* config) const
}
// If chrpath is going to be used no relinking is needed.
- if(this->Target->IsChrpathUsed(config))
+ if(this->IsChrpathUsed(config))
{
return false;
}
@@ -488,6 +488,72 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall(const char* config) const
|| this->Target->HaveInstallTreeRPATH();
}
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::IsChrpathUsed(const char* config) const
+{
+ // Only certain target types have an rpath.
+ if(!(this->GetType() == cmTarget::SHARED_LIBRARY ||
+ this->GetType() == cmTarget::MODULE_LIBRARY ||
+ this->GetType() == cmTarget::EXECUTABLE))
+ {
+ return false;
+ }
+
+ // If the target will not be installed we do not need to change its
+ // rpath.
+ if(!this->Target->GetHaveInstallRule())
+ {
+ return false;
+ }
+
+ // Skip chrpath if skipping rpath altogether.
+ if(this->Makefile->IsOn("CMAKE_SKIP_RPATH"))
+ {
+ return false;
+ }
+
+ // Skip chrpath if it does not need to be changed at install time.
+ if(this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"))
+ {
+ return false;
+ }
+
+ // Allow the user to disable builtin chrpath explicitly.
+ if(this->Makefile->IsOn("CMAKE_NO_BUILTIN_CHRPATH"))
+ {
+ return false;
+ }
+
+ if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
+ {
+ return true;
+ }
+
+#if defined(CMAKE_USE_ELF_PARSER)
+ // Enable if the rpath flag uses a separator and the target uses ELF
+ // binaries.
+ if(const char* ll = this->Target->GetLinkerLanguage(config, this->Target))
+ {
+ std::string sepVar = "CMAKE_SHARED_LIBRARY_RUNTIME_";
+ sepVar += ll;
+ sepVar += "_FLAG_SEP";
+ const char* sep = this->Makefile->GetDefinition(sepVar.c_str());
+ if(sep && *sep)
+ {
+ // TODO: Add ELF check to ABI detection and get rid of
+ // CMAKE_EXECUTABLE_FORMAT.
+ if(const char* fmt =
+ this->Makefile->GetDefinition("CMAKE_EXECUTABLE_FORMAT"))
+ {
+ return strcmp(fmt, "ELF") == 0;
+ }
+ }
+ }
+#endif
+ static_cast<void>(config);
+ return false;
+}
+
//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetSOName(const char* config) const
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index f88b837..21e44d7 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -188,6 +188,9 @@ public:
*/
bool NeedRelinkBeforeInstall(const char* config) const;
+ /** Return true if builtin chrpath will work for this target */
+ bool IsChrpathUsed(const char* config) const;
+
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index a487ad7..75d5ffd 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -630,12 +630,13 @@ cmInstallTargetGenerator
::AddRPathCheckRule(std::ostream& os, Indent const& indent,
const char* config, std::string const& toDestDirPath)
{
+ this->CreateGeneratorTarget();
+
// Skip the chrpath if the target does not need it.
- if(this->ImportLibrary || !this->Target->IsChrpathUsed(config))
+ if(this->ImportLibrary || !this->GeneratorTarget->IsChrpathUsed(config))
{
return;
}
-
// Skip if on Apple
if(this->Target->GetMakefile()->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
@@ -670,8 +671,9 @@ cmInstallTargetGenerator
::AddChrpathPatchRule(std::ostream& os, Indent const& indent,
const char* config, std::string const& toDestDirPath)
{
+ this->CreateGeneratorTarget();
// Skip the chrpath if the target does not need it.
- if(this->ImportLibrary || !this->Target->IsChrpathUsed(config))
+ if(this->ImportLibrary || !this->GeneratorTarget->IsChrpathUsed(config))
{
return;
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 82722e4..cfffe84 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -3392,72 +3392,6 @@ void cmTarget::GetLanguages(std::set<cmStdString>& languages) const
}
//----------------------------------------------------------------------------
-bool cmTarget::IsChrpathUsed(const char* config) const
-{
- // Only certain target types have an rpath.
- if(!(this->GetType() == cmTarget::SHARED_LIBRARY ||
- this->GetType() == cmTarget::MODULE_LIBRARY ||
- this->GetType() == cmTarget::EXECUTABLE))
- {
- return false;
- }
-
- // If the target will not be installed we do not need to change its
- // rpath.
- if(!this->GetHaveInstallRule())
- {
- return false;
- }
-
- // Skip chrpath if skipping rpath altogether.
- if(this->Makefile->IsOn("CMAKE_SKIP_RPATH"))
- {
- return false;
- }
-
- // Skip chrpath if it does not need to be changed at install time.
- if(this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"))
- {
- return false;
- }
-
- // Allow the user to disable builtin chrpath explicitly.
- if(this->Makefile->IsOn("CMAKE_NO_BUILTIN_CHRPATH"))
- {
- return false;
- }
-
- if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
- {
- return true;
- }
-
-#if defined(CMAKE_USE_ELF_PARSER)
- // Enable if the rpath flag uses a separator and the target uses ELF
- // binaries.
- if(const char* ll = this->GetLinkerLanguage(config, this))
- {
- std::string sepVar = "CMAKE_SHARED_LIBRARY_RUNTIME_";
- sepVar += ll;
- sepVar += "_FLAG_SEP";
- const char* sep = this->Makefile->GetDefinition(sepVar.c_str());
- if(sep && *sep)
- {
- // TODO: Add ELF check to ABI detection and get rid of
- // CMAKE_EXECUTABLE_FORMAT.
- if(const char* fmt =
- this->Makefile->GetDefinition("CMAKE_EXECUTABLE_FORMAT"))
- {
- return strcmp(fmt, "ELF") == 0;
- }
- }
- }
-#endif
- static_cast<void>(config);
- return false;
-}
-
-//----------------------------------------------------------------------------
cmTarget::ImportInfo const*
cmTarget::GetImportInfo(const char* config, cmTarget const* headTarget) const
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index df94434..56be89a 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -385,9 +385,6 @@ public:
bool HaveBuildTreeRPATH(const char *config) const;
bool HaveInstallTreeRPATH() const;
- /** Return true if builtin chrpath will work for this target */
- bool IsChrpathUsed(const char* config) const;
-
/** Return the install name directory for the target in the
* build tree. For example: "\@rpath/", "\@loader_path/",
* or "/full/path/to/library". */
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9f05621d7c412cee44161426bea667b40777d96d
commit 9f05621d7c412cee44161426bea667b40777d96d
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Nov 3 12:25:17 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:06 2014 +0100
Move NeedRelinkBeforeInstall to cmGeneratorTarget.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 22a5d6c..7c1f6d2 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -425,6 +425,71 @@ bool cmGeneratorTarget::HasSOName(const char* config) const
}
//----------------------------------------------------------------------------
+bool cmGeneratorTarget::NeedRelinkBeforeInstall(const char* config) const
+{
+ // Only executables and shared libraries can have an rpath and may
+ // need relinking.
+ if(this->GetType() != cmTarget::EXECUTABLE &&
+ this->GetType() != cmTarget::SHARED_LIBRARY &&
+ this->GetType() != cmTarget::MODULE_LIBRARY)
+ {
+ return false;
+ }
+
+ // If there is no install location this target will not be installed
+ // and therefore does not need relinking.
+ if(!this->Target->GetHaveInstallRule())
+ {
+ return false;
+ }
+
+ // If skipping all rpaths completely then no relinking is needed.
+ if(this->Makefile->IsOn("CMAKE_SKIP_RPATH"))
+ {
+ return false;
+ }
+
+ // If building with the install-tree rpath no relinking is needed.
+ if(this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"))
+ {
+ return false;
+ }
+
+ // If chrpath is going to be used no relinking is needed.
+ if(this->Target->IsChrpathUsed(config))
+ {
+ return false;
+ }
+
+ // Check for rpath support on this platform.
+ if(const char* ll = this->Target->GetLinkerLanguage(config, this->Target))
+ {
+ std::string flagVar = "CMAKE_SHARED_LIBRARY_RUNTIME_";
+ flagVar += ll;
+ flagVar += "_FLAG";
+ if(!this->Makefile->IsSet(flagVar.c_str()))
+ {
+ // There is no rpath support on this platform so nothing needs
+ // relinking.
+ return false;
+ }
+ }
+ else
+ {
+ // No linker language is known. This error will be reported by
+ // other code.
+ return false;
+ }
+
+ // If either a build or install tree rpath is set then the rpath
+ // will likely change between the build tree and install tree and
+ // this target must be relinked.
+ return this->Target->HaveBuildTreeRPATH(config)
+ || this->Target->HaveInstallTreeRPATH();
+}
+
+
+//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetSOName(const char* config) const
{
if(this->Target->IsImported())
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 6b5d143..f88b837 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -183,6 +183,11 @@ public:
std::string& realName, std::string& impName,
std::string& pdbName, const char* config) const;
+ /**
+ * Compute whether this target must be relinked before installing.
+ */
+ bool NeedRelinkBeforeInstall(const char* config) const;
+
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 0b37a07..c339058 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -491,7 +491,7 @@ cmGlobalUnixMakefileGenerator3
// Add this to the list of depends rules in this directory.
if((!check_all || !l->second->GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
(!check_relink ||
- l->second->Target
+ l->second
->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())))
{
std::string tname = lg->GetRelativeTargetDirectory(*l->second->Target);
@@ -698,9 +698,8 @@ cmGlobalUnixMakefileGenerator3
localName.c_str(), depends, commands, true);
// Add a local name for the rule to relink the target before
- // installation.
- if(t->second->Target
- ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
+ // installation.-
+ if(t->second->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
{
makeTargetName = lg->GetRelativeTargetDirectory(*t->second->Target);
makeTargetName += "/preinstall";
@@ -877,8 +876,7 @@ cmGlobalUnixMakefileGenerator3
t->second->GetName(), depends, commands, true);
// Add rules to prepare the target for installation.
- if(t->second->Target
- ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
+ if(t->second->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
{
localName = lg->GetRelativeTargetDirectory(*t->second->Target);
localName += "/preinstall";
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 282443f..a487ad7 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -64,9 +64,10 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
const char* config,
Indent const& indent)
{
+ this->CreateGeneratorTarget();
// Compute the build tree directory from which to copy the target.
std::string fromDirConfig;
- if(this->Target->NeedRelinkBeforeInstall(config))
+ if(this->GeneratorTarget->NeedRelinkBeforeInstall(config))
{
fromDirConfig = this->Target->GetMakefile()->GetStartOutputDirectory();
fromDirConfig += cmake::GetCMakeFilesDirectory();
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 93722d1..a39610e 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -445,8 +445,7 @@ void cmLocalUnixMakefileGenerator3
// Add a local name for the rule to relink the target before
// installation.
- if(t->second->Target
- ->NeedRelinkBeforeInstall(this->ConfigurationName.c_str()))
+ if(t->second->NeedRelinkBeforeInstall(this->ConfigurationName.c_str()))
{
makeTargetName = this->GetRelativeTargetDirectory(*t->second->Target);
makeTargetName += "/preinstall";
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 738bd9a..c1959ac 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -58,7 +58,7 @@ void cmMakefileExecutableTargetGenerator::WriteRuleFiles()
// write the link rules
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.
this->WriteExecutableRule(true);
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 9cd1264..806fc8b 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -68,7 +68,7 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
break;
case cmTarget::SHARED_LIBRARY:
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.
this->WriteSharedLibraryRules(true);
@@ -76,7 +76,7 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
break;
case cmTarget::MODULE_LIBRARY:
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.
this->WriteModuleLibraryRules(true);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 7b2dfb5..82722e4 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -3021,69 +3021,6 @@ bool cmTarget::HaveInstallTreeRPATH() const
}
//----------------------------------------------------------------------------
-bool cmTarget::NeedRelinkBeforeInstall(const char* config) const
-{
- // Only executables and shared libraries can have an rpath and may
- // need relinking.
- if(this->TargetTypeValue != cmTarget::EXECUTABLE &&
- this->TargetTypeValue != cmTarget::SHARED_LIBRARY &&
- this->TargetTypeValue != cmTarget::MODULE_LIBRARY)
- {
- return false;
- }
-
- // If there is no install location this target will not be installed
- // and therefore does not need relinking.
- if(!this->GetHaveInstallRule())
- {
- return false;
- }
-
- // If skipping all rpaths completely then no relinking is needed.
- if(this->Makefile->IsOn("CMAKE_SKIP_RPATH"))
- {
- return false;
- }
-
- // If building with the install-tree rpath no relinking is needed.
- if(this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"))
- {
- return false;
- }
-
- // If chrpath is going to be used no relinking is needed.
- if(this->IsChrpathUsed(config))
- {
- return false;
- }
-
- // Check for rpath support on this platform.
- if(const char* ll = this->GetLinkerLanguage(config, this))
- {
- std::string flagVar = "CMAKE_SHARED_LIBRARY_RUNTIME_";
- flagVar += ll;
- flagVar += "_FLAG";
- if(!this->Makefile->IsSet(flagVar.c_str()))
- {
- // There is no rpath support on this platform so nothing needs
- // relinking.
- return false;
- }
- }
- else
- {
- // No linker language is known. This error will be reported by
- // other code.
- return false;
- }
-
- // If either a build or install tree rpath is set then the rpath
- // will likely change between the build tree and install tree and
- // this target must be relinked.
- return this->HaveBuildTreeRPATH(config) || this->HaveInstallTreeRPATH();
-}
-
-//----------------------------------------------------------------------------
std::string cmTarget::GetInstallNameDirForBuildTree(const char* config) const
{
// If building directly for installation then the build tree install_name
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 47ed9ba..df94434 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -382,11 +382,6 @@ public:
bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
const char* newExt = 0) const;
- /**
- * Compute whether this target must be relinked before installing.
- */
- bool NeedRelinkBeforeInstall(const char* config) const;
-
bool HaveBuildTreeRPATH(const char *config) const;
bool HaveInstallTreeRPATH() const;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b167fe258144f8d9a120c12d152c4759a3cfe12d
commit b167fe258144f8d9a120c12d152c4759a3cfe12d
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 9 18:59:12 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:06 2014 +0100
Move GetPDBName to cmGeneratorTarget.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 9e6719c..22a5d6c 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -2384,7 +2384,7 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name,
}
// The program database file name.
- pdbName = this->Target->GetPDBName(config);
+ pdbName = this->GetPDBName(config);
}
//----------------------------------------------------------------------------
@@ -2446,7 +2446,39 @@ void cmGeneratorTarget::GetExecutableNames(std::string& name,
impName = this->Target->GetFullNameInternal(config, true);
// The program database file name.
- pdbName = this->Target->GetPDBName(config);
+ pdbName = this->GetPDBName(config);
+}
+
+//----------------------------------------------------------------------------
+std::string cmGeneratorTarget::GetPDBName(const char* config) const
+{
+ std::string prefix;
+ std::string base;
+ std::string suffix;
+ this->Target->GetFullNameInternal(config, false, prefix, base, suffix);
+
+ std::vector<std::string> props;
+ std::string configUpper =
+ cmSystemTools::UpperCase(config? config : "");
+ if(!configUpper.empty())
+ {
+ // PDB_NAME_<CONFIG>
+ props.push_back("PDB_NAME_" + configUpper);
+ }
+
+ // PDB_NAME
+ props.push_back("PDB_NAME");
+
+ for(std::vector<std::string>::const_iterator i = props.begin();
+ i != props.end(); ++i)
+ {
+ if(const char* outName = this->GetProperty(i->c_str()))
+ {
+ base = outName;
+ break;
+ }
+ }
+ return prefix+base+".pdb";
}
bool cmStrictTargetComparison::operator()(cmTarget const* t1,
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index bb8c4ab..6b5d143 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -145,6 +145,9 @@ public:
/** Get sources that must be built before the given source. */
std::vector<cmSourceFile*> const* GetSourceDepends(cmSourceFile* sf) const;
+ /** Get the name of the pdb file for the target. */
+ std::string GetPDBName(const char* config=0) const;
+
/** Whether this library has soname enabled and platform supports it. */
bool HasSOName(const char* config) const;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 31a45e0..9c9501d 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -636,7 +636,7 @@ cmMakefileTargetGenerator
this->GeneratorTarget->GetFullPath(this->ConfigName, false, true);
targetFullPathPDB = this->Target->GetPDBDirectory(this->ConfigName);
targetFullPathPDB += "/";
- targetFullPathPDB += this->Target->GetPDBName(this->ConfigName);
+ targetFullPathPDB += this->GeneratorTarget->GetPDBName(this->ConfigName);
}
targetOutPathReal = this->Convert(targetFullPathReal.c_str(),
cmLocalGenerator::START_OUTPUT,
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index fb6b9bf..d6b4433 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -322,7 +322,7 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const
{
pdbPath = this->Target->GetPDBDirectory(this->GetConfigName());
pdbPath += "/";
- pdbPath += this->Target->GetPDBName(this->GetConfigName());
+ pdbPath += this->GeneratorTarget->GetPDBName(this->GetConfigName());
}
vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 3fca594..7b2dfb5 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2627,38 +2627,6 @@ const char* cmTarget::GetPrefixVariableInternal(bool implib) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetPDBName(const char* config) const
-{
- std::string prefix;
- std::string base;
- std::string suffix;
- this->GetFullNameInternal(config, false, prefix, base, suffix);
-
- std::vector<std::string> props;
- std::string configUpper =
- cmSystemTools::UpperCase(config? config : "");
- if(!configUpper.empty())
- {
- // PDB_NAME_<CONFIG>
- props.push_back("PDB_NAME_" + configUpper);
- }
-
- // PDB_NAME
- props.push_back("PDB_NAME");
-
- for(std::vector<std::string>::const_iterator i = props.begin();
- i != props.end(); ++i)
- {
- if(const char* outName = this->GetProperty(i->c_str()))
- {
- base = outName;
- break;
- }
- }
- return prefix+base+".pdb";
-}
-
-//----------------------------------------------------------------------------
bool cmTarget::HasMacOSXRpathInstallNameDir(const char* config) const
{
bool install_name_is_rpath = false;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index e557e7f..47ed9ba 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -364,9 +364,6 @@ public:
std::string& base, std::string& suffix,
const char* config=0, bool implib = false) const;
- /** Get the name of the pdb file for the target. */
- std::string GetPDBName(const char* config=0) const;
-
/** Whether this library has \@rpath and platform supports it. */
bool HasMacOSXRpathInstallNameDir(const char* config) const;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c217692a8f19f7e509bee9a29e01722e4b43fdc3
commit c217692a8f19f7e509bee9a29e01722e4b43fdc3
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Nov 18 17:01:00 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:06 2014 +0100
Move HasSOName to cmGeneratorTarget.
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 0cd343b..cec88bd 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -786,7 +786,7 @@ cmExportFileGenerator
{
std::string prop;
std::string value;
- if(target->Target->HasSOName(config))
+ if(target->HasSOName(config))
{
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index d4d1e21..9e6719c 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -413,6 +413,18 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files) const
}
//----------------------------------------------------------------------------
+bool cmGeneratorTarget::HasSOName(const char* config) const
+{
+ // soname is supported only for shared libraries and modules,
+ // and then only when the platform supports an soname flag.
+ return ((this->GetType() == cmTarget::SHARED_LIBRARY ||
+ this->GetType() == cmTarget::MODULE_LIBRARY) &&
+ !this->GetPropertyAsBool("NO_SONAME") &&
+ this->Makefile->GetSONameFlag(this->Target->GetLinkerLanguage(config,
+ this->Target)));
+}
+
+//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetSOName(const char* config) const
{
if(this->Target->IsImported())
@@ -2311,7 +2323,7 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name,
// Check for library version properties.
const char* version = this->GetProperty("VERSION");
const char* soversion = this->GetProperty("SOVERSION");
- if(!this->Target->HasSOName(config) ||
+ if(!this->HasSOName(config) ||
this->Target->IsFrameworkOnApple())
{
// Versioning is supported only for shared libraries and modules,
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index c7d77ff..bb8c4ab 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -145,6 +145,9 @@ public:
/** Get sources that must be built before the given source. */
std::vector<cmSourceFile*> const* GetSourceDepends(cmSourceFile* sf) const;
+ /** Whether this library has soname enabled and platform supports it. */
+ bool HasSOName(const char* config) const;
+
struct TargetPropertyEntry {
TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge,
const std::string &targetName = std::string())
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 5efb5d0..9894eb9 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1856,7 +1856,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
const char* version = target.GetProperty("VERSION");
const char* soversion = target.GetProperty("SOVERSION");
- if(!target.HasSOName(configName) || target.IsFrameworkOnApple())
+ if(!gtgt->HasSOName(configName) || target.IsFrameworkOnApple())
{
version = 0;
soversion = 0;
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 6cda933..9cd1264 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -588,7 +588,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
vars.Target = targetOutPathReal.c_str();
vars.LinkLibraries = linkLibs.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.TargetSOName= targetNameSO.c_str();
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 1867d9e..ff65bbd 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -487,7 +487,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
} else {
vars["ARCH_FLAGS"] = flags;
}
- if (this->GetTarget()->HasSOName(this->GetConfigName())) {
+ if (this->GetGeneratorTarget()->HasSOName(this->GetConfigName())) {
vars["SONAME_FLAG"] =
this->GetMakefile()->GetSONameFlag(this->TargetLinkLanguage);
vars["SONAME"] = this->TargetNameSO;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d0e2cc4..3fca594 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2659,18 +2659,6 @@ std::string cmTarget::GetPDBName(const char* config) const
}
//----------------------------------------------------------------------------
-bool cmTarget::HasSOName(const char* config) const
-{
- // soname is supported only for shared libraries and modules,
- // and then only when the platform supports an soname flag.
- return ((this->GetType() == cmTarget::SHARED_LIBRARY ||
- this->GetType() == cmTarget::MODULE_LIBRARY) &&
- !this->GetPropertyAsBool("NO_SONAME") &&
- this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config,
- this)));
-}
-
-//----------------------------------------------------------------------------
bool cmTarget::HasMacOSXRpathInstallNameDir(const char* config) const
{
bool install_name_is_rpath = false;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 58875b5..e557e7f 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -367,9 +367,6 @@ public:
/** Get the name of the pdb file for the target. */
std::string GetPDBName(const char* config=0) const;
- /** Whether this library has soname enabled and platform supports it. */
- bool HasSOName(const char* config) const;
-
/** Whether this library has \@rpath and platform supports it. */
bool HasMacOSXRpathInstallNameDir(const char* config) const;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=76684b7ae4541f6040f91bab77bede1aa06bf75a
commit 76684b7ae4541f6040f91bab77bede1aa06bf75a
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 9 18:48:18 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:06 2014 +0100
Move GetLibraryNames to cmGeneratorTarget.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 47f2a13..d4d1e21 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -450,8 +450,8 @@ std::string cmGeneratorTarget::GetSOName(const char* config) const
std::string realName;
std::string impName;
std::string pdbName;
- this->Target->GetLibraryNames(name, soName, realName,
- impName, pdbName, config);
+ this->GetLibraryNames(name, soName, realName,
+ impName, pdbName, config);
return soName;
}
}
@@ -2157,7 +2157,7 @@ void cmGeneratorTarget::GenerateTargetManifest(const char* config) const
this->GetType() == cmTarget::SHARED_LIBRARY ||
this->GetType() == cmTarget::MODULE_LIBRARY)
{
- this->Target->GetLibraryNames(name, soName, realName, impName, pdbName,
+ this->GetLibraryNames(name, soName, realName, impName, pdbName,
config);
}
else
@@ -2282,13 +2282,100 @@ std::string cmGeneratorTarget::NormalGetRealName(const char* config) const
std::string realName;
std::string impName;
std::string pdbName;
- this->Target->GetLibraryNames(name, soName, realName,
- impName, pdbName, config);
+ this->GetLibraryNames(name, soName, realName,
+ impName, pdbName, config);
return realName;
}
}
//----------------------------------------------------------------------------
+void cmGeneratorTarget::GetLibraryNames(std::string& name,
+ std::string& soName,
+ std::string& realName,
+ std::string& impName,
+ std::string& pdbName,
+ const char* config) const
+{
+ // This should not be called for imported targets.
+ // TODO: Split cmTarget into a class hierarchy to get compile-time
+ // enforcement of the limited imported target API.
+ if(this->Target->IsImported())
+ {
+ std::string msg = "GetLibraryNames called on imported target: ";
+ msg += this->GetName();
+ this->Makefile->IssueMessage(cmake::INTERNAL_ERROR,
+ msg.c_str());
+ return;
+ }
+
+ // Check for library version properties.
+ const char* version = this->GetProperty("VERSION");
+ const char* soversion = this->GetProperty("SOVERSION");
+ if(!this->Target->HasSOName(config) ||
+ this->Target->IsFrameworkOnApple())
+ {
+ // Versioning is supported only for shared libraries and modules,
+ // and then only when the platform supports an soname flag.
+ version = 0;
+ soversion = 0;
+ }
+ if(version && !soversion)
+ {
+ // The soversion must be set if the library version is set. Use
+ // the library version as the soversion.
+ soversion = version;
+ }
+ if(!version && soversion)
+ {
+ // Use the soversion as the library version.
+ version = soversion;
+ }
+
+ // Get the components of the library name.
+ std::string prefix;
+ std::string base;
+ std::string suffix;
+ this->Target->GetFullNameInternal(config, false, prefix, base, suffix);
+
+ // The library name.
+ name = prefix+base+suffix;
+
+ if(this->Target->IsFrameworkOnApple())
+ {
+ realName = prefix;
+ realName += "Versions/";
+ realName += this->Target->GetFrameworkVersion();
+ realName += "/";
+ realName += base;
+ soName = realName;
+ }
+ else
+ {
+ // The library's soname.
+ this->Target->ComputeVersionedName(soName, prefix, base, suffix,
+ name, soversion);
+
+ // The library's real name on disk.
+ this->Target->ComputeVersionedName(realName, prefix, base, suffix,
+ name, version);
+ }
+
+ // The import library name.
+ if(this->GetType() == cmTarget::SHARED_LIBRARY ||
+ this->GetType() == cmTarget::MODULE_LIBRARY)
+ {
+ impName = this->Target->GetFullNameInternal(config, true);
+ }
+ else
+ {
+ impName = "";
+ }
+
+ // The program database file name.
+ pdbName = this->Target->GetPDBName(config);
+}
+
+//----------------------------------------------------------------------------
void cmGeneratorTarget::GetExecutableNames(std::string& name,
std::string& realName,
std::string& impName,
@@ -2350,7 +2437,6 @@ void cmGeneratorTarget::GetExecutableNames(std::string& name,
pdbName = this->Target->GetPDBName(config);
}
-
bool cmStrictTargetComparison::operator()(cmTarget const* t1,
cmTarget const* t2) const
{
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 6e8a00b..c7d77ff 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -170,6 +170,13 @@ public:
std::string& impName,
std::string& pdbName, const char* 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 char* config) const;
+
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index e7c1ebc..282443f 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -175,9 +175,11 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
std::string targetNameReal;
std::string targetNameImport;
std::string targetNamePDB;
- this->Target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
- targetNameImport, targetNamePDB,
- config);
+ this->CreateGeneratorTarget();
+ this->GeneratorTarget->GetLibraryNames(targetName, targetNameSO,
+ targetNameReal,
+ targetNameImport, targetNamePDB,
+ config);
if(this->ImportLibrary)
{
// There is a bug in cmInstallCommand if this fails.
@@ -377,7 +379,7 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
std::string targetNameReal;
std::string targetNameImport;
std::string targetNamePDB;
- target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
+ gtgt->GetLibraryNames(targetName, targetNameSO, targetNameReal,
targetNameImport, targetNamePDB, config);
if(nameType == NameImplib)
{
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index b8faa75..d3f8ed6 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1060,7 +1060,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
std::string targetNameFull;
std::string targetNameImport;
std::string targetNamePDB;
- target.GetLibraryNames(targetName, targetNameSO, targetNameFull,
+ gt->GetLibraryNames(targetName, targetNameSO, targetNameFull,
targetNameImport, targetNamePDB, configName);
// Compute the link library and directory information.
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index d6a0cd4..6cda933 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -27,7 +27,7 @@ cmMakefileLibraryTargetGenerator
this->CustomCommandDriver = OnDepends;
if (this->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
- this->Target->GetLibraryNames(
+ this->GeneratorTarget->GetLibraryNames(
this->TargetNameOut, this->TargetNameSO, this->TargetNameReal,
this->TargetNameImport, this->TargetNamePDB, this->ConfigName);
}
@@ -277,7 +277,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std::string targetNameReal;
std::string targetNameImport;
std::string targetNamePDB;
- this->Target->GetLibraryNames(
+ this->GeneratorTarget->GetLibraryNames(
targetName, targetNameSO, targetNameReal, targetNameImport, targetNamePDB,
this->ConfigName);
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 4b12449..1867d9e 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -46,7 +46,7 @@ cmNinjaNormalTargetGenerator(cmGeneratorTarget* target)
this->TargetNamePDB,
GetLocalGenerator()->GetConfigName());
else
- target->Target->GetLibraryNames(this->TargetNameOut,
+ this->GetGeneratorTarget()->GetLibraryNames(this->TargetNameOut,
this->TargetNameSO,
this->TargetNameReal,
this->TargetNameImport,
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 94443f9..d0e2cc4 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2990,94 +2990,6 @@ void cmTarget::GetFullNameInternal(const char* config,
}
//----------------------------------------------------------------------------
-void cmTarget::GetLibraryNames(std::string& name,
- std::string& soName,
- std::string& realName,
- std::string& impName,
- std::string& pdbName,
- const char* config) const
-{
- // This should not be called for imported targets.
- // TODO: Split cmTarget into a class hierarchy to get compile-time
- // enforcement of the limited imported target API.
- if(this->IsImported())
- {
- std::string msg = "GetLibraryNames called on imported target: ";
- msg += this->GetName();
- this->Makefile->IssueMessage(cmake::INTERNAL_ERROR,
- msg.c_str());
- return;
- }
-
- assert(this->GetType() != INTERFACE_LIBRARY);
-
- // Check for library version properties.
- const char* version = this->GetProperty("VERSION");
- const char* soversion = this->GetProperty("SOVERSION");
- if(!this->HasSOName(config) ||
- this->IsFrameworkOnApple())
- {
- // Versioning is supported only for shared libraries and modules,
- // and then only when the platform supports an soname flag.
- version = 0;
- soversion = 0;
- }
- if(version && !soversion)
- {
- // The soversion must be set if the library version is set. Use
- // the library version as the soversion.
- soversion = version;
- }
- if(!version && soversion)
- {
- // Use the soversion as the library version.
- version = soversion;
- }
-
- // Get the components of the library name.
- std::string prefix;
- std::string base;
- std::string suffix;
- this->GetFullNameInternal(config, false, prefix, base, suffix);
-
- // The library name.
- name = prefix+base+suffix;
-
- if(this->IsFrameworkOnApple())
- {
- realName = prefix;
- realName += "Versions/";
- realName += this->GetFrameworkVersion();
- realName += "/";
- realName += base;
- soName = realName;
- }
- else
- {
- // The library's soname.
- this->ComputeVersionedName(soName, prefix, base, suffix,
- name, soversion);
- // The library's real name on disk.
- this->ComputeVersionedName(realName, prefix, base, suffix,
- name, version);
- }
-
- // The import library name.
- if(this->GetType() == cmTarget::SHARED_LIBRARY ||
- this->GetType() == cmTarget::MODULE_LIBRARY)
- {
- impName = this->GetFullNameInternal(config, true);
- }
- else
- {
- impName = "";
- }
-
- // The program database file name.
- pdbName = this->GetPDBName(config);
-}
-
-//----------------------------------------------------------------------------
void cmTarget::ComputeVersionedName(std::string& vName,
std::string const& prefix,
std::string const& base,
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 9cf6f3d..58875b5 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -380,13 +380,6 @@ public:
no soname at all. */
bool IsImportedSharedLibWithoutSOName(const char* 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 char* config) const;
-
/** Does this target have a GNU implib to convert to MS format? */
bool HasImplibGNUtoMS() const;
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index b37f864..c35e92f 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1651,7 +1651,8 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
}
else
{
- this->Target->GetLibraryNames(targetName, targetNameSO, targetNameFull,
+ this->GeneratorTarget->GetLibraryNames(targetName, targetNameSO,
+ targetNameFull,
targetNameImport, targetNamePDB,
config.c_str());
}
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cf72a09bd763b2c7e02ee97b1b512f4c528acbdf
commit cf72a09bd763b2c7e02ee97b1b512f4c528acbdf
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 9 18:40:45 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:06 2014 +0100
Move GetExecutableNames to cmGeneratorTarget.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index f4ef701..47f2a13 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -2150,7 +2150,7 @@ void cmGeneratorTarget::GenerateTargetManifest(const char* config) const
std::string pdbName;
if(this->GetType() == cmTarget::EXECUTABLE)
{
- this->Target->GetExecutableNames(name, realName, impName, pdbName,
+ this->GetExecutableNames(name, realName, impName, pdbName,
config);
}
else if(this->GetType() == cmTarget::STATIC_LIBRARY ||
@@ -2271,7 +2271,7 @@ std::string cmGeneratorTarget::NormalGetRealName(const char* config) const
std::string realName;
std::string impName;
std::string pdbName;
- this->Target->GetExecutableNames(name, realName, impName, pdbName, config);
+ this->GetExecutableNames(name, realName, impName, pdbName, config);
return realName;
}
else
@@ -2288,6 +2288,69 @@ std::string cmGeneratorTarget::NormalGetRealName(const char* config) const
}
}
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::GetExecutableNames(std::string& name,
+ std::string& realName,
+ std::string& impName,
+ std::string& pdbName,
+ const char* config) const
+{
+ // This should not be called for imported targets.
+ // TODO: Split cmTarget into a class hierarchy to get compile-time
+ // enforcement of the limited imported target API.
+ if(this->Target->IsImported())
+ {
+ std::string msg =
+ "GetExecutableNames called on imported target: ";
+ msg += this->GetName();
+ this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, msg.c_str());
+ }
+
+ // This versioning is supported only for executables and then only
+ // when the platform supports symbolic links.
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ const char* version = 0;
+#else
+ // Check for executable version properties.
+ const char* version = this->GetProperty("VERSION");
+ if(this->GetType() != cmTarget::EXECUTABLE || this->Makefile->IsOn("XCODE"))
+ {
+ version = 0;
+ }
+#endif
+
+ // Get the components of the executable name.
+ std::string prefix;
+ std::string base;
+ std::string suffix;
+ this->Target->GetFullNameInternal(config, false, prefix, base, suffix);
+
+ // The executable name.
+ name = prefix+base+suffix;
+
+ // The executable's real name on disk.
+#if defined(__CYGWIN__)
+ realName = prefix+base;
+#else
+ realName = name;
+#endif
+ if(version)
+ {
+ realName += "-";
+ realName += version;
+ }
+#if defined(__CYGWIN__)
+ realName += suffix;
+#endif
+
+ // The import library name.
+ impName = this->Target->GetFullNameInternal(config, true);
+
+ // The program database file name.
+ pdbName = this->Target->GetPDBName(config);
+}
+
+
bool cmStrictTargetComparison::operator()(cmTarget const* t1,
cmTarget const* t2) const
{
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 00689e4..6e8a00b 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -163,6 +163,13 @@ public:
void GetAutoUicOptions(std::vector<std::string> &result,
const char *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 char* config) const;
+
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 6ed267d..e7c1ebc 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -114,7 +114,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
std::string targetNameReal;
std::string targetNameImport;
std::string targetNamePDB;
- this->Target->GetExecutableNames(targetName, targetNameReal,
+ this->CreateGeneratorTarget();
+ this->GeneratorTarget->GetExecutableNames(targetName, targetNameReal,
targetNameImport, targetNamePDB,
config);
if(this->ImportLibrary)
@@ -337,13 +338,16 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
{
std::string fname;
// Compute the name of the library.
+ cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
if(target->GetType() == cmTarget::EXECUTABLE)
{
std::string targetName;
std::string targetNameReal;
std::string targetNameImport;
std::string targetNamePDB;
- target->GetExecutableNames(targetName, targetNameReal,
+ gtgt->GetExecutableNames(targetName, targetNameReal,
targetNameImport, targetNamePDB,
config);
if(nameType == NameImplib)
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 6f85399..b8faa75 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1158,7 +1158,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
std::string targetNameFull;
std::string targetNameImport;
std::string targetNamePDB;
- target.GetExecutableNames(targetName, targetNameFull,
+ gt->GetExecutableNames(targetName, targetNameFull,
targetNameImport, targetNamePDB, configName);
// Compute the link library and directory information.
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 69b8092..738bd9a 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -25,7 +25,7 @@ cmMakefileExecutableTargetGenerator
cmMakefileTargetGenerator(target->Target)
{
this->CustomCommandDriver = OnDepends;
- this->Target->GetExecutableNames(
+ this->GeneratorTarget->GetExecutableNames(
this->TargetNameOut, this->TargetNameReal, this->TargetNameImport,
this->TargetNamePDB, this->ConfigName);
@@ -94,7 +94,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string targetNameReal;
std::string targetNameImport;
std::string targetNamePDB;
- this->Target->GetExecutableNames
+ this->GeneratorTarget->GetExecutableNames
(targetName, targetNameReal, targetNameImport, targetNamePDB,
this->ConfigName);
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 5c0eb91..4b12449 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -40,7 +40,7 @@ cmNinjaNormalTargetGenerator(cmGeneratorTarget* target)
this->TargetLinkLanguage = target->Target
->GetLinkerLanguage(this->GetConfigName());
if (target->GetType() == cmTarget::EXECUTABLE)
- target->Target->GetExecutableNames(this->TargetNameOut,
+ this->GetGeneratorTarget()->GetExecutableNames(this->TargetNameOut,
this->TargetNameReal,
this->TargetNameImport,
this->TargetNamePDB,
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 29a37ff..94443f9 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -3095,68 +3095,6 @@ void cmTarget::ComputeVersionedName(std::string& vName,
}
//----------------------------------------------------------------------------
-void cmTarget::GetExecutableNames(std::string& name,
- std::string& realName,
- std::string& impName,
- std::string& pdbName,
- const char* config) const
-{
- // This should not be called for imported targets.
- // TODO: Split cmTarget into a class hierarchy to get compile-time
- // enforcement of the limited imported target API.
- if(this->IsImported())
- {
- std::string msg =
- "GetExecutableNames called on imported target: ";
- msg += this->GetName();
- this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, msg.c_str());
- }
-
- // This versioning is supported only for executables and then only
- // when the platform supports symbolic links.
-#if defined(_WIN32) && !defined(__CYGWIN__)
- const char* version = 0;
-#else
- // Check for executable version properties.
- const char* version = this->GetProperty("VERSION");
- if(this->GetType() != cmTarget::EXECUTABLE || this->Makefile->IsOn("XCODE"))
- {
- version = 0;
- }
-#endif
-
- // Get the components of the executable name.
- std::string prefix;
- std::string base;
- std::string suffix;
- this->GetFullNameInternal(config, false, prefix, base, suffix);
-
- // The executable name.
- name = prefix+base+suffix;
-
- // The executable's real name on disk.
-#if defined(__CYGWIN__)
- realName = prefix+base;
-#else
- realName = name;
-#endif
- if(version)
- {
- realName += "-";
- realName += version;
- }
-#if defined(__CYGWIN__)
- realName += suffix;
-#endif
-
- // The import library name.
- impName = this->GetFullNameInternal(config, true);
-
- // The program database file name.
- pdbName = this->GetPDBName(config);
-}
-
-//----------------------------------------------------------------------------
bool cmTarget::HasImplibGNUtoMS() const
{
return this->HasImportLibrary() && this->GetPropertyAsBool("GNUtoMS");
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 249059a..9cf6f3d 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -387,13 +387,6 @@ public:
std::string& realName, std::string& impName,
std::string& pdbName, const char* 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 char* config) const;
-
/** Does this target have a GNU implib to convert to MS format? */
bool HasImplibGNUtoMS() const;
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 6eefd5c..b37f864 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1645,7 +1645,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
std::string targetNamePDB;
if(this->Target->GetType() == cmTarget::EXECUTABLE)
{
- this->Target->GetExecutableNames(targetName, targetNameFull,
+ this->GeneratorTarget->GetExecutableNames(targetName, targetNameFull,
targetNameImport, targetNamePDB,
config.c_str());
}
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=afcfb18bb8187d6e82a7b5f8d52fadf114d73943
commit afcfb18bb8187d6e82a7b5f8d52fadf114d73943
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Jun 13 21:56:07 2013 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:06 2014 +0100
Move GetLinkInformation to cmGeneratorTarget
This is a updated version of 4f5384e75c6a00d110d3fa3f555a3f6a4f31bb46
which was reverted in commit 0bbae6f95f55f23b758780f771bf4dd560ac2c07.
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 09522ea..75e1a51 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -26,6 +26,7 @@ cmExportBuildFileGenerator::cmExportBuildFileGenerator()
//----------------------------------------------------------------------------
bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
{
+ std::vector<cmGeneratorTarget*> allTargets;
{
std::string expectedTargets;
std::string sep;
@@ -67,7 +68,8 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
tei = this->Exports.begin();
tei != this->Exports.end(); ++tei)
{
- cmTarget* te = (*tei)->Target;
+ cmGeneratorTarget* gte = *tei;
+ cmTarget* te = gte->Target;
this->GenerateImportTargetCode(os, te);
te->AppendBuildInterfaceIncludes();
@@ -97,7 +99,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
cmGeneratorExpression::BuildInterface,
properties, missingTargets);
}
- this->PopulateCompatibleInterfaceProperties(te, properties);
+ this->PopulateCompatibleInterfaceProperties(gte, properties);
this->GenerateInterfaceProperties(te, os, properties);
}
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index a67356a..0cd343b 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -421,7 +421,7 @@ void getPropertyContents(cmTarget const* tgt, const char *prop,
}
//----------------------------------------------------------------------------
-void getCompatibleInterfaceProperties(cmTarget *target,
+void getCompatibleInterfaceProperties(cmGeneratorTarget *target,
std::set<std::string> &ifaceProperties,
const char *config)
{
@@ -429,11 +429,14 @@ void getCompatibleInterfaceProperties(cmTarget *target,
if (!info)
{
- cmMakefile* mf = target->GetMakefile();
- cmOStringStream e;
- e << "Exporting the target \"" << target->GetName() << "\" is not "
- "allowed since its linker language cannot be determined";
- mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
+ {
+ cmMakefile* mf = target->Target->GetMakefile();
+ cmOStringStream e;
+ e << "Exporting the target \"" << target->GetName() << "\" is not "
+ "allowed since its linker language cannot be determined";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
return;
}
@@ -464,9 +467,10 @@ void getCompatibleInterfaceProperties(cmTarget *target,
//----------------------------------------------------------------------------
void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
- cmTarget *target,
+ cmGeneratorTarget *gtarget,
ImportPropertyMap &properties)
{
+ cmTarget *target = gtarget->Target;
this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_BOOL",
target, properties);
this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_STRING",
@@ -487,7 +491,7 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
- getCompatibleInterfaceProperties(target, ifaceProperties, 0);
+ getCompatibleInterfaceProperties(gtarget, ifaceProperties, 0);
std::vector<std::string> configNames;
target->GetMakefile()->GetConfigurations(configNames);
@@ -495,7 +499,7 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
for (std::vector<std::string>::const_iterator ci = configNames.begin();
ci != configNames.end(); ++ci)
{
- getCompatibleInterfaceProperties(target, ifaceProperties, ci->c_str());
+ getCompatibleInterfaceProperties(gtarget, ifaceProperties, ci->c_str());
}
}
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index b0a382c..a7d9658 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -114,7 +114,7 @@ protected:
std::vector<std::string> &missingTargets);
void PopulateInterfaceProperty(const char *propName, cmTarget *target,
ImportPropertyMap &properties);
- void PopulateCompatibleInterfaceProperties(cmTarget *target,
+ void PopulateCompatibleInterfaceProperties(cmGeneratorTarget *target,
ImportPropertyMap &properties);
void GenerateInterfaceProperties(cmTarget const* target, std::ostream& os,
const ImportPropertyMap &properties);
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index da13a21..79f74dd 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -169,7 +169,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
}
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
te, properties);
- this->PopulateCompatibleInterfaceProperties(te, properties);
+ cmGeneratorTarget *gtgt = te->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(te);
+
+ this->PopulateCompatibleInterfaceProperties(gtgt, properties);
this->GenerateInterfaceProperties(te, os, properties);
}
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 4bc3312..d21ea9c 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -16,6 +16,9 @@
#include "cmGeneratorExpressionDAGChecker.h"
#include "cmGeneratorExpression.h"
+#include "cmLocalGenerator.h"
+#include "cmGlobalGenerator.h"
+
#include <cmsys/String.h>
#include <assert.h>
@@ -1058,6 +1061,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
cmTarget const* headTarget = context->HeadTarget
? context->HeadTarget : target;
+ cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
+
const char * const *transBegin =
cmArrayBegin(targetPropertyTransitiveWhitelist) + 1;
const char * const *transEnd =
@@ -1105,40 +1112,40 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
{
return linkedTargetsContent;
}
- if (target->IsLinkInterfaceDependentBoolProperty(propertyName,
+ if (gtgt->IsLinkInterfaceDependentBoolProperty(propertyName,
context->Config))
{
context->HadContextSensitiveCondition = true;
- return target->GetLinkInterfaceDependentBoolProperty(
+ return gtgt->GetLinkInterfaceDependentBoolProperty(
propertyName,
context->Config) ? "1" : "0";
}
- if (target->IsLinkInterfaceDependentStringProperty(propertyName,
+ if (gtgt->IsLinkInterfaceDependentStringProperty(propertyName,
context->Config))
{
context->HadContextSensitiveCondition = true;
const char *propContent =
- target->GetLinkInterfaceDependentStringProperty(
+ gtgt->GetLinkInterfaceDependentStringProperty(
propertyName,
context->Config);
return propContent ? propContent : "";
}
- if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName,
+ if (gtgt->IsLinkInterfaceDependentNumberMinProperty(propertyName,
context->Config))
{
context->HadContextSensitiveCondition = true;
const char *propContent =
- target->GetLinkInterfaceDependentNumberMinProperty(
+ gtgt->GetLinkInterfaceDependentNumberMinProperty(
propertyName,
context->Config);
return propContent ? propContent : "";
}
- if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName,
+ if (gtgt->IsLinkInterfaceDependentNumberMaxProperty(propertyName,
context->Config))
{
context->HadContextSensitiveCondition = true;
const char *propContent =
- target->GetLinkInterfaceDependentNumberMaxProperty(
+ gtgt->GetLinkInterfaceDependentNumberMaxProperty(
propertyName,
context->Config);
return propContent ? propContent : "";
@@ -1147,25 +1154,25 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
return linkedTargetsContent;
}
- if (!target->IsImported()
+ if (!gtgt->IsImported()
&& dagCheckerParent && !dagCheckerParent->EvaluatingLinkLibraries())
{
- if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName,
+ if (gtgt->IsLinkInterfaceDependentNumberMinProperty(propertyName,
context->Config))
{
context->HadContextSensitiveCondition = true;
const char *propContent =
- target->GetLinkInterfaceDependentNumberMinProperty(
+ gtgt->GetLinkInterfaceDependentNumberMinProperty(
propertyName,
context->Config);
return propContent ? propContent : "";
}
- if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName,
+ if (gtgt->IsLinkInterfaceDependentNumberMaxProperty(propertyName,
context->Config))
{
context->HadContextSensitiveCondition = true;
const char *propContent =
- target->GetLinkInterfaceDependentNumberMaxProperty(
+ gtgt->GetLinkInterfaceDependentNumberMaxProperty(
propertyName,
context->Config);
return propContent ? propContent : "";
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 62f3fe0..f4ef701 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -14,6 +14,7 @@
#include "cmTarget.h"
#include "cmMakefile.h"
#include "cmLocalGenerator.h"
+#include "cmComputeLinkInformation.h"
#include "cmGlobalGenerator.h"
#include "cmSourceFile.h"
#include "cmGeneratorExpression.h"
@@ -21,6 +22,31 @@
#include "cmComputeLinkInformation.h"
#include <queue>
+#include <assert.h>
+#include <errno.h>
+
+//----------------------------------------------------------------------------
+cmTargetLinkInformationMap
+::cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r): derived()
+{
+ // Ideally cmTarget instances should never be copied. However until
+ // we can make a sweep to remove that, this copy constructor avoids
+ // allowing the resources (LinkInformation) from getting copied. In
+ // the worst case this will lead to extra cmComputeLinkInformation
+ // instances. We also enforce in debug mode that the map be emptied
+ // when copied.
+ static_cast<void>(r);
+ assert(r.empty());
+}
+
+//----------------------------------------------------------------------------
+cmTargetLinkInformationMap::~cmTargetLinkInformationMap()
+{
+ for(derived::iterator i = this->begin(); i != this->end(); ++i)
+ {
+ delete i->second;
+ }
+}
#include "assert.h"
@@ -65,6 +91,14 @@ void deleteAndClear2(
cmGeneratorTarget::~cmGeneratorTarget()
{
deleteAndClear2(this->CachedLinkInterfaceIncludeDirectoriesEntries);
+
+ for (cmTargetLinkInformationMap::const_iterator it
+ = this->LinkInformation.begin();
+ it != this->LinkInformation.end(); ++it)
+ {
+ delete it->second;
+ }
+ this->LinkInformation.clear();
}
//----------------------------------------------------------------------------
@@ -593,12 +627,868 @@ cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs) const
}
//----------------------------------------------------------------------------
+template<typename PropertyType>
+PropertyType getTypedProperty(cmTarget const* tgt, const char *prop,
+ PropertyType *);
+
+//----------------------------------------------------------------------------
+template<>
+bool getTypedProperty<bool>(cmTarget const* tgt, const char *prop, bool *)
+{
+ return tgt->GetPropertyAsBool(prop);
+}
+
+//----------------------------------------------------------------------------
+template<>
+const char *getTypedProperty<const char *>(cmTarget const* tgt,
+ const char *prop,
+ const char **)
+{
+ return tgt->GetProperty(prop);
+}
+
+enum CompatibleType
+{
+ BoolType,
+ StringType,
+ NumberMinType,
+ NumberMaxType
+};
+
+//----------------------------------------------------------------------------
+template<typename PropertyType>
+std::pair<bool, PropertyType> consistentProperty(PropertyType lhs,
+ PropertyType rhs,
+ CompatibleType t);
+
+//----------------------------------------------------------------------------
+template<>
+std::pair<bool, bool> consistentProperty(bool lhs, bool rhs, CompatibleType)
+{
+ return std::make_pair(lhs == rhs, lhs);
+}
+
+//----------------------------------------------------------------------------
+std::pair<bool, const char*> consistentStringProperty(const char *lhs,
+ const char *rhs)
+{
+ const bool b = strcmp(lhs, rhs) == 0;
+ return std::make_pair(b, b ? lhs : 0);
+}
+
+#if defined(_MSC_VER) && _MSC_VER <= 1200
+template<typename T> const T&
+cmMaximum(const T& l, const T& r) {return l > r ? l : r;}
+template<typename T> const T&
+cmMinimum(const T& l, const T& r) {return l < r ? l : r;}
+#else
+#define cmMinimum std::min
+#define cmMaximum std::max
+#endif
+
+//----------------------------------------------------------------------------
+std::pair<bool, const char*> consistentNumberProperty(const char *lhs,
+ const char *rhs,
+ CompatibleType t)
+{
+ char *pEnd;
+
+#if defined(_MSC_VER)
+ static const char* const null_ptr = 0;
+#else
+# define null_ptr 0
+#endif
+
+ long lnum = strtol(lhs, &pEnd, 0);
+ if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE)
+ {
+ return std::pair<bool, const char*>(false, null_ptr);
+ }
+
+ long rnum = strtol(rhs, &pEnd, 0);
+ if (pEnd == rhs || *pEnd != '\0' || errno == ERANGE)
+ {
+ return std::pair<bool, const char*>(false, null_ptr);
+ }
+
+#if !defined(_MSC_VER)
+#undef null_ptr
+#endif
+
+ if (t == NumberMaxType)
+ {
+ return std::make_pair(true, cmMaximum(lnum, rnum) == lnum ? lhs : rhs);
+ }
+ else
+ {
+ return std::make_pair(true, cmMinimum(lnum, rnum) == lnum ? lhs : rhs);
+ }
+}
+
+//----------------------------------------------------------------------------
+template<>
+std::pair<bool, const char*> consistentProperty(const char *lhs,
+ const char *rhs,
+ CompatibleType t)
+{
+ if (!lhs && !rhs)
+ {
+ return std::make_pair(true, lhs);
+ }
+ if (!lhs)
+ {
+ return std::make_pair(true, rhs);
+ }
+ if (!rhs)
+ {
+ return std::make_pair(true, lhs);
+ }
+
+#if defined(_MSC_VER)
+ static const char* const null_ptr = 0;
+#else
+# define null_ptr 0
+#endif
+
+ switch(t)
+ {
+ case BoolType:
+ assert(!"consistentProperty for strings called with BoolType");
+ return std::pair<bool, const char*>(false, null_ptr);
+ case StringType:
+ return consistentStringProperty(lhs, rhs);
+ case NumberMinType:
+ case NumberMaxType:
+ return consistentNumberProperty(lhs, rhs, t);
+ }
+ assert(!"Unreachable!");
+ return std::pair<bool, const char*>(false, null_ptr);
+
+#if !defined(_MSC_VER)
+#undef null_ptr
+#endif
+
+}
+
+template<typename PropertyType>
+PropertyType impliedValue(PropertyType);
+template<>
+bool impliedValue<bool>(bool)
+{
+ return false;
+}
+
+template<>
+const char* impliedValue<const char*>(const char*)
+{
+ return "";
+}
+
+template<typename PropertyType>
+std::string valueAsString(PropertyType);
+template<>
+std::string valueAsString<bool>(bool value)
+{
+ return value ? "TRUE" : "FALSE";
+}
+template<>
+std::string valueAsString<const char*>(const char* value)
+{
+ return value ? value : "(unset)";
+}
+
+//----------------------------------------------------------------------------
+void
+cmGeneratorTarget::ReportPropertyOrigin(const std::string &p,
+ const std::string &result,
+ const std::string &report,
+ const std::string &compatibilityType) const
+{
+ std::vector<std::string> debugProperties;
+ const char *debugProp =
+ this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
+ if (debugProp)
+ {
+ cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ }
+
+ bool debugOrigin = !this->DebugCompatiblePropertiesDone[p]
+ && std::find(debugProperties.begin(),
+ debugProperties.end(),
+ p)
+ != debugProperties.end();
+
+ if (this->Makefile->IsGeneratingBuildSystem())
+ {
+ this->DebugCompatiblePropertiesDone[p] = true;
+ }
+ if (!debugOrigin)
+ {
+ return;
+ }
+
+ std::string areport = compatibilityType;
+ areport += std::string(" of property \"") + p + "\" for target \"";
+ areport += std::string(this->GetName());
+ areport += "\" (result: \"";
+ areport += result;
+ areport += "\"):\n" + report;
+
+ cmListFileBacktrace lfbt;
+ this->Makefile->GetCMakeInstance()->IssueMessage(cmake::LOG, areport, lfbt);
+}
+
+//----------------------------------------------------------------------------
+std::string compatibilityType(CompatibleType t)
+{
+ switch(t)
+ {
+ case BoolType:
+ return "Boolean compatibility";
+ case StringType:
+ return "String compatibility";
+ case NumberMaxType:
+ return "Numeric maximum compatibility";
+ case NumberMinType:
+ return "Numeric minimum compatibility";
+ }
+ assert(!"Unreachable!");
+ return "";
+}
+
+//----------------------------------------------------------------------------
+std::string compatibilityAgree(CompatibleType t, bool dominant)
+{
+ switch(t)
+ {
+ case BoolType:
+ case StringType:
+ return dominant ? "(Disagree)\n" : "(Agree)\n";
+ case NumberMaxType:
+ case NumberMinType:
+ return dominant ? "(Dominant)\n" : "(Ignored)\n";
+ }
+ assert(!"Unreachable!");
+ return "";
+}
+
+//----------------------------------------------------------------------------
+template<typename PropertyType>
+PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
+ const std::string &p,
+ const char *config,
+ const char *defaultValue,
+ CompatibleType t,
+ PropertyType *)
+{
+ PropertyType propContent = getTypedProperty<PropertyType>(tgt->Target,
+ p.c_str(),
+ 0);
+ const bool explicitlySet = tgt->Target->GetProperties()
+ .find(p.c_str())
+ != tgt->Target->GetProperties().end();
+ const bool impliedByUse =
+ tgt->Target->IsNullImpliedByLinkLibraries(p);
+ assert((impliedByUse ^ explicitlySet)
+ || (!impliedByUse && !explicitlySet));
+
+ cmComputeLinkInformation *info = tgt->GetLinkInformation(config);
+ if(!info)
+ {
+ return propContent;
+ }
+ const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
+ bool propInitialized = explicitlySet;
+
+ std::string report = " * Target \"";
+ report += tgt->GetName();
+ if (explicitlySet)
+ {
+ report += "\" has property content \"";
+ report += valueAsString<PropertyType>(propContent);
+ report += "\"\n";
+ }
+ else if (impliedByUse)
+ {
+ report += "\" property is implied by use.\n";
+ }
+ else
+ {
+ report += "\" property not set.\n";
+ }
+
+ for(cmComputeLinkInformation::ItemVector::const_iterator li =
+ deps.begin();
+ li != deps.end(); ++li)
+ {
+ // An error should be reported if one dependency
+ // has INTERFACE_POSITION_INDEPENDENT_CODE ON and the other
+ // has INTERFACE_POSITION_INDEPENDENT_CODE OFF, or if the
+ // target itself has a POSITION_INDEPENDENT_CODE which disagrees
+ // with a dependency.
+
+ if (!li->Target)
+ {
+ continue;
+ }
+
+ const bool ifaceIsSet = li->Target->GetProperties()
+ .find("INTERFACE_" + p)
+ != li->Target->GetProperties().end();
+ PropertyType ifacePropContent =
+ getTypedProperty<PropertyType>(li->Target,
+ ("INTERFACE_" + p).c_str(), 0);
+
+ std::string reportEntry;
+ if (ifaceIsSet)
+ {
+ reportEntry += " * Target \"";
+ reportEntry += li->Target->GetName();
+ reportEntry += "\" property value \"";
+ reportEntry += valueAsString<PropertyType>(ifacePropContent);
+ reportEntry += "\" ";
+ }
+
+ if (explicitlySet)
+ {
+ if (ifaceIsSet)
+ {
+ std::pair<bool, PropertyType> consistent =
+ consistentProperty(propContent,
+ ifacePropContent, t);
+ report += reportEntry;
+ report += compatibilityAgree(t, propContent != consistent.second);
+ if (!consistent.first)
+ {
+ cmOStringStream e;
+ e << "Property " << p << " on target \""
+ << tgt->GetName() << "\" does\nnot match the "
+ "INTERFACE_" << p << " property requirement\nof "
+ "dependency \"" << li->Target->GetName() << "\".\n";
+ cmSystemTools::Error(e.str().c_str());
+ break;
+ }
+ else
+ {
+ propContent = consistent.second;
+ continue;
+ }
+ }
+ else
+ {
+ // Explicitly set on target and not set in iface. Can't disagree.
+ continue;
+ }
+ }
+ else if (impliedByUse)
+ {
+ propContent = impliedValue<PropertyType>(propContent);
+
+ if (ifaceIsSet)
+ {
+ std::pair<bool, PropertyType> consistent =
+ consistentProperty(propContent,
+ ifacePropContent, t);
+ report += reportEntry;
+ report += compatibilityAgree(t, propContent != consistent.second);
+ if (!consistent.first)
+ {
+ cmOStringStream e;
+ e << "Property " << p << " on target \""
+ << tgt->GetName() << "\" is\nimplied to be " << defaultValue
+ << " because it was used to determine the link libraries\n"
+ "already. The INTERFACE_" << p << " property on\ndependency \""
+ << li->Target->GetName() << "\" is in conflict.\n";
+ cmSystemTools::Error(e.str().c_str());
+ break;
+ }
+ else
+ {
+ propContent = consistent.second;
+ continue;
+ }
+ }
+ else
+ {
+ // Implicitly set on target and not set in iface. Can't disagree.
+ continue;
+ }
+ }
+ else
+ {
+ if (ifaceIsSet)
+ {
+ if (propInitialized)
+ {
+ std::pair<bool, PropertyType> consistent =
+ consistentProperty(propContent,
+ ifacePropContent, t);
+ report += reportEntry;
+ report += compatibilityAgree(t, propContent != consistent.second);
+ if (!consistent.first)
+ {
+ cmOStringStream e;
+ e << "The INTERFACE_" << p << " property of \""
+ << li->Target->GetName() << "\" does\nnot agree with the value "
+ "of " << p << " already determined\nfor \""
+ << tgt->GetName() << "\".\n";
+ cmSystemTools::Error(e.str().c_str());
+ break;
+ }
+ else
+ {
+ propContent = consistent.second;
+ continue;
+ }
+ }
+ else
+ {
+ report += reportEntry + "(Interface set)\n";
+ propContent = ifacePropContent;
+ propInitialized = true;
+ }
+ }
+ else
+ {
+ // Not set. Nothing to agree on.
+ continue;
+ }
+ }
+ }
+
+ tgt->ReportPropertyOrigin(p, valueAsString<PropertyType>(propContent),
+ report, compatibilityType(t));
+ return propContent;
+}
+
+//----------------------------------------------------------------------------
+bool
+cmGeneratorTarget::GetLinkInterfaceDependentBoolProperty(const std::string &p,
+ const char *config) const
+{
+ return checkInterfacePropertyCompatibility<bool>(this, p, config, "FALSE",
+ BoolType, 0);
+}
+
+//----------------------------------------------------------------------------
+const char * cmGeneratorTarget::GetLinkInterfaceDependentStringProperty(
+ const std::string &p,
+ const char *config) const
+{
+ return checkInterfacePropertyCompatibility<const char *>(this,
+ p,
+ config,
+ "empty",
+ StringType, 0);
+}
+
+//----------------------------------------------------------------------------
+const char * cmGeneratorTarget::GetLinkInterfaceDependentNumberMinProperty(
+ const std::string &p,
+ const char *config) const
+{
+ return checkInterfacePropertyCompatibility<const char *>(this,
+ p,
+ config,
+ "empty",
+ NumberMinType, 0);
+}
+
+//----------------------------------------------------------------------------
+const char * cmGeneratorTarget::GetLinkInterfaceDependentNumberMaxProperty(
+ const std::string &p,
+ const char *config) const
+{
+ return checkInterfacePropertyCompatibility<const char *>(this,
+ p,
+ config,
+ "empty",
+ NumberMaxType, 0);
+}
+
+//----------------------------------------------------------------------------
+bool isLinkDependentProperty(cmGeneratorTarget const* tgt,
+ const std::string &p,
+ const char *interfaceProperty,
+ const char *config)
+{
+ cmComputeLinkInformation *info = tgt->GetLinkInformation(config);
+ if(!info)
+ {
+ return false;
+ }
+
+ const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
+
+ for(cmComputeLinkInformation::ItemVector::const_iterator li =
+ deps.begin();
+ li != deps.end(); ++li)
+ {
+ if (!li->Target)
+ {
+ continue;
+ }
+ const char *prop = li->Target->GetProperty(interfaceProperty);
+ if (!prop)
+ {
+ continue;
+ }
+
+ std::vector<std::string> props;
+ cmSystemTools::ExpandListArgument(prop, props);
+
+ for(std::vector<std::string>::iterator pi = props.begin();
+ pi != props.end(); ++pi)
+ {
+ if (*pi == p)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+//----------------------------------------------------------------------------
+bool
+cmGeneratorTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p,
+ const char *config) const
+{
+ if (this->GetType() == cmTarget::OBJECT_LIBRARY
+ || this->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ return false;
+ }
+ return (p == "POSITION_INDEPENDENT_CODE") ||
+ isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_BOOL",
+ config);
+}
+
+//----------------------------------------------------------------------------
+bool
+cmGeneratorTarget::IsLinkInterfaceDependentStringProperty(const std::string &p,
+ const char *config) const
+{
+ if (this->GetType() == cmTarget::OBJECT_LIBRARY
+ || this->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ return false;
+ }
+ return isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_STRING",
+ config);
+}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMinProperty(
+ const std::string &p,
+ const char *config) const
+{
+ if (this->GetType() == cmTarget::OBJECT_LIBRARY
+ || this->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ return false;
+ }
+ return isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_NUMBER_MIN",
+ config);
+}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMaxProperty(
+ const std::string &p,
+ const char *config) const
+{
+ if (this->GetType() == cmTarget::OBJECT_LIBRARY
+ || this->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ return false;
+ }
+ return isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_NUMBER_MAX",
+ config);
+}
+
+template<typename PropertyType>
+PropertyType getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
+ const std::string prop,
+ const char *config,
+ CompatibleType,
+ PropertyType *);
+
+template<>
+bool getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
+ const std::string prop,
+ const char *config,
+ CompatibleType, bool *)
+{
+ return tgt->GetLinkInterfaceDependentBoolProperty(prop, config);
+}
+
+template<>
+const char * getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
+ const std::string prop,
+ const char *config,
+ CompatibleType t,
+ const char **)
+{
+ switch(t)
+ {
+ case BoolType:
+ assert(!"String compatibility check function called for boolean");
+ return 0;
+ case StringType:
+ return tgt->GetLinkInterfaceDependentStringProperty(prop, config);
+ case NumberMinType:
+ return tgt->GetLinkInterfaceDependentNumberMinProperty(prop, config);
+ case NumberMaxType:
+ return tgt->GetLinkInterfaceDependentNumberMaxProperty(prop, config);
+ }
+ assert(!"Unreachable!");
+ return 0;
+}
+
+//----------------------------------------------------------------------------
+template<typename PropertyType>
+void checkPropertyConsistency(cmGeneratorTarget const* depender,
+ cmTarget const* dependee,
+ const char *propName,
+ std::set<cmStdString> &emitted,
+ const char *config,
+ CompatibleType t,
+ PropertyType *)
+{
+ const char *prop = dependee->GetProperty(propName);
+ if (!prop)
+ {
+ return;
+ }
+
+ std::vector<std::string> props;
+ cmSystemTools::ExpandListArgument(prop, props);
+ std::string pdir =
+ dependee->GetMakefile()->GetRequiredDefinition("CMAKE_ROOT");
+ pdir += "/Help/prop_tgt/";
+
+ for(std::vector<std::string>::iterator pi = props.begin();
+ pi != props.end(); ++pi)
+ {
+ std::string pname = cmSystemTools::HelpFileName(*pi);
+ std::string pfile = pdir + pname + ".rst";
+ if(cmSystemTools::FileExists(pfile.c_str(), true))
+ {
+ cmOStringStream e;
+ e << "Target \"" << dependee->GetName() << "\" has property \""
+ << *pi << "\" listed in its " << propName << " property. "
+ "This is not allowed. Only user-defined properties may appear "
+ "listed in the " << propName << " property.";
+ depender->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return;
+ }
+ if(emitted.insert(*pi).second)
+ {
+ getLinkInterfaceDependentProperty<PropertyType>(depender, *pi, config,
+ t, 0);
+ if (cmSystemTools::GetErrorOccuredFlag())
+ {
+ return;
+ }
+ }
+ }
+}
+
+cmMakefile* cmGeneratorTarget::GetMakefile() const
+{
+ return this->Target->GetMakefile();
+}
+
+static cmStdString intersect(const std::set<cmStdString> &s1,
+ const std::set<cmStdString> &s2)
+{
+ std::set<cmStdString> intersect;
+ std::set_intersection(s1.begin(),s1.end(),
+ s2.begin(),s2.end(),
+ std::inserter(intersect,intersect.begin()));
+ if (!intersect.empty())
+ {
+ return *intersect.begin();
+ }
+ return "";
+}
+static cmStdString intersect(const std::set<cmStdString> &s1,
+ const std::set<cmStdString> &s2,
+ const std::set<cmStdString> &s3)
+{
+ cmStdString result;
+ result = intersect(s1, s2);
+ if (!result.empty())
+ return result;
+ result = intersect(s1, s3);
+ if (!result.empty())
+ return result;
+ return intersect(s2, s3);
+}
+static cmStdString intersect(const std::set<cmStdString> &s1,
+ const std::set<cmStdString> &s2,
+ const std::set<cmStdString> &s3,
+ const std::set<cmStdString> &s4)
+{
+ cmStdString result;
+ result = intersect(s1, s2);
+ if (!result.empty())
+ return result;
+ result = intersect(s1, s3);
+ if (!result.empty())
+ return result;
+ result = intersect(s1, s4);
+ if (!result.empty())
+ return result;
+ return intersect(s2, s3, s4);
+}
+
+//----------------------------------------------------------------------------
+void
+cmGeneratorTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
+ const char* config) const
+{
+ const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
+
+ std::set<cmStdString> emittedBools;
+ std::set<cmStdString> emittedStrings;
+ std::set<cmStdString> emittedMinNumbers;
+ std::set<cmStdString> emittedMaxNumbers;
+
+ for(cmComputeLinkInformation::ItemVector::const_iterator li =
+ deps.begin();
+ li != deps.end(); ++li)
+ {
+ if (!li->Target)
+ {
+ continue;
+ }
+
+ checkPropertyConsistency<bool>(this, li->Target,
+ "COMPATIBLE_INTERFACE_BOOL",
+ emittedBools, config, BoolType, 0);
+ if (cmSystemTools::GetErrorOccuredFlag())
+ {
+ return;
+ }
+ checkPropertyConsistency<const char *>(this, li->Target,
+ "COMPATIBLE_INTERFACE_STRING",
+ emittedStrings, config,
+ StringType, 0);
+ if (cmSystemTools::GetErrorOccuredFlag())
+ {
+ return;
+ }
+ checkPropertyConsistency<const char *>(this, li->Target,
+ "COMPATIBLE_INTERFACE_NUMBER_MIN",
+ emittedMinNumbers, config,
+ NumberMinType, 0);
+ if (cmSystemTools::GetErrorOccuredFlag())
+ {
+ return;
+ }
+ checkPropertyConsistency<const char *>(this, li->Target,
+ "COMPATIBLE_INTERFACE_NUMBER_MAX",
+ emittedMaxNumbers, config,
+ NumberMaxType, 0);
+ if (cmSystemTools::GetErrorOccuredFlag())
+ {
+ return;
+ }
+ }
+
+ std::string prop = intersect(emittedBools,
+ emittedStrings,
+ emittedMinNumbers,
+ emittedMaxNumbers);
+
+ if (!prop.empty())
+ {
+ std::set<std::string> props;
+ std::set<cmStdString>::const_iterator i = emittedBools.find(prop);
+ if (i != emittedBools.end())
+ {
+ props.insert("COMPATIBLE_INTERFACE_BOOL");
+ }
+ i = emittedStrings.find(prop);
+ if (i != emittedStrings.end())
+ {
+ props.insert("COMPATIBLE_INTERFACE_STRING");
+ }
+ i = emittedMinNumbers.find(prop);
+ if (i != emittedMinNumbers.end())
+ {
+ props.insert("COMPATIBLE_INTERFACE_NUMBER_MIN");
+ }
+ i = emittedMaxNumbers.find(prop);
+ if (i != emittedMaxNumbers.end())
+ {
+ props.insert("COMPATIBLE_INTERFACE_NUMBER_MAX");
+ }
+
+ std::string propsString = *props.begin();
+ props.erase(props.begin());
+ while (props.size() > 1)
+ {
+ propsString += ", " + *props.begin();
+ props.erase(props.begin());
+ }
+ if (props.size() == 1)
+ {
+ propsString += " and the " + *props.begin();
+ }
+ cmOStringStream e;
+ e << "Property \"" << prop << "\" appears in both the "
+ << propsString <<
+ " property in the dependencies of target \"" << this->GetName() <<
+ "\". This is not allowed. A property may only require compatibility "
+ "in a boolean interpretation, a numeric minimum, a numeric maximum or a "
+ "string interpretation, but not a mixture.";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
+}
+
+//----------------------------------------------------------------------------
+cmComputeLinkInformation*
+cmGeneratorTarget::GetLinkInformation(const char* config,
+ cmTarget const* head) const
+{
+ cmTarget const* headTarget = head ? head : this->Target;
+ // Lookup any existing information for this configuration.
+ TargetConfigPair key(headTarget,
+ cmSystemTools::UpperCase(config?config:""));
+ cmTargetLinkInformationMap::iterator
+ i = this->LinkInformation.find(key);
+ if(i == this->LinkInformation.end())
+ {
+ // Compute information for this configuration.
+ cmComputeLinkInformation* info =
+ new cmComputeLinkInformation(this->Target, config, headTarget);
+ if(!info || !info->Compute())
+ {
+ delete info;
+ info = 0;
+ }
+
+ // Store the information for this configuration.
+ cmTargetLinkInformationMap::value_type entry(key, info);
+ i = this->LinkInformation.insert(entry).first;
+
+ if (info)
+ {
+ this->CheckPropertyCompatibility(info, config);
+ }
+ }
+ return i->second;
+}
+
+//----------------------------------------------------------------------------
void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string> &result,
const char *config) const
{
const char *prop
- = this->Target->
- GetLinkInterfaceDependentStringProperty("AUTOUIC_OPTIONS",
+ = this->GetLinkInterfaceDependentStringProperty("AUTOUIC_OPTIONS",
config);
if (!prop)
{
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index fcf936e..00689e4 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -15,6 +15,7 @@
#include "cmStandardIncludes.h"
#include "cmGeneratorExpression.h"
+class cmComputeLinkInformation;
class cmCustomCommand;
class cmGlobalGenerator;
class cmLocalGenerator;
@@ -22,11 +23,21 @@ class cmMakefile;
class cmSourceFile;
class cmTarget;
+struct cmTargetLinkInformationMap:
+ public std::map<std::pair<cmTarget const*, std::string>,
+ cmComputeLinkInformation*>
+{
+ typedef std::map<std::pair<cmTarget const*, std::string>,
+ cmComputeLinkInformation*> derived;
+ cmTargetLinkInformationMap() {}
+ cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r);
+ ~cmTargetLinkInformationMap();
+};
+
class cmGeneratorTarget
{
public:
cmGeneratorTarget(cmTarget*);
-
~cmGeneratorTarget();
bool IsImported() const;
@@ -79,6 +90,34 @@ public:
void UseObjectLibraries(std::vector<std::string>& objs) const;
+ mutable cmTargetLinkInformationMap LinkInformation;
+
+ cmComputeLinkInformation* GetLinkInformation(const char* config,
+ cmTarget const* head = 0) const;
+
+ bool IsLinkInterfaceDependentBoolProperty(const std::string &p,
+ const char *config) const;
+ bool IsLinkInterfaceDependentStringProperty(const std::string &p,
+ const char *config) const;
+ bool IsLinkInterfaceDependentNumberMinProperty(const std::string &p,
+ const char *config) const;
+ bool IsLinkInterfaceDependentNumberMaxProperty(const std::string &p,
+ const char *config) const;
+
+ bool GetLinkInterfaceDependentBoolProperty(const std::string &p,
+ const char *config) const;
+ const char *GetLinkInterfaceDependentStringProperty(const std::string &p,
+ const char *config) const;
+ const char *GetLinkInterfaceDependentNumberMinProperty(const std::string &p,
+ const char *config) const;
+ const char *GetLinkInterfaceDependentNumberMaxProperty(const std::string &p,
+ const char *config) const;
+
+ void CheckPropertyCompatibility(cmComputeLinkInformation *info,
+ const char* config) const;
+
+ cmMakefile* GetMakefile() const;
+
void GetAppleArchs(const char* config,
std::vector<std::string>& archVec) const;
@@ -116,6 +155,11 @@ public:
const std::string TargetName;
};
+ void ReportPropertyOrigin(const std::string &p,
+ const std::string &result,
+ const std::string &report,
+ const std::string &compatibilityType) const;
+
void GetAutoUicOptions(std::vector<std::string> &result,
const char *config) const;
@@ -140,6 +184,7 @@ private:
mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
CachedLinkInterfaceIncludeDirectoriesEntries;
mutable std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
+ mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
cmGeneratorTarget(cmGeneratorTarget const&);
void operator=(cmGeneratorTarget const&);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index d9607e2..5efb5d0 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2114,7 +2114,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
}
}
// 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();
for(std::vector<std::string>::const_iterator fdi = fwDirs.begin();
@@ -2264,7 +2264,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CreateString(install_name_dir.c_str()));
// Create the LD_RUNPATH_SEARCH_PATHS
- cmComputeLinkInformation* pcli = target.GetLinkInformation(configName);
+ cmComputeLinkInformation* pcli = gtgt->GetLinkInformation(configName);
if(pcli)
{
std::string search_paths;
@@ -2834,7 +2834,8 @@ void cmGlobalXCodeGenerator
}
// Compute the link library and directory information.
- cmComputeLinkInformation* pcli = cmtarget->GetLinkInformation(configName);
+ cmGeneratorTarget* gtgt = this->GetGeneratorTarget(cmtarget);
+ cmComputeLinkInformation* pcli = gtgt->GetLinkInformation(configName);
if(!pcli)
{
continue;
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 68f45a6..6ed267d 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -16,6 +16,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmake.h"
+#include "cmGeneratorTarget.h"
#include <assert.h>
@@ -26,7 +27,8 @@ cmInstallTargetGenerator
std::vector<std::string> const& configurations,
const char* component, bool optional):
cmInstallGenerator(dest, configurations, component), Target(&t),
- ImportLibrary(implib), FilePermissions(file_permissions), Optional(optional)
+ ImportLibrary(implib), FilePermissions(file_permissions),
+ Optional(optional), GeneratorTarget(0)
{
this->ActionsPerConfig = true;
this->NamelinkMode = NamelinkModeNone;
@@ -488,6 +490,17 @@ void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os,
this->AddStripRule(os, indent, file);
}
+void cmInstallTargetGenerator::CreateGeneratorTarget()
+{
+ if (!this->GeneratorTarget)
+ {
+ this->GeneratorTarget = this->Target->GetMakefile()
+ ->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(this->Target);
+ }
+}
+
//----------------------------------------------------------------------------
void
cmInstallTargetGenerator
@@ -511,10 +524,13 @@ cmInstallTargetGenerator
return;
}
+ this->CreateGeneratorTarget();
+
// Build a map of build-tree install_name to install-tree install_name for
// shared libraries linked to this target.
std::map<cmStdString, cmStdString> install_name_remap;
- if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config))
+ if(cmComputeLinkInformation* cli =
+ this->GeneratorTarget->GetLinkInformation(config))
{
std::set<cmTarget const*> const& sharedLibs
= cli->GetSharedLibrariesLinked();
@@ -619,9 +635,12 @@ cmInstallTargetGenerator
return;
}
+ this->CreateGeneratorTarget();
+
// Get the link information for this target.
// It can provide the RPATH.
- cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config);
+ cmComputeLinkInformation* cli =
+ this->GeneratorTarget->GetLinkInformation(config);
if(!cli)
{
return;
@@ -650,9 +669,12 @@ cmInstallTargetGenerator
return;
}
+ this->CreateGeneratorTarget();
+
// Get the link information for this target.
// It can provide the RPATH.
- cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config);
+ cmComputeLinkInformation* cli =
+ this->GeneratorTarget->GetLinkInformation(config);
if(!cli)
{
return;
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index 18c3957..39b310f 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -14,7 +14,8 @@
#include "cmInstallGenerator.h"
#include "cmTarget.h"
-#include "cmGeneratorTarget.h"
+
+class cmGeneratorTarget;
/** \class cmInstallTargetGenerator
* \brief Generate target installation rules.
@@ -94,6 +95,8 @@ protected:
void AddRanlibRule(std::ostream& os, Indent const& indent,
const std::string& toDestDirPath);
+ void CreateGeneratorTarget();
+
cmTarget* Target;
bool ImportLibrary;
std::string FilePermissions;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index dc0d3f9..cbd8fce 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1791,7 +1791,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
{
cmOStringStream fout;
const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
- cmComputeLinkInformation* pcli = tgt.Target->GetLinkInformation(config);
+ cmComputeLinkInformation* pcli = tgt.GetLinkInformation(config);
if(!pcli)
{
return;
@@ -2213,8 +2213,10 @@ void cmLocalGenerator::AddCMP0018Flags(std::string &flags, cmTarget* target,
}
return;
}
-
- if (target->GetLinkInterfaceDependentBoolProperty(
+ cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
+ if (gtgt->GetLinkInterfaceDependentBoolProperty(
"POSITION_INDEPENDENT_CODE",
config))
{
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index fb12521..168de6c 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1807,8 +1807,10 @@ void cmLocalVisualStudio6Generator
const std::string extraOptions,
std::string& options)
{
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(&target);
// Compute the link information for this configuration.
- cmComputeLinkInformation* pcli = target.GetLinkInformation(configName);
+ cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName);
if(!pcli)
{
return;
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 57a4880..6f85399 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1064,7 +1064,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
targetNameImport, targetNamePDB, configName);
// Compute the link library and directory information.
- cmComputeLinkInformation* pcli = target.GetLinkInformation(configName);
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(&target);
+ cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName);
if(!pcli)
{
return;
@@ -1160,7 +1162,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
targetNameImport, targetNamePDB, configName);
// Compute the link library and directory information.
- cmComputeLinkInformation* pcli = target.GetLinkInformation(configName);
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(&target);
+ cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName);
if(!pcli)
{
return;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index ea93cde..31a45e0 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1008,7 +1008,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
<< "set(CMAKE_TARGET_LINKED_INFO_FILES\n";
std::set<cmTarget const*> emitted;
const char* cfg = this->LocalGenerator->ConfigurationName.c_str();
- if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg))
+ if(cmComputeLinkInformation* cli =
+ this->GeneratorTarget->GetLinkInformation(cfg))
{
cmComputeLinkInformation::ItemVector const& items = cli->GetItems();
for(cmComputeLinkInformation::ItemVector::const_iterator
@@ -1570,7 +1571,8 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l)
std::string flags;
const char* cfg = this->LocalGenerator->ConfigurationName.c_str();
- if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg))
+ if(cmComputeLinkInformation* cli =
+ this->GeneratorTarget->GetLinkInformation(cfg))
{
std::vector<std::string> const& frameworks = cli->GetFrameworkPaths();
for(std::vector<std::string>::const_iterator i = frameworks.begin();
@@ -1601,7 +1603,8 @@ void cmMakefileTargetGenerator
// Loop over all library dependencies.
const char* cfg = this->LocalGenerator->ConfigurationName.c_str();
- if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg))
+ if(cmComputeLinkInformation* cli =
+ this->GeneratorTarget->GetLinkInformation(cfg))
{
std::vector<std::string> const& libDeps = cli->GetDepends();
for(std::vector<std::string>::const_iterator j = libDeps.begin();
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 82f8d1b..fb6b9bf 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -245,7 +245,7 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
return cmNinjaDeps();
cmComputeLinkInformation* cli =
- this->Target->GetLinkInformation(this->GetConfigName());
+ this->GeneratorTarget->GetLinkInformation(this->GetConfigName());
if(!cli)
return cmNinjaDeps();
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 984ddb3..bbff11e 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -357,8 +357,11 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target)
{
qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR");
}
+ cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
if (const char *targetQtVersion =
- target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", 0))
+ gtgt->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", 0))
{
qtVersion = targetQtVersion;
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index b6f0d7b..29a37ff 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -15,7 +15,6 @@
#include "cmSourceFile.h"
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
-#include "cmComputeLinkInformation.h"
#include "cmListFileCache.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionDAGChecker.h"
@@ -61,11 +60,6 @@ struct cmTarget::OutputInfo
std::string PdbDir;
};
-struct TargetConfigPair : public std::pair<cmTarget const* , std::string> {
- TargetConfigPair(cmTarget const* tgt, const std::string &config)
- : std::pair<cmTarget const* , std::string>(tgt, config) {}
-};
-
//----------------------------------------------------------------------------
class cmTargetInternals
{
@@ -412,13 +406,6 @@ void cmTarget::ClearLinkMaps()
this->Internal->LinkImplMap.clear();
this->Internal->LinkInterfaceMap.clear();
this->Internal->LinkClosureMap.clear();
- for (cmTargetLinkInformationMap::const_iterator it
- = this->LinkInformation.begin();
- it != this->LinkInformation.end(); ++it)
- {
- delete it->second;
- }
- this->LinkInformation.clear();
}
//----------------------------------------------------------------------------
@@ -3649,581 +3636,6 @@ bool cmTarget::IsNullImpliedByLinkLibraries(const std::string &p) const
}
//----------------------------------------------------------------------------
-template<typename PropertyType>
-PropertyType getTypedProperty(cmTarget const* tgt, const char *prop,
- PropertyType *);
-
-//----------------------------------------------------------------------------
-template<>
-bool getTypedProperty<bool>(cmTarget const* tgt, const char *prop, bool *)
-{
- return tgt->GetPropertyAsBool(prop);
-}
-
-//----------------------------------------------------------------------------
-template<>
-const char *getTypedProperty<const char *>(cmTarget const* tgt,
- const char *prop,
- const char **)
-{
- return tgt->GetProperty(prop);
-}
-
-enum CompatibleType
-{
- BoolType,
- StringType,
- NumberMinType,
- NumberMaxType
-};
-
-//----------------------------------------------------------------------------
-template<typename PropertyType>
-std::pair<bool, PropertyType> consistentProperty(PropertyType lhs,
- PropertyType rhs,
- CompatibleType t);
-
-//----------------------------------------------------------------------------
-template<>
-std::pair<bool, bool> consistentProperty(bool lhs, bool rhs, CompatibleType)
-{
- return std::make_pair(lhs == rhs, lhs);
-}
-
-//----------------------------------------------------------------------------
-std::pair<bool, const char*> consistentStringProperty(const char *lhs,
- const char *rhs)
-{
- const bool b = strcmp(lhs, rhs) == 0;
- return std::make_pair(b, b ? lhs : 0);
-}
-
-#if defined(_MSC_VER) && _MSC_VER <= 1200
-template<typename T> const T&
-cmMaximum(const T& l, const T& r) {return l > r ? l : r;}
-template<typename T> const T&
-cmMinimum(const T& l, const T& r) {return l < r ? l : r;}
-#else
-#define cmMinimum std::min
-#define cmMaximum std::max
-#endif
-
-//----------------------------------------------------------------------------
-std::pair<bool, const char*> consistentNumberProperty(const char *lhs,
- const char *rhs,
- CompatibleType t)
-{
- char *pEnd;
-
-#if defined(_MSC_VER)
- static const char* const null_ptr = 0;
-#else
-# define null_ptr 0
-#endif
-
- long lnum = strtol(lhs, &pEnd, 0);
- if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE)
- {
- return std::pair<bool, const char*>(false, null_ptr);
- }
-
- long rnum = strtol(rhs, &pEnd, 0);
- if (pEnd == rhs || *pEnd != '\0' || errno == ERANGE)
- {
- return std::pair<bool, const char*>(false, null_ptr);
- }
-
-#if !defined(_MSC_VER)
-#undef null_ptr
-#endif
-
- if (t == NumberMaxType)
- {
- return std::make_pair(true, cmMaximum(lnum, rnum) == lnum ? lhs : rhs);
- }
- else
- {
- return std::make_pair(true, cmMinimum(lnum, rnum) == lnum ? lhs : rhs);
- }
-}
-
-//----------------------------------------------------------------------------
-template<>
-std::pair<bool, const char*> consistentProperty(const char *lhs,
- const char *rhs,
- CompatibleType t)
-{
- if (!lhs && !rhs)
- {
- return std::make_pair(true, lhs);
- }
- if (!lhs)
- {
- return std::make_pair(true, rhs);
- }
- if (!rhs)
- {
- return std::make_pair(true, lhs);
- }
-
-#if defined(_MSC_VER)
- static const char* const null_ptr = 0;
-#else
-# define null_ptr 0
-#endif
-
- switch(t)
- {
- case BoolType:
- assert(!"consistentProperty for strings called with BoolType");
- return std::pair<bool, const char*>(false, null_ptr);
- case StringType:
- return consistentStringProperty(lhs, rhs);
- case NumberMinType:
- case NumberMaxType:
- return consistentNumberProperty(lhs, rhs, t);
- }
- assert(!"Unreachable!");
- return std::pair<bool, const char*>(false, null_ptr);
-
-#if !defined(_MSC_VER)
-#undef null_ptr
-#endif
-
-}
-
-template<typename PropertyType>
-PropertyType impliedValue(PropertyType);
-template<>
-bool impliedValue<bool>(bool)
-{
- return false;
-}
-template<>
-const char* impliedValue<const char*>(const char*)
-{
- return "";
-}
-
-
-template<typename PropertyType>
-std::string valueAsString(PropertyType);
-template<>
-std::string valueAsString<bool>(bool value)
-{
- return value ? "TRUE" : "FALSE";
-}
-template<>
-std::string valueAsString<const char*>(const char* value)
-{
- return value ? value : "(unset)";
-}
-
-//----------------------------------------------------------------------------
-void
-cmTarget::ReportPropertyOrigin(const std::string &p,
- const std::string &result,
- const std::string &report,
- const std::string &compatibilityType) const
-{
- std::vector<std::string> debugProperties;
- const char *debugProp =
- this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
- if (debugProp)
- {
- cmSystemTools::ExpandListArgument(debugProp, debugProperties);
- }
-
- bool debugOrigin = !this->DebugCompatiblePropertiesDone[p]
- && std::find(debugProperties.begin(),
- debugProperties.end(),
- p)
- != debugProperties.end();
-
- if (this->Makefile->IsGeneratingBuildSystem())
- {
- this->DebugCompatiblePropertiesDone[p] = true;
- }
- if (!debugOrigin)
- {
- return;
- }
-
- std::string areport = compatibilityType;
- areport += std::string(" of property \"") + p + "\" for target \"";
- areport += std::string(this->GetName());
- areport += "\" (result: \"";
- areport += result;
- areport += "\"):\n" + report;
-
- cmListFileBacktrace lfbt;
- this->Makefile->GetCMakeInstance()->IssueMessage(cmake::LOG, areport, lfbt);
-}
-
-//----------------------------------------------------------------------------
-std::string compatibilityType(CompatibleType t)
-{
- switch(t)
- {
- case BoolType:
- return "Boolean compatibility";
- case StringType:
- return "String compatibility";
- case NumberMaxType:
- return "Numeric maximum compatibility";
- case NumberMinType:
- return "Numeric minimum compatibility";
- }
- assert(!"Unreachable!");
- return "";
-}
-
-//----------------------------------------------------------------------------
-std::string compatibilityAgree(CompatibleType t, bool dominant)
-{
- switch(t)
- {
- case BoolType:
- case StringType:
- return dominant ? "(Disagree)\n" : "(Agree)\n";
- case NumberMaxType:
- case NumberMinType:
- return dominant ? "(Dominant)\n" : "(Ignored)\n";
- }
- assert(!"Unreachable!");
- return "";
-}
-
-//----------------------------------------------------------------------------
-template<typename PropertyType>
-PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
- const std::string &p,
- const char *config,
- const char *defaultValue,
- CompatibleType t,
- PropertyType *)
-{
- PropertyType propContent = getTypedProperty<PropertyType>(tgt, p.c_str(),
- 0);
- const bool explicitlySet = tgt->GetProperties()
- .find(p.c_str())
- != tgt->GetProperties().end();
- const bool impliedByUse =
- tgt->IsNullImpliedByLinkLibraries(p);
- assert((impliedByUse ^ explicitlySet)
- || (!impliedByUse && !explicitlySet));
-
- cmComputeLinkInformation *info = tgt->GetLinkInformation(config);
- if(!info)
- {
- return propContent;
- }
- const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
- bool propInitialized = explicitlySet;
-
- std::string report = " * Target \"";
- report += tgt->GetName();
- if (explicitlySet)
- {
- report += "\" has property content \"";
- report += valueAsString<PropertyType>(propContent);
- report += "\"\n";
- }
- else if (impliedByUse)
- {
- report += "\" property is implied by use.\n";
- }
- else
- {
- report += "\" property not set.\n";
- }
-
- for(cmComputeLinkInformation::ItemVector::const_iterator li =
- deps.begin();
- li != deps.end(); ++li)
- {
- // An error should be reported if one dependency
- // has INTERFACE_POSITION_INDEPENDENT_CODE ON and the other
- // has INTERFACE_POSITION_INDEPENDENT_CODE OFF, or if the
- // target itself has a POSITION_INDEPENDENT_CODE which disagrees
- // with a dependency.
-
- if (!li->Target)
- {
- continue;
- }
-
- const bool ifaceIsSet = li->Target->GetProperties()
- .find("INTERFACE_" + p)
- != li->Target->GetProperties().end();
- PropertyType ifacePropContent =
- getTypedProperty<PropertyType>(li->Target,
- ("INTERFACE_" + p).c_str(), 0);
-
- std::string reportEntry;
- if (ifaceIsSet)
- {
- reportEntry += " * Target \"";
- reportEntry += li->Target->GetName();
- reportEntry += "\" property value \"";
- reportEntry += valueAsString<PropertyType>(ifacePropContent);
- reportEntry += "\" ";
- }
-
- if (explicitlySet)
- {
- if (ifaceIsSet)
- {
- std::pair<bool, PropertyType> consistent =
- consistentProperty(propContent,
- ifacePropContent, t);
- report += reportEntry;
- report += compatibilityAgree(t, propContent != consistent.second);
- if (!consistent.first)
- {
- cmOStringStream e;
- e << "Property " << p << " on target \""
- << tgt->GetName() << "\" does\nnot match the "
- "INTERFACE_" << p << " property requirement\nof "
- "dependency \"" << li->Target->GetName() << "\".\n";
- cmSystemTools::Error(e.str().c_str());
- break;
- }
- else
- {
- propContent = consistent.second;
- continue;
- }
- }
- else
- {
- // Explicitly set on target and not set in iface. Can't disagree.
- continue;
- }
- }
- else if (impliedByUse)
- {
- propContent = impliedValue<PropertyType>(propContent);
-
- if (ifaceIsSet)
- {
- std::pair<bool, PropertyType> consistent =
- consistentProperty(propContent,
- ifacePropContent, t);
- report += reportEntry;
- report += compatibilityAgree(t, propContent != consistent.second);
- if (!consistent.first)
- {
- cmOStringStream e;
- e << "Property " << p << " on target \""
- << tgt->GetName() << "\" is\nimplied to be " << defaultValue
- << " because it was used to determine the link libraries\n"
- "already. The INTERFACE_" << p << " property on\ndependency \""
- << li->Target->GetName() << "\" is in conflict.\n";
- cmSystemTools::Error(e.str().c_str());
- break;
- }
- else
- {
- propContent = consistent.second;
- continue;
- }
- }
- else
- {
- // Implicitly set on target and not set in iface. Can't disagree.
- continue;
- }
- }
- else
- {
- if (ifaceIsSet)
- {
- if (propInitialized)
- {
- std::pair<bool, PropertyType> consistent =
- consistentProperty(propContent,
- ifacePropContent, t);
- report += reportEntry;
- report += compatibilityAgree(t, propContent != consistent.second);
- if (!consistent.first)
- {
- cmOStringStream e;
- e << "The INTERFACE_" << p << " property of \""
- << li->Target->GetName() << "\" does\nnot agree with the value "
- "of " << p << " already determined\nfor \""
- << tgt->GetName() << "\".\n";
- cmSystemTools::Error(e.str().c_str());
- break;
- }
- else
- {
- propContent = consistent.second;
- continue;
- }
- }
- else
- {
- report += reportEntry + "(Interface set)\n";
- propContent = ifacePropContent;
- propInitialized = true;
- }
- }
- else
- {
- // Not set. Nothing to agree on.
- continue;
- }
- }
- }
-
- tgt->ReportPropertyOrigin(p, valueAsString<PropertyType>(propContent),
- report, compatibilityType(t));
- return propContent;
-}
-
-//----------------------------------------------------------------------------
-bool cmTarget::GetLinkInterfaceDependentBoolProperty(const std::string &p,
- const char *config) const
-{
- return checkInterfacePropertyCompatibility<bool>(this, p, config, "FALSE",
- BoolType, 0);
-}
-
-//----------------------------------------------------------------------------
-const char * cmTarget::GetLinkInterfaceDependentStringProperty(
- const std::string &p,
- const char *config) const
-{
- return checkInterfacePropertyCompatibility<const char *>(this,
- p,
- config,
- "empty",
- StringType, 0);
-}
-
-//----------------------------------------------------------------------------
-const char * cmTarget::GetLinkInterfaceDependentNumberMinProperty(
- const std::string &p,
- const char *config) const
-{
- return checkInterfacePropertyCompatibility<const char *>(this,
- p,
- config,
- "empty",
- NumberMinType, 0);
-}
-
-//----------------------------------------------------------------------------
-const char * cmTarget::GetLinkInterfaceDependentNumberMaxProperty(
- const std::string &p,
- const char *config) const
-{
- return checkInterfacePropertyCompatibility<const char *>(this,
- p,
- config,
- "empty",
- NumberMaxType, 0);
-}
-
-//----------------------------------------------------------------------------
-bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p,
- const char *interfaceProperty,
- const char *config)
-{
- cmComputeLinkInformation *info = tgt->GetLinkInformation(config);
- if(!info)
- {
- return false;
- }
-
- const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
-
- for(cmComputeLinkInformation::ItemVector::const_iterator li =
- deps.begin();
- li != deps.end(); ++li)
- {
- if (!li->Target)
- {
- continue;
- }
- const char *prop = li->Target->GetProperty(interfaceProperty);
- if (!prop)
- {
- continue;
- }
-
- std::vector<std::string> props;
- cmSystemTools::ExpandListArgument(prop, props);
-
- for(std::vector<std::string>::iterator pi = props.begin();
- pi != props.end(); ++pi)
- {
- if (*pi == p)
- {
- return true;
- }
- }
- }
-
- return false;
-}
-
-//----------------------------------------------------------------------------
-bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p,
- const char *config) const
-{
- if (this->TargetTypeValue == OBJECT_LIBRARY
- || this->TargetTypeValue == INTERFACE_LIBRARY)
- {
- return false;
- }
- return (p == "POSITION_INDEPENDENT_CODE") ||
- isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_BOOL",
- config);
-}
-
-//----------------------------------------------------------------------------
-bool cmTarget::IsLinkInterfaceDependentStringProperty(const std::string &p,
- const char *config) const
-{
- if (this->TargetTypeValue == OBJECT_LIBRARY
- || this->TargetTypeValue == INTERFACE_LIBRARY)
- {
- return false;
- }
- return (p == "AUTOUIC_OPTIONS") ||
- isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_STRING",
- config);
-}
-
-//----------------------------------------------------------------------------
-bool cmTarget::IsLinkInterfaceDependentNumberMinProperty(const std::string &p,
- const char *config) const
-{
- if (this->TargetTypeValue == OBJECT_LIBRARY
- || this->TargetTypeValue == INTERFACE_LIBRARY)
- {
- return false;
- }
- return isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_NUMBER_MIN",
- config);
-}
-
-//----------------------------------------------------------------------------
-bool cmTarget::IsLinkInterfaceDependentNumberMaxProperty(const std::string &p,
- const char *config) const
-{
- if (this->TargetTypeValue == OBJECT_LIBRARY
- || this->TargetTypeValue == INTERFACE_LIBRARY)
- {
- return false;
- }
- return isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_NUMBER_MAX",
- config);
-}
-
-//----------------------------------------------------------------------------
void cmTarget::GetLanguages(std::set<cmStdString>& languages) const
{
for(std::vector<cmSourceFile*>::const_iterator
@@ -5223,275 +4635,6 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const
return lib;
}
-template<typename PropertyType>
-PropertyType getLinkInterfaceDependentProperty(cmTarget const* tgt,
- const std::string prop,
- const char *config,
- CompatibleType,
- PropertyType *);
-
-template<>
-bool getLinkInterfaceDependentProperty(cmTarget const* tgt,
- const std::string prop,
- const char *config,
- CompatibleType, bool *)
-{
- return tgt->GetLinkInterfaceDependentBoolProperty(prop, config);
-}
-
-template<>
-const char * getLinkInterfaceDependentProperty(cmTarget const* tgt,
- const std::string prop,
- const char *config,
- CompatibleType t,
- const char **)
-{
- switch(t)
- {
- case BoolType:
- assert(!"String compatibility check function called for boolean");
- return 0;
- case StringType:
- return tgt->GetLinkInterfaceDependentStringProperty(prop, config);
- case NumberMinType:
- return tgt->GetLinkInterfaceDependentNumberMinProperty(prop, config);
- case NumberMaxType:
- return tgt->GetLinkInterfaceDependentNumberMaxProperty(prop, config);
- }
- assert(!"Unreachable!");
- return 0;
-}
-
-//----------------------------------------------------------------------------
-template<typename PropertyType>
-void checkPropertyConsistency(cmTarget const* depender,
- cmTarget const* dependee,
- const char *propName,
- std::set<cmStdString> &emitted,
- const char *config,
- CompatibleType t,
- PropertyType *)
-{
- const char *prop = dependee->GetProperty(propName);
- if (!prop)
- {
- return;
- }
-
- std::vector<std::string> props;
- cmSystemTools::ExpandListArgument(prop, props);
- std::string pdir =
- dependee->GetMakefile()->GetRequiredDefinition("CMAKE_ROOT");
- pdir += "/Help/prop_tgt/";
-
- for(std::vector<std::string>::iterator pi = props.begin();
- pi != props.end(); ++pi)
- {
- std::string pname = cmSystemTools::HelpFileName(*pi);
- std::string pfile = pdir + pname + ".rst";
- if(cmSystemTools::FileExists(pfile.c_str(), true))
- {
- cmOStringStream e;
- e << "Target \"" << dependee->GetName() << "\" has property \""
- << *pi << "\" listed in its " << propName << " property. "
- "This is not allowed. Only user-defined properties may appear "
- "listed in the " << propName << " property.";
- depender->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str());
- return;
- }
- if(emitted.insert(*pi).second)
- {
- getLinkInterfaceDependentProperty<PropertyType>(depender, *pi, config,
- t, 0);
- if (cmSystemTools::GetErrorOccuredFlag())
- {
- return;
- }
- }
- }
-}
-
-static cmStdString intersect(const std::set<cmStdString> &s1,
- const std::set<cmStdString> &s2)
-{
- std::set<cmStdString> intersect;
- std::set_intersection(s1.begin(),s1.end(),
- s2.begin(),s2.end(),
- std::inserter(intersect,intersect.begin()));
- if (!intersect.empty())
- {
- return *intersect.begin();
- }
- return "";
-}
-static cmStdString intersect(const std::set<cmStdString> &s1,
- const std::set<cmStdString> &s2,
- const std::set<cmStdString> &s3)
-{
- cmStdString result;
- result = intersect(s1, s2);
- if (!result.empty())
- return result;
- result = intersect(s1, s3);
- if (!result.empty())
- return result;
- return intersect(s2, s3);
-}
-static cmStdString intersect(const std::set<cmStdString> &s1,
- const std::set<cmStdString> &s2,
- const std::set<cmStdString> &s3,
- const std::set<cmStdString> &s4)
-{
- cmStdString result;
- result = intersect(s1, s2);
- if (!result.empty())
- return result;
- result = intersect(s1, s3);
- if (!result.empty())
- return result;
- result = intersect(s1, s4);
- if (!result.empty())
- return result;
- return intersect(s2, s3, s4);
-}
-
-//----------------------------------------------------------------------------
-void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
- const char* config) const
-{
- const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
-
- std::set<cmStdString> emittedBools;
- std::set<cmStdString> emittedStrings;
- std::set<cmStdString> emittedMinNumbers;
- std::set<cmStdString> emittedMaxNumbers;
-
- for(cmComputeLinkInformation::ItemVector::const_iterator li =
- deps.begin();
- li != deps.end(); ++li)
- {
- if (!li->Target)
- {
- continue;
- }
-
- checkPropertyConsistency<bool>(this, li->Target,
- "COMPATIBLE_INTERFACE_BOOL",
- emittedBools, config, BoolType, 0);
- if (cmSystemTools::GetErrorOccuredFlag())
- {
- return;
- }
- checkPropertyConsistency<const char *>(this, li->Target,
- "COMPATIBLE_INTERFACE_STRING",
- emittedStrings, config,
- StringType, 0);
- if (cmSystemTools::GetErrorOccuredFlag())
- {
- return;
- }
- checkPropertyConsistency<const char *>(this, li->Target,
- "COMPATIBLE_INTERFACE_NUMBER_MIN",
- emittedMinNumbers, config,
- NumberMinType, 0);
- if (cmSystemTools::GetErrorOccuredFlag())
- {
- return;
- }
- checkPropertyConsistency<const char *>(this, li->Target,
- "COMPATIBLE_INTERFACE_NUMBER_MAX",
- emittedMaxNumbers, config,
- NumberMaxType, 0);
- if (cmSystemTools::GetErrorOccuredFlag())
- {
- return;
- }
- }
-
- std::string prop = intersect(emittedBools,
- emittedStrings,
- emittedMinNumbers,
- emittedMaxNumbers);
-
- if (!prop.empty())
- {
- std::set<std::string> props;
- std::set<cmStdString>::const_iterator i = emittedBools.find(prop);
- if (i != emittedBools.end())
- {
- props.insert("COMPATIBLE_INTERFACE_BOOL");
- }
- i = emittedStrings.find(prop);
- if (i != emittedStrings.end())
- {
- props.insert("COMPATIBLE_INTERFACE_STRING");
- }
- i = emittedMinNumbers.find(prop);
- if (i != emittedMinNumbers.end())
- {
- props.insert("COMPATIBLE_INTERFACE_NUMBER_MIN");
- }
- i = emittedMaxNumbers.find(prop);
- if (i != emittedMaxNumbers.end())
- {
- props.insert("COMPATIBLE_INTERFACE_NUMBER_MAX");
- }
-
- std::string propsString = *props.begin();
- props.erase(props.begin());
- while (props.size() > 1)
- {
- propsString += ", " + *props.begin();
- props.erase(props.begin());
- }
- if (props.size() == 1)
- {
- propsString += " and the " + *props.begin();
- }
- cmOStringStream e;
- e << "Property \"" << prop << "\" appears in both the "
- << propsString <<
- " property in the dependencies of target \"" << this->GetName() <<
- "\". This is not allowed. A property may only require compatibility "
- "in a boolean interpretation, a numeric minimum, a numeric maximum or a "
- "string interpretation, but not a mixture.";
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
- }
-}
-
-//----------------------------------------------------------------------------
-cmComputeLinkInformation*
-cmTarget::GetLinkInformation(const char* config, cmTarget const* head) const
-{
- cmTarget const* headTarget = head ? head : this;
- // Lookup any existing information for this configuration.
- TargetConfigPair key(headTarget,
- cmSystemTools::UpperCase(config?config:""));
- cmTargetLinkInformationMap::iterator
- i = this->LinkInformation.find(key);
- if(i == this->LinkInformation.end())
- {
- // Compute information for this configuration.
- cmComputeLinkInformation* info =
- new cmComputeLinkInformation(this, config, headTarget);
- if(!info || !info->Compute())
- {
- delete info;
- info = 0;
- }
-
- // Store the information for this configuration.
- cmTargetLinkInformationMap::value_type entry(key, info);
- i = this->LinkInformation.insert(entry).first;
-
- if (info)
- {
- this->CheckPropertyCompatibility(info, config);
- }
- }
- return i->second;
-}
-
//----------------------------------------------------------------------------
std::string cmTarget::GetFrameworkDirectory(const char* config,
bool rootDir) const
@@ -5577,29 +4720,6 @@ std::string cmTarget::GetMacContentDirectory(const char* config,
}
//----------------------------------------------------------------------------
-cmTargetLinkInformationMap
-::cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r): derived()
-{
- // Ideally cmTarget instances should never be copied. However until
- // we can make a sweep to remove that, this copy constructor avoids
- // allowing the resources (LinkInformation) from getting copied. In
- // the worst case this will lead to extra cmComputeLinkInformation
- // instances. We also enforce in debug mode that the map be emptied
- // when copied.
- static_cast<void>(r);
- assert(r.empty());
-}
-
-//----------------------------------------------------------------------------
-cmTargetLinkInformationMap::~cmTargetLinkInformationMap()
-{
- for(derived::iterator i = this->begin(); i != this->end(); ++i)
- {
- delete i->second;
- }
-}
-
-//----------------------------------------------------------------------------
cmTargetInternalPointer::cmTargetInternalPointer()
{
this->Pointer = new cmTargetInternals;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index c49811b..249059a 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -34,23 +34,11 @@ class cmake;
class cmMakefile;
class cmSourceFile;
class cmGlobalGenerator;
-class cmComputeLinkInformation;
class cmListFileBacktrace;
class cmTarget;
class cmGeneratorTarget;
class cmTargetTraceDependencies;
-struct cmTargetLinkInformationMap:
- public std::map<std::pair<cmTarget const* , std::string>,
- cmComputeLinkInformation*>
-{
- typedef std::map<std::pair<cmTarget const* , std::string>,
- cmComputeLinkInformation*> derived;
- cmTargetLinkInformationMap() {}
- cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r);
- ~cmTargetLinkInformationMap();
-};
-
class cmTargetInternals;
class cmTargetInternalPointer
{
@@ -65,6 +53,11 @@ private:
cmTargetInternals* Pointer;
};
+struct TargetConfigPair : public std::pair<cmTarget const*, std::string> {
+ TargetConfigPair(cmTarget const* tgt, const std::string &config)
+ : std::pair<cmTarget const*, std::string>(tgt, config) {}
+};
+
/** \class cmTarget
* \brief Represent a library or executable target loaded from a makefile.
*
@@ -429,9 +422,6 @@ public:
* install tree. For example: "\@rpath/" or "\@loader_path/". */
std::string GetInstallNameDirForInstallTree() const;
- cmComputeLinkInformation* GetLinkInformation(const char* config,
- cmTarget const* head = 0) const;
-
// Get the properties
cmPropertyMap &GetProperties() const { return this->Properties; };
@@ -529,24 +519,6 @@ public:
const char *config) const;
bool IsNullImpliedByLinkLibraries(const std::string &p) const;
- bool IsLinkInterfaceDependentBoolProperty(const std::string &p,
- const char *config) const;
- bool IsLinkInterfaceDependentStringProperty(const std::string &p,
- const char *config) const;
- bool IsLinkInterfaceDependentNumberMinProperty(const std::string &p,
- const char *config) const;
- bool IsLinkInterfaceDependentNumberMaxProperty(const std::string &p,
- const char *config) const;
-
- bool GetLinkInterfaceDependentBoolProperty(const std::string &p,
- const char *config) const;
-
- const char *GetLinkInterfaceDependentStringProperty(const std::string &p,
- const char *config) const;
- const char *GetLinkInterfaceDependentNumberMinProperty(const std::string &p,
- const char *config) const;
- const char *GetLinkInterfaceDependentNumberMaxProperty(const std::string &p,
- const char *config) const;
std::string GetDebugGeneratorExpressions(const std::string &value,
cmTarget::LinkLibraryType llt) const;
@@ -559,11 +531,6 @@ public:
bool LinkLanguagePropagatesToDependents() const
{ return this->TargetTypeValue == STATIC_LIBRARY; }
- void ReportPropertyOrigin(const std::string &p,
- const std::string &result,
- const std::string &report,
- const std::string &compatibilityType) const;
-
const std::vector<cmValueWithOrigin>& GetLinkImplementationPropertyEntries();
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>&
GetIncludeDirectoriesEntries();
@@ -679,7 +646,6 @@ private:
bool DLLPlatform;
bool IsApple;
bool IsImportedTarget;
- mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
mutable bool DebugCompileOptionsDone;
mutable bool DebugCompileDefinitionsDone;
mutable std::set<std::string> LinkImplicitNullProperties;
@@ -705,9 +671,6 @@ private:
void ComputeImportInfo(std::string const& desired_config, ImportInfo& info,
cmTarget const* head) const;
- mutable cmTargetLinkInformationMap LinkInformation;
- void CheckPropertyCompatibility(cmComputeLinkInformation *info,
- const char* config) const;
bool ComputeLinkInterface(const char* config, LinkInterface& iface,
cmTarget const* head) const;
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index eee7c14..6eefd5c 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1597,7 +1597,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
// Replace spaces in libs with ;
cmSystemTools::ReplaceString(libs, " ", ";");
cmComputeLinkInformation* pcli =
- this->Target->GetLinkInformation(config.c_str());
+ this->GeneratorTarget->GetLinkInformation(config.c_str());
if(!pcli)
{
cmSystemTools::Error
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5cb11f54814ce86c0b6d36738eaa4992866a6fe8
commit 5cb11f54814ce86c0b6d36738eaa4992866a6fe8
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Dec 9 18:05:25 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:06 2014 +0100
Move GetAutoUicOptions to cmGeneratorTarget.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 755a742..62f3fe0 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -593,6 +593,33 @@ cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs) const
}
//----------------------------------------------------------------------------
+void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string> &result,
+ const char *config) const
+{
+ const char *prop
+ = this->Target->
+ GetLinkInterfaceDependentStringProperty("AUTOUIC_OPTIONS",
+ config);
+ if (!prop)
+ {
+ return;
+ }
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt,
+ this->GetName(),
+ "AUTOUIC_OPTIONS", 0, 0);
+ cmSystemTools::ExpandListArgument(ge.Parse(prop)
+ ->Evaluate(this->Makefile,
+ config,
+ false,
+ this->Target,
+ &dagChecker),
+ result);
+}
+
+//----------------------------------------------------------------------------
class cmTargetTraceDependencies
{
public:
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 9fbe3d8..fcf936e 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -116,12 +116,14 @@ public:
const std::string TargetName;
};
+ void GetAutoUicOptions(std::vector<std::string> &result,
+ const char *config) const;
+
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
typedef std::map<cmSourceFile*, SourceEntry> SourceEntriesType;
SourceEntriesType SourceEntries;
-
std::vector<cmSourceFile*> CustomCommands;
std::vector<cmSourceFile*> ExtraSources;
std::vector<cmSourceFile*> HeaderSources;
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 698c426..984ddb3 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -623,8 +623,11 @@ void cmQtAutoGenerators::MergeUicOptions(std::vector<std::string> &opts,
static void GetUicOpts(cmTarget const* target, const char * config,
std::string &optString)
{
+ cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
std::vector<std::string> opts;
- target->GetAutoUicOptions(opts, config);
+ gtgt->GetAutoUicOptions(opts, config);
const char* sep = "";
for(std::vector<std::string>::const_iterator optIt = opts.begin();
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 8052000..b6f0d7b 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1677,32 +1677,6 @@ static void processCompileOptions(cmTarget const* tgt,
}
//----------------------------------------------------------------------------
-void cmTarget::GetAutoUicOptions(std::vector<std::string> &result,
- const char *config) const
-{
- const char *prop
- = this->GetLinkInterfaceDependentStringProperty("AUTOUIC_OPTIONS",
- config);
- if (!prop)
- {
- return;
- }
- cmListFileBacktrace lfbt;
- cmGeneratorExpression ge(lfbt);
-
- cmGeneratorExpressionDAGChecker dagChecker(lfbt,
- this->GetName(),
- "AUTOUIC_OPTIONS", 0, 0);
- cmSystemTools::ExpandListArgument(ge.Parse(prop)
- ->Evaluate(this->Makefile,
- config,
- false,
- this,
- &dagChecker),
- result);
-}
-
-//----------------------------------------------------------------------------
void cmTarget::GetCompileOptions(std::vector<std::string> &result,
const char *config) const
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 0706c26..c49811b 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -527,8 +527,6 @@ public:
void GetCompileOptions(std::vector<std::string> &result,
const char *config) const;
- void GetAutoUicOptions(std::vector<std::string> &result,
- const char *config) const;
bool IsNullImpliedByLinkLibraries(const std::string &p) const;
bool IsLinkInterfaceDependentBoolProperty(const std::string &p,
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c773e6ab815f830d294e3a31bffe72deab7a1fc5
commit c773e6ab815f830d294e3a31bffe72deab7a1fc5
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 9 00:37:37 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:05 2014 +0100
Move GetSOName to cmGeneratorTarget.
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index c0b45da..101685b 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -788,7 +788,10 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
{
if(tgt)
{
- std::string soName = tgt->GetSOName(this->Config);
+ cmGeneratorTarget *gtgt = tgt->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(tgt);
+ std::string soName = gtgt->GetSOName(this->Config);
const char* soname = soName.empty()? 0 : soName.c_str();
order->AddRuntimeLibrary(lib, soname);
}
@@ -1784,7 +1787,10 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
// Try to get the soname of the library. Only files with this name
// could possibly conflict.
- std::string soName = target->GetSOName(this->Config);
+ cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
+ std::string soName = gtgt->GetSOName(this->Config);
const char* soname = soName.empty()? 0 : soName.c_str();
// Include this library in the runtime path ordering.
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index f58e292..a67356a 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -789,7 +789,7 @@ cmExportFileGenerator
value = this->InstallNameDir(target->Target, config);
}
prop = "IMPORTED_SONAME";
- value += target->Target->GetSOName(config);
+ value += target->GetSOName(config);
}
else
{
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 8f50b0c..4bc3312 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -1384,7 +1384,7 @@ struct TargetFilesystemArtifactResultCreator<false, true>
}
std::string result = target->Target->GetDirectory(context->Config);
result += "/";
- result += target->Target->GetSOName(context->Config);
+ result += target->GetSOName(context->Config);
return result;
}
};
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index a01d2d2..755a742 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -379,6 +379,50 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files) const
}
//----------------------------------------------------------------------------
+std::string cmGeneratorTarget::GetSOName(const char* config) const
+{
+ if(this->Target->IsImported())
+ {
+ // Lookup the imported soname.
+ if(cmTarget::ImportInfo const* info =
+ this->Target->GetImportInfo(config, this->Target))
+ {
+ if(info->NoSOName)
+ {
+ // The imported library has no builtin soname so the name
+ // searched at runtime will be just the filename.
+ return cmSystemTools::GetFilenameName(info->Location);
+ }
+ else
+ {
+ // Use the soname given if any.
+ if(info->SOName.find("@rpath/") == 0)
+ {
+ return info->SOName.substr(6);
+ }
+ return info->SOName;
+ }
+ }
+ else
+ {
+ return "";
+ }
+ }
+ else
+ {
+ // Compute the soname that will be built.
+ std::string name;
+ std::string soName;
+ std::string realName;
+ std::string impName;
+ std::string pdbName;
+ this->Target->GetLibraryNames(name, soName, realName,
+ impName, pdbName, config);
+ return soName;
+ }
+}
+
+//----------------------------------------------------------------------------
void cmGeneratorTarget::ClassifySources()
{
cmsys::RegularExpression header(CM_HEADER_REGEX);
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index b7f2ad6..9fbe3d8 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -62,6 +62,9 @@ public:
bool realname) const;
std::string NormalGetRealName(const char* config) const;
+ /** Get the soname of the target. Allowed only for a shared library. */
+ std::string GetSOName(const char* config) const;
+
cmTarget* Target;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index df7aea3..d9607e2 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2251,7 +2251,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
install_name += install_name_dir;
install_name += "/";
}
- install_name += target.GetSOName(configName);
+ install_name += gtgt->GetSOName(configName);
if((realName != soName) || install_name_dir.empty())
{
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 8240dfd..8052000 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -61,16 +61,6 @@ struct cmTarget::OutputInfo
std::string PdbDir;
};
-//----------------------------------------------------------------------------
-struct cmTarget::ImportInfo
-{
- bool NoSOName;
- std::string Location;
- std::string SOName;
- std::string ImportLibrary;
- cmTarget::LinkInterface LinkInterface;
-};
-
struct TargetConfigPair : public std::pair<cmTarget const* , std::string> {
TargetConfigPair(cmTarget const* tgt, const std::string &config)
: std::pair<cmTarget const* , std::string>(tgt, config) {}
@@ -2720,48 +2710,6 @@ bool cmTarget::HasSOName(const char* config) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetSOName(const char* config) const
-{
- if(this->IsImported())
- {
- // Lookup the imported soname.
- if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, this))
- {
- if(info->NoSOName)
- {
- // The imported library has no builtin soname so the name
- // searched at runtime will be just the filename.
- return cmSystemTools::GetFilenameName(info->Location);
- }
- else
- {
- // Use the soname given if any.
- if(info->SOName.find("@rpath/") == 0)
- {
- return info->SOName.substr(6);
- }
- return info->SOName;
- }
- }
- else
- {
- return "";
- }
- }
- else
- {
- // Compute the soname that will be built.
- std::string name;
- std::string soName;
- std::string realName;
- std::string impName;
- std::string pdbName;
- this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
- return soName;
- }
-}
-
-//----------------------------------------------------------------------------
bool cmTarget::HasMacOSXRpathInstallNameDir(const char* config) const
{
bool install_name_is_rpath = false;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 955773d..0706c26 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -377,9 +377,6 @@ public:
/** Whether this library has soname enabled and platform supports it. */
bool HasSOName(const char* config) const;
- /** Get the soname of the target. Allowed only for a shared library. */
- std::string GetSOName(const char* config) const;
-
/** Whether this library has \@rpath and platform supports it. */
bool HasMacOSXRpathInstallNameDir(const char* config) const;
@@ -698,7 +695,13 @@ private:
bool ComputePDBOutputDir(const char* config, std::string& out) const;
// Cache import information from properties for each configuration.
- struct ImportInfo;
+ struct ImportInfo{
+ bool NoSOName;
+ std::string Location;
+ std::string SOName;
+ std::string ImportLibrary;
+ cmTarget::LinkInterface LinkInterface;
+ };
ImportInfo const* GetImportInfo(const char* config,
cmTarget const* workingTarget) const;
void ComputeImportInfo(std::string const& desired_config, ImportInfo& info,
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=229ed96916414364184ce6742caf43ee315ba5e2
commit 229ed96916414364184ce6742caf43ee315ba5e2
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Nov 3 15:53:25 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:05 2014 +0100
Move GetIncludeDirectories to cmGeneratorTarget.
Accessor methods for other properties can similarly be moved.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index d93066d..a01d2d2 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -30,6 +30,41 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
this->Makefile = this->Target->GetMakefile();
this->LocalGenerator = this->Makefile->GetLocalGenerator();
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
+
+ this->DebugIncludesDone = false;
+
+}
+
+//----------------------------------------------------------------------------
+void deleteAndClear2(
+ std::vector<cmGeneratorTarget::TargetPropertyEntry*> &entries)
+{
+ for (std::vector<cmGeneratorTarget::TargetPropertyEntry*>::const_iterator
+ it = entries.begin(),
+ end = entries.end();
+ it != end; ++it)
+ {
+ delete *it;
+ }
+ entries.clear();
+}
+
+//----------------------------------------------------------------------------
+void deleteAndClear2(
+ std::map<std::string,
+ std::vector<cmGeneratorTarget::TargetPropertyEntry*> > &entries)
+{
+ for (std::map<std::string,
+ std::vector<cmGeneratorTarget::TargetPropertyEntry*> >::iterator
+ it = entries.begin(), end = entries.end(); it != end; ++it)
+ {
+ deleteAndClear2(it->second);
+ }
+}
+
+cmGeneratorTarget::~cmGeneratorTarget()
+{
+ deleteAndClear2(this->CachedLinkInterfaceIncludeDirectoriesEntries);
}
//----------------------------------------------------------------------------
@@ -835,10 +870,304 @@ const char* cmGeneratorTarget::GetCreateRuleVariable() const
}
//----------------------------------------------------------------------------
+static void processIncludeDirectories(cmTarget const* tgt,
+ const std::vector<cmGeneratorTarget::TargetPropertyEntry*> &entries,
+ std::vector<std::string> &includes,
+ std::set<std::string> &uniqueIncludes,
+ cmGeneratorExpressionDAGChecker *dagChecker,
+ const char *config, bool debugIncludes)
+{
+ cmMakefile *mf = tgt->GetMakefile();
+
+ for (std::vector<cmGeneratorTarget::TargetPropertyEntry*>::const_iterator
+ it = entries.begin(), end = entries.end(); it != end; ++it)
+ {
+ bool testIsOff = true;
+ bool cacheIncludes = false;
+ std::vector<std::string> entryIncludes = (*it)->CachedEntries;
+ if(!entryIncludes.empty())
+ {
+ testIsOff = false;
+ }
+ else
+ {
+ cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf,
+ config,
+ false,
+ tgt,
+ dagChecker),
+ entryIncludes);
+ if (mf->IsGeneratingBuildSystem()
+ && !(*it)->ge->GetHadContextSensitiveCondition())
+ {
+ cacheIncludes = true;
+ }
+ }
+ std::string usedIncludes;
+ cmListFileBacktrace lfbt;
+ for(std::vector<std::string>::iterator
+ li = entryIncludes.begin(); li != entryIncludes.end(); ++li)
+ {
+ std::string targetName = (*it)->TargetName;
+ std::string evaluatedTargetName;
+ {
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(targetName);
+ evaluatedTargetName = cge->Evaluate(mf, config, false, tgt, 0, 0);
+ }
+
+ cmTarget *dependentTarget = mf->FindTargetToUse(targetName.c_str());
+
+ const bool fromImported = dependentTarget
+ && dependentTarget->IsImported();
+
+ cmTarget *evaluatedDependentTarget =
+ (targetName != evaluatedTargetName)
+ ? mf->FindTargetToUse(evaluatedTargetName.c_str())
+ : 0;
+
+ targetName = evaluatedTargetName;
+
+ const bool fromEvaluatedImported = evaluatedDependentTarget
+ && evaluatedDependentTarget->IsImported();
+
+ if ((fromImported || fromEvaluatedImported)
+ && !cmSystemTools::FileExists(li->c_str()))
+ {
+ cmOStringStream e;
+ cmake::MessageType messageType = cmake::FATAL_ERROR;
+ if (fromEvaluatedImported)
+ {
+ switch(mf->GetPolicyStatus(cmPolicies::CMP0027))
+ {
+ case cmPolicies::WARN:
+ e << (mf->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0027)) << "\n";
+ case cmPolicies::OLD:
+ messageType = cmake::AUTHOR_WARNING;
+ break;
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::NEW:
+ break;
+ }
+ }
+ e << "Imported target \"" << targetName << "\" includes "
+ "non-existent path\n \"" << *li << "\"\nin its "
+ "INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:\n"
+ "* The path was deleted, renamed, or moved to another "
+ "location.\n"
+ "* An install or uninstall procedure did not complete "
+ "successfully.\n"
+ "* The installation package was faulty and references files it "
+ "does not provide.\n";
+ tgt->GetMakefile()->IssueMessage(messageType, e.str().c_str());
+ return;
+ }
+
+ if (!cmSystemTools::FileIsFullPath(li->c_str()))
+ {
+ cmOStringStream e;
+ bool noMessage = false;
+ cmake::MessageType messageType = cmake::FATAL_ERROR;
+ if (!targetName.empty())
+ {
+ e << "Target \"" << targetName << "\" contains relative "
+ "path in its INTERFACE_INCLUDE_DIRECTORIES:\n"
+ " \"" << *li << "\"";
+ }
+ else
+ {
+ switch(tgt->GetPolicyStatusCMP0021())
+ {
+ case cmPolicies::WARN:
+ {
+ e << (mf->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0021)) << "\n";
+ messageType = cmake::AUTHOR_WARNING;
+ }
+ break;
+ case cmPolicies::OLD:
+ noMessage = true;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ // Issue the fatal message.
+ break;
+ }
+ e << "Found relative path while evaluating include directories of "
+ "\"" << tgt->GetName() << "\":\n \"" << *li << "\"\n";
+ }
+ if (!noMessage)
+ {
+ tgt->GetMakefile()->IssueMessage(messageType, e.str().c_str());
+ if (messageType == cmake::FATAL_ERROR)
+ {
+ return;
+ }
+ }
+ }
+
+ if (testIsOff && !cmSystemTools::IsOff(li->c_str()))
+ {
+ cmSystemTools::ConvertToUnixSlashes(*li);
+ }
+ std::string inc = *li;
+
+ if(uniqueIncludes.insert(inc).second)
+ {
+ includes.push_back(inc);
+ if (debugIncludes)
+ {
+ usedIncludes += " * " + inc + "\n";
+ }
+ }
+ }
+ if (cacheIncludes)
+ {
+ (*it)->CachedEntries = entryIncludes;
+ }
+ if (!usedIncludes.empty())
+ {
+ mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
+ std::string("Used includes for target ")
+ + tgt->GetName() + ":\n"
+ + usedIncludes, (*it)->ge->GetBacktrace());
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
std::vector<std::string>
cmGeneratorTarget::GetIncludeDirectories(const char *config) const
{
- return this->Target->GetIncludeDirectories(config);
+ std::vector<std::string> includes;
+ std::set<std::string> uniqueIncludes;
+ cmListFileBacktrace lfbt;
+
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt,
+ this->GetName(),
+ "INCLUDE_DIRECTORIES", 0, 0);
+
+ std::vector<std::string> debugProperties;
+ const char *debugProp =
+ this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
+ if (debugProp)
+ {
+ cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ }
+
+ bool debugIncludes = !this->DebugIncludesDone
+ && std::find(debugProperties.begin(),
+ debugProperties.end(),
+ "INCLUDE_DIRECTORIES")
+ != debugProperties.end();
+
+ if (this->Makefile->IsGeneratingBuildSystem())
+ {
+ this->DebugIncludesDone = true;
+ }
+
+ processIncludeDirectories(this->Target,
+ this->Target->GetIncludeDirectoriesEntries(),
+ includes,
+ uniqueIncludes,
+ &dagChecker,
+ config,
+ debugIncludes);
+
+ std::string configString = config ? config : "";
+ if (!this->CacheLinkInterfaceIncludeDirectoriesDone[configString])
+ {
+ for (std::vector<cmValueWithOrigin>::const_iterator
+ it = this->Target->GetLinkImplementationPropertyEntries().begin(),
+ end = this->Target->GetLinkImplementationPropertyEntries().end();
+ it != end; ++it)
+ {
+ if (!cmGeneratorExpression::IsValidTargetName(it->Value)
+ && cmGeneratorExpression::Find(it->Value) == std::string::npos)
+ {
+ continue;
+ }
+ {
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(it->Value);
+ std::string result = cge->Evaluate(this->Makefile, config,
+ false, this->Target, 0, 0);
+ if (!this->Makefile->FindTargetToUse(result.c_str()))
+ {
+ continue;
+ }
+ }
+ std::string includeGenex = "$<TARGET_PROPERTY:" +
+ it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>";
+ if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
+ {
+ // Because it->Value is a generator expression, ensure that it
+ // evaluates to the non-empty string before being used in the
+ // TARGET_PROPERTY expression.
+ includeGenex = "$<$<BOOL:" + it->Value + ">:" + includeGenex + ">";
+ }
+ cmGeneratorExpression ge(it->Backtrace);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
+ includeGenex);
+
+ this
+ ->CachedLinkInterfaceIncludeDirectoriesEntries[configString].push_back(
+ new cmGeneratorTarget::TargetPropertyEntry(cge,
+ it->Value));
+ }
+
+ if(this->Makefile->IsOn("APPLE"))
+ {
+ cmTarget::LinkImplementation const* impl =
+ this->Target->GetLinkImplementation(config, this->Target);
+ for(std::vector<std::string>::const_iterator
+ it = impl->Libraries.begin();
+ it != impl->Libraries.end(); ++it)
+ {
+ std::string libDir = cmSystemTools::CollapseFullPath(it->c_str());
+
+ static cmsys::RegularExpression
+ frameworkCheck("(.*\\.framework)(/Versions/[^/]+)?/[^/]+$");
+ if(!frameworkCheck.find(libDir))
+ {
+ continue;
+ }
+
+ libDir = frameworkCheck.match(1);
+
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(libDir.c_str());
+ this->CachedLinkInterfaceIncludeDirectoriesEntries[configString]
+ .push_back(new cmGeneratorTarget::TargetPropertyEntry(cge));
+ }
+ }
+ }
+
+ processIncludeDirectories(this->Target,
+ this->CachedLinkInterfaceIncludeDirectoriesEntries[configString],
+ includes,
+ uniqueIncludes,
+ &dagChecker,
+ config,
+ debugIncludes);
+
+ if (!this->Makefile->IsGeneratingBuildSystem())
+ {
+ deleteAndClear2(
+ this->CachedLinkInterfaceIncludeDirectoriesEntries);
+ }
+ else
+ {
+ this->CacheLinkInterfaceIncludeDirectoriesDone[configString]
+ = true;
+ }
+
+ return includes;
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index a6fb522..b7f2ad6 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -13,6 +13,7 @@
#define cmGeneratorTarget_h
#include "cmStandardIncludes.h"
+#include "cmGeneratorExpression.h"
class cmCustomCommand;
class cmGlobalGenerator;
@@ -26,6 +27,8 @@ class cmGeneratorTarget
public:
cmGeneratorTarget(cmTarget*);
+ ~cmGeneratorTarget();
+
bool IsImported() const;
const char *GetLocation(const char* config) const;
const char *NormalGetLocation(const char* config) const;
@@ -100,6 +103,16 @@ public:
/** Get sources that must be built before the given source. */
std::vector<cmSourceFile*> const* GetSourceDepends(cmSourceFile* sf) const;
+ struct TargetPropertyEntry {
+ TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge,
+ const std::string &targetName = std::string())
+ : ge(cge), TargetName(targetName)
+ {}
+ const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge;
+ std::vector<std::string> CachedEntries;
+ const std::string TargetName;
+ };
+
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
@@ -118,6 +131,10 @@ private:
std::vector<cmSourceFile*> ObjectSources;
std::vector<cmTarget*> ObjectLibraries;
mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache;
+ mutable bool DebugIncludesDone;
+ mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
+ CachedLinkInterfaceIncludeDirectoriesEntries;
+ mutable std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
cmGeneratorTarget(cmGeneratorTarget const&);
void operator=(cmGeneratorTarget const&);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 38933ea..8240dfd 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -125,33 +125,37 @@ public:
LinkClosureMapType;
LinkClosureMapType LinkClosureMap;
- struct TargetPropertyEntry {
- TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge,
- const std::string &targetName = std::string())
- : ge(cge), TargetName(targetName)
- {}
- const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge;
- std::vector<std::string> CachedEntries;
- const std::string TargetName;
- };
+ typedef cmGeneratorTarget::TargetPropertyEntry TargetPropertyEntry;
+
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries;
mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
- CachedLinkInterfaceIncludeDirectoriesEntries;
- mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
CachedLinkInterfaceCompileOptionsEntries;
mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
CachedLinkInterfaceCompileDefinitionsEntries;
- mutable std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
mutable std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone;
mutable std::map<std::string, bool> CacheLinkInterfaceCompileOptionsDone;
};
//----------------------------------------------------------------------------
+const std::vector<cmValueWithOrigin>&
+cmTarget::GetLinkImplementationPropertyEntries()
+{
+ return this->Internal->LinkImplementationPropertyEntries;
+}
+
+//----------------------------------------------------------------------------
+const std::vector<cmGeneratorTarget::TargetPropertyEntry*>&
+cmTarget::GetIncludeDirectoriesEntries()
+{
+ return this->Internal->IncludeDirectoriesEntries;
+}
+
+//----------------------------------------------------------------------------
void deleteAndClear(
std::vector<cmTargetInternals::TargetPropertyEntry*> &entries)
{
@@ -181,7 +185,6 @@ void deleteAndClear(
//----------------------------------------------------------------------------
cmTargetInternals::~cmTargetInternals()
{
- deleteAndClear(this->CachedLinkInterfaceIncludeDirectoriesEntries);
deleteAndClear(this->CachedLinkInterfaceCompileOptionsEntries);
deleteAndClear(this->CachedLinkInterfaceCompileDefinitionsEntries);
}
@@ -203,7 +206,6 @@ cmTarget::cmTarget()
this->IsApple = false;
this->IsImportedTarget = false;
this->BuildInterfaceIncludesAppended = false;
- this->DebugIncludesDone = false;
this->DebugCompileOptionsDone = false;
this->DebugCompileDefinitionsDone = false;
}
@@ -1614,308 +1616,6 @@ void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry,
}
//----------------------------------------------------------------------------
-static void processIncludeDirectories(cmTarget const* tgt,
- const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
- std::vector<std::string> &includes,
- std::set<std::string> &uniqueIncludes,
- cmGeneratorExpressionDAGChecker *dagChecker,
- const char *config, bool debugIncludes)
-{
- cmMakefile *mf = tgt->GetMakefile();
-
- for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator
- it = entries.begin(), end = entries.end(); it != end; ++it)
- {
- bool testIsOff = true;
- bool cacheIncludes = false;
- std::vector<std::string> entryIncludes = (*it)->CachedEntries;
- if(!entryIncludes.empty())
- {
- testIsOff = false;
- }
- else
- {
- cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf,
- config,
- false,
- tgt,
- dagChecker),
- entryIncludes);
- if (mf->IsGeneratingBuildSystem()
- && !(*it)->ge->GetHadContextSensitiveCondition())
- {
- cacheIncludes = true;
- }
- }
- std::string usedIncludes;
- cmListFileBacktrace lfbt;
- for(std::vector<std::string>::iterator
- li = entryIncludes.begin(); li != entryIncludes.end(); ++li)
- {
- std::string targetName = (*it)->TargetName;
- std::string evaluatedTargetName;
- {
- cmGeneratorExpression ge(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(targetName);
- evaluatedTargetName = cge->Evaluate(mf, config, false, tgt, 0, 0);
- }
-
- cmTarget *dependentTarget = mf->FindTargetToUse(targetName.c_str());
-
- const bool fromImported = dependentTarget
- && dependentTarget->IsImported();
-
- cmTarget *evaluatedDependentTarget =
- (targetName != evaluatedTargetName)
- ? mf->FindTargetToUse(evaluatedTargetName.c_str())
- : 0;
-
- targetName = evaluatedTargetName;
-
- const bool fromEvaluatedImported = evaluatedDependentTarget
- && evaluatedDependentTarget->IsImported();
-
- if ((fromImported || fromEvaluatedImported)
- && !cmSystemTools::FileExists(li->c_str()))
- {
- cmOStringStream e;
- cmake::MessageType messageType = cmake::FATAL_ERROR;
- if (fromEvaluatedImported)
- {
- switch(mf->GetPolicyStatus(cmPolicies::CMP0027))
- {
- case cmPolicies::WARN:
- e << (mf->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0027)) << "\n";
- case cmPolicies::OLD:
- messageType = cmake::AUTHOR_WARNING;
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- break;
- }
- }
- e << "Imported target \"" << targetName << "\" includes "
- "non-existent path\n \"" << *li << "\"\nin its "
- "INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:\n"
- "* The path was deleted, renamed, or moved to another "
- "location.\n"
- "* An install or uninstall procedure did not complete "
- "successfully.\n"
- "* The installation package was faulty and references files it "
- "does not provide.\n";
- tgt->GetMakefile()->IssueMessage(messageType, e.str().c_str());
- return;
- }
-
- if (!cmSystemTools::FileIsFullPath(li->c_str()))
- {
- cmOStringStream e;
- bool noMessage = false;
- cmake::MessageType messageType = cmake::FATAL_ERROR;
- if (!targetName.empty())
- {
- e << "Target \"" << targetName << "\" contains relative "
- "path in its INTERFACE_INCLUDE_DIRECTORIES:\n"
- " \"" << *li << "\"";
- }
- else
- {
- switch(tgt->GetPolicyStatusCMP0021())
- {
- case cmPolicies::WARN:
- {
- e << (mf->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0021)) << "\n";
- messageType = cmake::AUTHOR_WARNING;
- }
- break;
- case cmPolicies::OLD:
- noMessage = true;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- // Issue the fatal message.
- break;
- }
- e << "Found relative path while evaluating include directories of "
- "\"" << tgt->GetName() << "\":\n \"" << *li << "\"\n";
- }
- if (!noMessage)
- {
- tgt->GetMakefile()->IssueMessage(messageType, e.str().c_str());
- if (messageType == cmake::FATAL_ERROR)
- {
- return;
- }
- }
- }
-
- if (testIsOff && !cmSystemTools::IsOff(li->c_str()))
- {
- cmSystemTools::ConvertToUnixSlashes(*li);
- }
- std::string inc = *li;
-
- if(uniqueIncludes.insert(inc).second)
- {
- includes.push_back(inc);
- if (debugIncludes)
- {
- usedIncludes += " * " + inc + "\n";
- }
- }
- }
- if (cacheIncludes)
- {
- (*it)->CachedEntries = entryIncludes;
- }
- if (!usedIncludes.empty())
- {
- mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
- std::string("Used includes for target ")
- + tgt->GetName() + ":\n"
- + usedIncludes, (*it)->ge->GetBacktrace());
- }
- }
-}
-
-//----------------------------------------------------------------------------
-std::vector<std::string>
-cmTarget::GetIncludeDirectories(const char *config) const
-{
- std::vector<std::string> includes;
- std::set<std::string> uniqueIncludes;
- cmListFileBacktrace lfbt;
-
- cmGeneratorExpressionDAGChecker dagChecker(lfbt,
- this->GetName(),
- "INCLUDE_DIRECTORIES", 0, 0);
-
- std::vector<std::string> debugProperties;
- const char *debugProp =
- this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
- if (debugProp)
- {
- cmSystemTools::ExpandListArgument(debugProp, debugProperties);
- }
-
- bool debugIncludes = !this->DebugIncludesDone
- && std::find(debugProperties.begin(),
- debugProperties.end(),
- "INCLUDE_DIRECTORIES")
- != debugProperties.end();
-
- if (this->Makefile->IsGeneratingBuildSystem())
- {
- this->DebugIncludesDone = true;
- }
-
- processIncludeDirectories(this,
- this->Internal->IncludeDirectoriesEntries,
- includes,
- uniqueIncludes,
- &dagChecker,
- config,
- debugIncludes);
-
- std::string configString = config ? config : "";
- if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[configString])
- {
- for (std::vector<cmValueWithOrigin>::const_iterator
- it = this->Internal->LinkImplementationPropertyEntries.begin(),
- end = this->Internal->LinkImplementationPropertyEntries.end();
- it != end; ++it)
- {
- if (!cmGeneratorExpression::IsValidTargetName(it->Value)
- && cmGeneratorExpression::Find(it->Value) == std::string::npos)
- {
- continue;
- }
- {
- cmGeneratorExpression ge(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(it->Value);
- std::string result = cge->Evaluate(this->Makefile, config,
- false, this, 0, 0);
- if (!this->Makefile->FindTargetToUse(result.c_str()))
- {
- continue;
- }
- }
- std::string includeGenex = "$<TARGET_PROPERTY:" +
- it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>";
- if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
- {
- // Because it->Value is a generator expression, ensure that it
- // evaluates to the non-empty string before being used in the
- // TARGET_PROPERTY expression.
- includeGenex = "$<$<BOOL:" + it->Value + ">:" + includeGenex + ">";
- }
- cmGeneratorExpression ge(it->Backtrace);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
- includeGenex);
-
- this->Internal
- ->CachedLinkInterfaceIncludeDirectoriesEntries[configString].push_back(
- new cmTargetInternals::TargetPropertyEntry(cge,
- it->Value));
- }
-
- if(this->Makefile->IsOn("APPLE"))
- {
- LinkImplementation const* impl = this->GetLinkImplementation(config,
- this);
- for(std::vector<std::string>::const_iterator
- it = impl->Libraries.begin();
- it != impl->Libraries.end(); ++it)
- {
- std::string libDir = cmSystemTools::CollapseFullPath(it->c_str());
-
- static cmsys::RegularExpression
- frameworkCheck("(.*\\.framework)(/Versions/[^/]+)?/[^/]+$");
- if(!frameworkCheck.find(libDir))
- {
- continue;
- }
-
- libDir = frameworkCheck.match(1);
-
- cmGeneratorExpression ge(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(libDir.c_str());
- this->Internal
- ->CachedLinkInterfaceIncludeDirectoriesEntries[configString]
- .push_back(new cmTargetInternals::TargetPropertyEntry(cge));
- }
- }
- }
-
- processIncludeDirectories(this,
- this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[configString],
- includes,
- uniqueIncludes,
- &dagChecker,
- config,
- debugIncludes);
-
- if (!this->Makefile->IsGeneratingBuildSystem())
- {
- deleteAndClear(
- this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries);
- }
- else
- {
- this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[configString]
- = true;
- }
-
- return includes;
-}
-
-//----------------------------------------------------------------------------
static void processCompileOptionsInternal(cmTarget const* tgt,
const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
std::vector<std::string> &options,
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index a438525..955773d 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -16,6 +16,7 @@
#include "cmPropertyMap.h"
#include "cmPolicies.h"
#include "cmListFileCache.h"
+#include "cmGeneratorTarget.h"
#include <cmsys/auto_ptr.hxx>
@@ -568,6 +569,11 @@ public:
const std::string &report,
const std::string &compatibilityType) const;
+ const std::vector<cmValueWithOrigin>& GetLinkImplementationPropertyEntries();
+ const std::vector<cmGeneratorTarget::TargetPropertyEntry*>&
+ GetIncludeDirectoriesEntries();
+
+
private:
bool HandleLocationPropertyPolicy() const;
@@ -678,7 +684,6 @@ private:
bool DLLPlatform;
bool IsApple;
bool IsImportedTarget;
- mutable bool DebugIncludesDone;
mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
mutable bool DebugCompileOptionsDone;
mutable bool DebugCompileDefinitionsDone;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1699ae1bf34147fc569ee82670a403724082bfd4
commit 1699ae1bf34147fc569ee82670a403724082bfd4
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Oct 6 17:51:07 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:05 2014 +0100
Port some of the cmExportFileGenerator API to cmGeneratorTarget.
Enough to make it more possible to move GetLinkInterface
to cmGeneratorTarget.
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 4be2531..09522ea 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -140,12 +140,12 @@ cmExportBuildFileGenerator
if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
this->SetImportDetailProperties(config, suffix,
- target->Target,
+ target,
properties, missingTargets);
this->SetImportLinkInterface(config, suffix,
- cmGeneratorExpression::BuildInterface,
- target->Target,
- properties, missingTargets);
+ cmGeneratorExpression::BuildInterface,
+ target,
+ properties, missingTargets);
}
// TOOD: PUBLIC_HEADER_LOCATION
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 13bff19..f58e292 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -686,12 +686,13 @@ void
cmExportFileGenerator
::SetImportLinkInterface(const char* config, std::string const& suffix,
cmGeneratorExpression::PreprocessContext preprocessRule,
- cmTarget* target, ImportPropertyMap& properties,
+ cmGeneratorTarget* target, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets)
{
// Add the transitive link dependencies for this configuration.
- cmTarget::LinkInterface const* iface = target->GetLinkInterface(config,
- target);
+ cmTarget::LinkInterface const* iface = target->Target->GetLinkInterface(
+ config,
+ target->Target);
if (!iface)
{
return;
@@ -724,12 +725,14 @@ cmExportFileGenerator
}
const bool newCMP0022Behavior =
- target->GetPolicyStatusCMP0022() != cmPolicies::WARN
- && target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
+ target->Target
+ ->GetPolicyStatusCMP0022() != cmPolicies::WARN
+ && target->Target
+ ->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if(newCMP0022Behavior && !this->ExportOld)
{
- cmMakefile *mf = target->GetMakefile();
+ cmMakefile *mf = target->Target->GetMakefile();
cmOStringStream e;
e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, "
"but also has old-style LINK_INTERFACE_LIBRARIES properties "
@@ -749,7 +752,7 @@ cmExportFileGenerator
preprocessRule);
if (!prepro.empty())
{
- this->ResolveTargetsInGeneratorExpressions(prepro, target,
+ this->ResolveTargetsInGeneratorExpressions(prepro, target->Target,
missingTargets,
ReplaceFreeTargets);
properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = prepro;
@@ -760,12 +763,13 @@ cmExportFileGenerator
void
cmExportFileGenerator
::SetImportDetailProperties(const char* config, std::string const& suffix,
- cmTarget* target, ImportPropertyMap& properties,
+ cmGeneratorTarget* target,
+ ImportPropertyMap& properties,
std::vector<std::string>& missingTargets
)
{
// Get the makefile in which to lookup target information.
- cmMakefile* mf = target->GetMakefile();
+ cmMakefile* mf = target->Makefile;
// Add the soname for unix shared libraries.
if(target->GetType() == cmTarget::SHARED_LIBRARY ||
@@ -778,14 +782,14 @@ cmExportFileGenerator
{
std::string prop;
std::string value;
- if(target->HasSOName(config))
+ if(target->Target->HasSOName(config))
{
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
- value = this->InstallNameDir(target, config);
+ value = this->InstallNameDir(target->Target, config);
}
prop = "IMPORTED_SONAME";
- value += target->GetSOName(config);
+ value += target->Target->GetSOName(config);
}
else
{
@@ -798,8 +802,9 @@ cmExportFileGenerator
}
// Add the transitive link dependencies for this configuration.
- if(cmTarget::LinkInterface const* iface = target->GetLinkInterface(config,
- target))
+ if(cmTarget::LinkInterface const* iface =
+ target->Target
+ ->GetLinkInterface(config, target->Target))
{
this->SetImportLinkProperty(suffix, target,
"IMPORTED_LINK_INTERFACE_LANGUAGES",
@@ -824,7 +829,7 @@ cmExportFileGenerator
void
cmExportFileGenerator
::SetImportLinkProperty(std::string const& suffix,
- cmTarget* target,
+ cmGeneratorTarget* target,
const char* propName,
std::vector<std::string> const& entries,
ImportPropertyMap& properties,
@@ -848,7 +853,7 @@ cmExportFileGenerator
sep = ";";
std::string temp = *li;
- this->AddTargetNamespace(temp, target, missingTargets);
+ this->AddTargetNamespace(temp, target->Target, missingTargets);
link_entries += temp;
}
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index 1438f4d..b0a382c 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -77,11 +77,12 @@ protected:
// Collect properties with detailed information about targets beyond
// their location on disk.
void SetImportDetailProperties(const char* config,
- std::string const& suffix, cmTarget* target,
+ std::string const& suffix,
+ cmGeneratorTarget* target,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
void SetImportLinkProperty(std::string const& suffix,
- cmTarget* target, const char* propName,
+ cmGeneratorTarget* target, const char* propName,
std::vector<std::string> const& entries,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
@@ -125,7 +126,7 @@ protected:
void SetImportLinkInterface(const char* config, std::string const& suffix,
cmGeneratorExpression::PreprocessContext preprocessRule,
- cmTarget* target, ImportPropertyMap& properties,
+ cmGeneratorTarget* target, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
enum FreeTargetsReplace {
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 73e9b31..da13a21 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -331,12 +331,14 @@ cmExportInstallFileGenerator
if(!properties.empty())
{
// Get the rest of the target details.
+ cmGeneratorTarget *gtgt = te->Target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()->GetGeneratorTarget(te->Target);
this->SetImportDetailProperties(config, suffix,
- te->Target, properties, missingTargets);
+ gtgt, properties, missingTargets);
this->SetImportLinkInterface(config, suffix,
cmGeneratorExpression::InstallInterface,
- te->Target, properties, missingTargets);
+ gtgt, properties, missingTargets);
// TOOD: PUBLIC_HEADER_LOCATION
// This should wait until the build feature propagation stuff
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d4aae11c7d5d2f97ab2058d4b0c69914105f5999
commit d4aae11c7d5d2f97ab2058d4b0c69914105f5999
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Oct 6 17:44:17 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:05 2014 +0100
Port cmExportBuildFileGenerator to cmGeneratorTarget.
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index c53c795..4be2531 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -35,10 +35,11 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
tei = targets.begin();
tei != targets.end(); ++tei)
{
- cmTarget *te = this->Makefile->FindTargetToUse(tei->c_str());
- expectedTargets += sep + this->Namespace + te->GetExportName();
+ cmGeneratorTarget *te = this->Makefile
+ ->FindGeneratorTargetToUse(tei->c_str());
+ expectedTargets += sep + this->Namespace + te->Target->GetExportName();
sep = " ";
- if(this->ExportedTargets.insert(te).second)
+ if(this->ExportedTargets.insert(te->Target).second)
{
this->Exports.push_back(te);
}
@@ -62,11 +63,11 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
std::vector<std::string> missingTargets;
// Create all the imported targets.
- for(std::vector<cmTarget*>::const_iterator
+ for(std::vector<cmGeneratorTarget*>::const_iterator
tei = this->Exports.begin();
tei != this->Exports.end(); ++tei)
{
- cmTarget* te = *tei;
+ cmTarget* te = (*tei)->Target;
this->GenerateImportTargetCode(os, te);
te->AppendBuildInterfaceIncludes();
@@ -121,12 +122,12 @@ cmExportBuildFileGenerator
const char* config, std::string const& suffix,
std::vector<std::string> &missingTargets)
{
- for(std::vector<cmTarget*>::const_iterator
+ for(std::vector<cmGeneratorTarget*>::const_iterator
tei = this->Exports.begin();
tei != this->Exports.end(); ++tei)
{
// Collect import properties for this target.
- cmTarget* target = *tei;
+ cmGeneratorTarget* target = *tei;
ImportPropertyMap properties;
if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
@@ -139,10 +140,12 @@ cmExportBuildFileGenerator
if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
this->SetImportDetailProperties(config, suffix,
- target, properties, missingTargets);
+ target->Target,
+ properties, missingTargets);
this->SetImportLinkInterface(config, suffix,
- cmGeneratorExpression::BuildInterface,
- target, properties, missingTargets);
+ cmGeneratorExpression::BuildInterface,
+ target->Target,
+ properties, missingTargets);
}
// TOOD: PUBLIC_HEADER_LOCATION
@@ -152,7 +155,8 @@ cmExportBuildFileGenerator
// properties);
// Generate code in the export file.
- this->GenerateImportPropertyCode(os, config, target, properties);
+ this->GenerateImportPropertyCode(os, config, target->Target,
+ properties);
}
}
}
@@ -167,25 +171,24 @@ void cmExportBuildFileGenerator::SetExportSet(cmExportSet *exportSet)
void
cmExportBuildFileGenerator
::SetImportLocationProperty(const char* config, std::string const& suffix,
- cmTarget* target, ImportPropertyMap& properties)
+ cmGeneratorTarget* target,
+ ImportPropertyMap& properties)
{
// Get the makefile in which to lookup target information.
- cmMakefile* mf = target->GetMakefile();
-
- cmGeneratorTarget gtgt(target);
+ cmMakefile* mf = target->Makefile;
// Add the main target file.
{
std::string prop = "IMPORTED_LOCATION";
prop += suffix;
std::string value;
- if(target->IsAppBundleOnApple())
+ if(target->Target->IsAppBundleOnApple())
{
- value = gtgt.GetFullPath(config, false);
+ value = target->GetFullPath(config, false);
}
else
{
- value = gtgt.GetFullPath(config, false, true);
+ value = target->GetFullPath(config, false, true);
}
properties[prop] = value;
}
@@ -197,13 +200,13 @@ cmExportBuildFileGenerator
// Add the import library for windows DLLs.
if(dll_platform &&
(target->GetType() == cmTarget::SHARED_LIBRARY ||
- target->IsExecutableWithExports()) &&
+ target->Target->IsExecutableWithExports()) &&
mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"))
{
std::string prop = "IMPORTED_IMPLIB";
prop += suffix;
- std::string value = gtgt.GetFullPath(config, true);
- target->GetImplibGNUtoMS(value, value,
+ std::string value = target->GetFullPath(config, true);
+ target->Target->GetImplibGNUtoMS(value, value,
"${CMAKE_IMPORT_LIBRARY_SUFFIX}");
properties[prop] = value;
}
diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h
index cea2099..9f23b6b 100644
--- a/Source/cmExportBuildFileGenerator.h
+++ b/Source/cmExportBuildFileGenerator.h
@@ -68,7 +68,7 @@ protected:
/** Fill in properties indicating built file locations. */
void SetImportLocationProperty(const char* config,
std::string const& suffix,
- cmTarget* target,
+ cmGeneratorTarget* target,
ImportPropertyMap& properties);
std::string InstallNameDir(cmTarget* target, const std::string& config);
@@ -78,7 +78,7 @@ protected:
std::vector<std::string> Targets;
cmExportSet *ExportSet;
- std::vector<cmTarget*> Exports;
+ std::vector<cmGeneratorTarget*> Exports;
cmMakefile* Makefile;
cmListFileBacktrace Backtrace;
};
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90ac11b74636c7b622ad57793dbdf20c4fa562c9
commit 90ac11b74636c7b622ad57793dbdf20c4fa562c9
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Oct 6 18:30:43 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:05 2014 +0100
Move GetFullPath to cmGeneratorTarget
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 6986965..c0b45da 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -547,10 +547,13 @@ bool cmComputeLinkInformation::Compute()
i != wrongItems.end(); ++i)
{
cmTarget const* tgt = *i;
+ cmGeneratorTarget *gtgt = tgt->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(tgt);
bool implib =
(this->UseImportLibrary &&
(tgt->GetType() == cmTarget::SHARED_LIBRARY));
- std::string lib = tgt->GetFullPath(this->Config , implib, true);
+ std::string lib = gtgt->GetFullPath(this->Config , implib, true);
this->OldLinkDirItems.push_back(lib);
}
}
@@ -635,6 +638,9 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
if(tgt && tgt->IsLinkable())
{
+ cmGeneratorTarget *gtgt = tgt->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(tgt);
// This is a CMake target. Ask the target for its real name.
if(impexe && this->LoaderFlag)
{
@@ -643,7 +649,8 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
// platform. Add it now.
std::string linkItem;
linkItem = this->LoaderFlag;
- std::string exe = tgt->GetFullPath(config, this->UseImportLibrary,
+
+ std::string exe = gtgt->GetFullPath(config, this->UseImportLibrary,
true);
linkItem += exe;
this->Items.push_back(Item(linkItem, true, tgt));
@@ -662,7 +669,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
return;
}
// Pass the full path to the target file.
- std::string lib = tgt->GetFullPath(config, implib, true);
+ std::string lib = gtgt->GetFullPath(config, implib, true);
if(!this->LinkDependsNoShared ||
tgt->GetType() != cmTarget::SHARED_LIBRARY)
{
@@ -751,7 +758,10 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
std::string lib;
if(tgt)
{
- lib = tgt->GetFullPath(this->Config, this->UseImportLibrary);
+ cmGeneratorTarget *gtgt = tgt->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(tgt);
+ lib = gtgt->GetFullPath(this->Config, this->UseImportLibrary);
this->AddLibraryRuntimeInfo(lib, tgt);
}
else
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index b669cd1..c53c795 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -172,6 +172,8 @@ cmExportBuildFileGenerator
// Get the makefile in which to lookup target information.
cmMakefile* mf = target->GetMakefile();
+ cmGeneratorTarget gtgt(target);
+
// Add the main target file.
{
std::string prop = "IMPORTED_LOCATION";
@@ -179,11 +181,11 @@ cmExportBuildFileGenerator
std::string value;
if(target->IsAppBundleOnApple())
{
- value = target->GetFullPath(config, false);
+ value = gtgt.GetFullPath(config, false);
}
else
{
- value = target->GetFullPath(config, false, true);
+ value = gtgt.GetFullPath(config, false, true);
}
properties[prop] = value;
}
@@ -200,7 +202,7 @@ cmExportBuildFileGenerator
{
std::string prop = "IMPORTED_IMPLIB";
prop += suffix;
- std::string value = target->GetFullPath(config, true);
+ std::string value = gtgt.GetFullPath(config, true);
target->GetImplibGNUtoMS(value, value,
"${CMAKE_IMPORT_LIBRARY_SUFFIX}");
properties[prop] = value;
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 1feb03a..8f50b0c 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -1354,7 +1354,7 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode
template<bool linker, bool soname>
struct TargetFilesystemArtifactResultCreator
{
- static std::string Create(cmTarget* target,
+ static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *content);
};
@@ -1363,12 +1363,12 @@ struct TargetFilesystemArtifactResultCreator
template<>
struct TargetFilesystemArtifactResultCreator<false, true>
{
- static std::string Create(cmTarget* target,
+ static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *content)
{
// The target soname file (.so.1).
- if(target->IsDLLPlatform())
+ if(target->Target->IsDLLPlatform())
{
::reportError(context, content->GetOriginalExpression(),
"TARGET_SONAME_FILE is not allowed "
@@ -1382,9 +1382,9 @@ struct TargetFilesystemArtifactResultCreator<false, true>
"SHARED libraries.");
return std::string();
}
- std::string result = target->GetDirectory(context->Config);
+ std::string result = target->Target->GetDirectory(context->Config);
result += "/";
- result += target->GetSOName(context->Config);
+ result += target->Target->GetSOName(context->Config);
return result;
}
};
@@ -1393,12 +1393,12 @@ struct TargetFilesystemArtifactResultCreator<false, true>
template<>
struct TargetFilesystemArtifactResultCreator<true, false>
{
- static std::string Create(cmTarget* target,
+ static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *content)
{
// The file used to link to the target (.so, .lib, .a).
- if(!target->IsLinkable())
+ if(!target->Target->IsLinkable())
{
::reportError(context, content->GetOriginalExpression(),
"TARGET_LINKER_FILE is allowed only for libraries and "
@@ -1406,7 +1406,7 @@ struct TargetFilesystemArtifactResultCreator<true, false>
return std::string();
}
return target->GetFullPath(context->Config,
- target->HasImportLibrary());
+ target->Target->HasImportLibrary());
}
};
@@ -1414,7 +1414,7 @@ struct TargetFilesystemArtifactResultCreator<true, false>
template<>
struct TargetFilesystemArtifactResultCreator<false, false>
{
- static std::string Create(cmTarget* target,
+ static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *)
{
@@ -1476,7 +1476,8 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
"Expression syntax not recognized.");
return std::string();
}
- cmTarget* target = context->Makefile->FindTargetToUse(name.c_str());
+ cmGeneratorTarget* target
+ = context->Makefile->FindGeneratorTargetToUse(name.c_str());
if(!target)
{
::reportError(context, content->GetOriginalExpression(),
@@ -1497,8 +1498,8 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
"be used while evaluating link libraries");
return std::string();
}
- context->DependTargets.insert(target);
- context->AllTargets.insert(target);
+ context->DependTargets.insert(target->Target);
+ context->AllTargets.insert(target->Target);
std::string result =
TargetFilesystemArtifactResultCreator<linker, soname>::Create(
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 19a641b..d93066d 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -205,7 +205,7 @@ const char* cmGeneratorTarget::NormalGetLocation(const char* config) const
static std::string location;
if(config)
{
- location = this->Target->GetFullPath(config, false);
+ location = this->GetFullPath(config, false);
return location.c_str();
}
@@ -917,6 +917,87 @@ void cmGeneratorTarget::GenerateTargetManifest(const char* config) const
}
}
+//----------------------------------------------------------------------------
+std::string cmGeneratorTarget::GetFullPath(const char* config,
+ bool implib, bool realname) const
+{
+ if(this->Target->IsImported())
+ {
+ return this->Target->ImportedGetFullPath(config, implib);
+ }
+ else
+ {
+ return this->NormalGetFullPath(config, implib, realname);
+ }
+}
+
+std::string cmGeneratorTarget::NormalGetFullPath(const char* config,
+ bool implib,
+ bool realname) const
+{
+ std::string fpath = this->Target->GetDirectory(config, implib);
+ fpath += "/";
+ if(this->Target->IsAppBundleOnApple())
+ {
+ fpath = this->Target->BuildMacContentDirectory(fpath, config, false);
+ fpath += "/";
+ }
+
+ // Add the full name of the target.
+ if(implib)
+ {
+ fpath += this->Target->GetFullName(config, true);
+ }
+ else if(realname)
+ {
+ fpath += this->NormalGetRealName(config);
+ }
+ else
+ {
+ fpath += this->Target->GetFullName(config, false);
+ }
+ return fpath;
+}
+
+//----------------------------------------------------------------------------
+std::string cmGeneratorTarget::NormalGetRealName(const char* config) const
+{
+ // This should not be called for imported targets.
+ // TODO: Split cmTarget into a class hierarchy to get compile-time
+ // enforcement of the limited imported target API.
+ if(this->Target->IsImported())
+ {
+ std::string msg = "NormalGetRealName called on imported target: ";
+ msg += this->GetName();
+ this->Makefile->
+ IssueMessage(cmake::INTERNAL_ERROR,
+ msg.c_str());
+ }
+
+ if(this->GetType() == cmTarget::EXECUTABLE)
+ {
+ // Compute the real name that will be built.
+ std::string name;
+ std::string realName;
+ std::string impName;
+ std::string pdbName;
+ this->Target->GetExecutableNames(name, realName, impName, pdbName, config);
+ return realName;
+ }
+ else
+ {
+ // Compute the real name that will be built.
+ std::string name;
+ std::string soName;
+ std::string realName;
+ std::string impName;
+ std::string pdbName;
+ this->Target->GetLibraryNames(name, soName, realName,
+ impName, pdbName, config);
+ return realName;
+ }
+}
+
bool cmStrictTargetComparison::operator()(cmTarget const* t1,
cmTarget const* t2) const
{
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 9fcb13b..a6fb522 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -51,6 +51,14 @@ public:
void GetCustomCommands(std::vector<cmSourceFile*>&) const;
void GetExpectedResxHeaders(std::set<std::string>&) const;
+ /** Get the full path to the target according to the settings in its
+ makefile and the configuration type. */
+ std::string GetFullPath(const char* config=0, bool implib = false,
+ bool realname = false) const;
+ std::string NormalGetFullPath(const char* config, bool implib,
+ bool realname) const;
+ std::string NormalGetRealName(const char* config) const;
+
cmTarget* Target;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index ec91b0f..a53cd9b 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -850,10 +850,14 @@ cmGlobalNinjaGenerator
case cmTarget::SHARED_LIBRARY:
case cmTarget::STATIC_LIBRARY:
case cmTarget::MODULE_LIBRARY:
+ {
+ cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
outputs.push_back(ng->ConvertToNinjaPath(
- target->GetFullPath(configName, false, realname).c_str()));
+ gtgt->GetFullPath(configName, false, realname).c_str()));
break;
-
+ }
case cmTarget::OBJECT_LIBRARY:
case cmTarget::UTILITY: {
std::string path = ng->ConvertToNinjaPath(
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index f7a42fc..df7aea3 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3501,6 +3501,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
{
cmXCodeObject* target = *i;
cmTarget* t =target->GetTarget();
+ cmGeneratorTarget *gt = this->GetGeneratorTarget(t);
if(t->GetType() == cmTarget::EXECUTABLE ||
// Nope - no post-build for OBJECT_LIRBRARY
@@ -3518,7 +3519,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
t->GetType() == cmTarget::SHARED_LIBRARY ||
t->GetType() == cmTarget::MODULE_LIBRARY)
{
- std::string tfull = t->GetFullPath(configName);
+ std::string tfull = gt->GetFullPath(configName);
std::string trel = this->ConvertToRelativeForMake(tfull.c_str());
// Add this target to the post-build phases of its dependencies.
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 3883962..dc0d3f9 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -736,7 +736,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang,
// Store this command line.
commandLines.push_back(commandLine);
}
- std::string targetFullPath = target.Target->GetFullPath();
+ std::string targetFullPath = target.GetFullPath();
// Generate a meaningful comment for the command.
std::string comment = "Linking ";
comment += llang;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 7f90078..ea93cde 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -633,7 +633,7 @@ cmMakefileTargetGenerator
this->Target->GetType() == cmTarget::MODULE_LIBRARY)
{
targetFullPathReal =
- this->Target->GetFullPath(this->ConfigName, false, true);
+ this->GeneratorTarget->GetFullPath(this->ConfigName, false, true);
targetFullPathPDB = this->Target->GetPDBDirectory(this->ConfigName);
targetFullPathPDB += "/";
targetFullPathPDB += this->Target->GetPDBName(this->ConfigName);
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 73ba815..5c0eb91 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -389,13 +389,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
cmTarget::TargetType targetType = this->GetTarget()->GetType();
std::string targetOutput = ConvertToNinjaPath(
- this->GetTarget()->GetFullPath(this->GetConfigName()).c_str());
+ this->GetGeneratorTarget()->GetFullPath(this->GetConfigName()).c_str());
std::string targetOutputReal = ConvertToNinjaPath(
- this->GetTarget()->GetFullPath(this->GetConfigName(),
+ this->GetGeneratorTarget()->GetFullPath(this->GetConfigName(),
/*implib=*/false,
/*realpath=*/true).c_str());
std::string targetOutputImplib = ConvertToNinjaPath(
- this->GetTarget()->GetFullPath(this->GetConfigName(),
+ this->GetGeneratorTarget()->GetFullPath(this->GetConfigName(),
/*implib=*/true).c_str());
if (this->GetTarget()->IsAppBundleOnApple())
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index e96ab1a..38933ea 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -3187,44 +3187,6 @@ bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::NormalGetRealName(const char* config) const
-{
- // This should not be called for imported targets.
- // TODO: Split cmTarget into a class hierarchy to get compile-time
- // enforcement of the limited imported target API.
- if(this->IsImported())
- {
- std::string msg = "NormalGetRealName called on imported target: ";
- msg += this->GetName();
- this->GetMakefile()->
- IssueMessage(cmake::INTERNAL_ERROR,
- msg.c_str());
- }
-
- if(this->GetType() == cmTarget::EXECUTABLE)
- {
- // Compute the real name that will be built.
- std::string name;
- std::string realName;
- std::string impName;
- std::string pdbName;
- this->GetExecutableNames(name, realName, impName, pdbName, config);
- return realName;
- }
- else
- {
- // Compute the real name that will be built.
- std::string name;
- std::string soName;
- std::string realName;
- std::string impName;
- std::string pdbName;
- this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
- return realName;
- }
-}
-
-//----------------------------------------------------------------------------
std::string cmTarget::GetFullName(const char* config, bool implib) const
{
if(this->IsImported())
@@ -3254,48 +3216,6 @@ void cmTarget::GetFullNameComponents(std::string& prefix, std::string& base,
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetFullPath(const char* config, bool implib,
- bool realname) const
-{
- if(this->IsImported())
- {
- return this->ImportedGetFullPath(config, implib);
- }
- else
- {
- return this->NormalGetFullPath(config, implib, realname);
- }
-}
-
-//----------------------------------------------------------------------------
-std::string cmTarget::NormalGetFullPath(const char* config, bool implib,
- bool realname) const
-{
- std::string fpath = this->GetDirectory(config, implib);
- fpath += "/";
- if(this->IsAppBundleOnApple())
- {
- fpath = this->BuildMacContentDirectory(fpath, config, false);
- fpath += "/";
- }
-
- // Add the full name of the target.
- if(implib)
- {
- fpath += this->GetFullName(config, true);
- }
- else if(realname)
- {
- fpath += this->NormalGetRealName(config);
- }
- else
- {
- fpath += this->GetFullName(config, false);
- }
- return fpath;
-}
-
-//----------------------------------------------------------------------------
std::string
cmTarget::ImportedGetFullPath(const char* config, bool implib) const
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 77c8c52..a438525 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -389,11 +389,6 @@ public:
no soname at all. */
bool IsImportedSharedLibWithoutSOName(const char* config) const;
- /** Get the full path to the target according to the settings in its
- makefile and the configuration type. */
- std::string GetFullPath(const char* config=0, bool implib = false,
- bool realname = false) 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. */
@@ -653,14 +648,6 @@ private:
std::string GetFullNameImported(const char* config, bool implib) const;
std::string ImportedGetFullPath(const char* config, bool implib) const;
- std::string NormalGetFullPath(const char* config, bool implib,
- bool realname) const;
-
- /** Get the real name of the target. Allowed only for non-imported
- targets. When a library or executable file is versioned this is
- the full versioned name. If the target is not versioned this is
- the same as GetFullName. */
- std::string NormalGetRealName(const char* config) const;
/** Append to @a base the mac content directory and return it. */
std::string BuildMacContentDirectory(const std::string& base,
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index d962fb2..2d110d1 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -82,7 +82,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
// be translated.
std::string exe = command[0];
cmMakefile* mf = this->Test->GetMakefile();
- cmTarget* target = mf->FindTargetToUse(exe.c_str());
+ cmGeneratorTarget* target = mf->FindGeneratorTargetToUse(exe.c_str());
if(target && target->GetType() == cmTarget::EXECUTABLE)
{
// Use the target file on disk.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=347d5c0503327d04e06786899bd58898cd484b8d
commit 347d5c0503327d04e06786899bd58898cd484b8d
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Oct 28 19:47:46 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:05 2014 +0100
Move GetLocation to cmGeneratorTarget.
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index f2f77ee..cc449ce 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -41,7 +41,8 @@ unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const
std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
{
std::string const& argv0 = this->CC.GetCommandLines()[c][0];
- cmTarget* target = this->Makefile->FindTargetToUse(argv0.c_str());
+ cmGeneratorTarget* target
+ = this->Makefile->FindGeneratorTargetToUse(argv0.c_str());
if(target && target->GetType() == cmTarget::EXECUTABLE &&
(target->IsImported() || !this->Makefile->IsOn("CMAKE_CROSSCOMPILING")))
{
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index a066153..37883bb 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -580,7 +580,9 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
}
else
{
- location = target->GetLocation(buildType);
+ cmGeneratorTarget *gtgt
+ = target->GetMakefile()->FindGeneratorTargetToUse(target->GetName());
+ location = gtgt->GetLocation(buildType);
}
fout<<" <Option output=\"" << location
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 5cd1f42..19a641b 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -181,6 +181,60 @@ cmGeneratorTarget::GetExternalObjects(std::vector<cmSourceFile*>& srcs) const
}
//----------------------------------------------------------------------------
+const char* cmGeneratorTarget::GetLocation(const char* config) const
+{
+ if (this->Target->IsImported())
+ {
+ return this->Target->ImportedGetLocation(config);
+ }
+ else
+ {
+ return this->NormalGetLocation(config);
+ }
+}
+
+bool cmGeneratorTarget::IsImported() const
+{
+ return this->Target->IsImported();
+}
+
+//----------------------------------------------------------------------------
+const char* cmGeneratorTarget::NormalGetLocation(const char* config) const
+{
+ // Handle the configuration-specific case first.
+ static std::string location;
+ if(config)
+ {
+ location = this->Target->GetFullPath(config, false);
+ return location.c_str();
+ }
+
+ // Now handle the deprecated build-time configuration location.
+ location = this->Target->GetDirectory();
+ const char* cfgid = this->Makefile->GetDefinition("CMAKE_CFG_INTDIR");
+ if(cfgid && strcmp(cfgid, ".") != 0)
+ {
+ location += "/";
+ location += cfgid;
+ }
+
+ if(this->Target->IsAppBundleOnApple())
+ {
+ std::string macdir = this->Target->BuildMacContentDirectory("",
+ config,
+ false);
+ if(!macdir.empty())
+ {
+ location += "/";
+ location += macdir;
+ }
+ }
+ location += "/";
+ location += this->Target->GetFullName(config, false);
+ return location.c_str();
+}
+
+//----------------------------------------------------------------------------
bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
const char *config) const
{
@@ -607,7 +661,8 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
}
// Check for a target with this name.
- if(cmTarget* t = this->Makefile->FindTargetToUse(util.c_str()))
+ if(cmGeneratorTarget* t
+ = this->Makefile->FindGeneratorTargetToUse(util.c_str()))
{
// If we find the target and the dep was given as a full path,
// then make sure it was not a full path to something else, and
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 17a223a..9fcb13b 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -26,6 +26,10 @@ class cmGeneratorTarget
public:
cmGeneratorTarget(cmTarget*);
+ bool IsImported() const;
+ const char *GetLocation(const char* config) const;
+ const char *NormalGetLocation(const char* config) const;
+
int GetType() const;
const char *GetName() const;
const char *GetProperty(const char *prop) const;
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index ed0e15b..c6fcf4e 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -70,13 +70,18 @@ void cmGlobalKdevelopGenerator::Generate()
lg!=lgs.end(); lg++)
{
cmMakefile* makefile=(*lg)->GetMakefile();
- cmTargets& targets=makefile->GetTargets();
- for (cmTargets::iterator ti = targets.begin();
+ cmGeneratorTargetsType targets=makefile->GetGeneratorTargets();
+ for (cmGeneratorTargetsType::iterator ti = targets.begin();
ti != targets.end(); ti++)
{
- if (ti->second.GetType()==cmTarget::EXECUTABLE)
+ if (ti->second->IsImported())
{
- executable = ti->second.GetLocation(0);
+ continue;
+ }
+
+ if (ti->second->GetType()==cmTarget::EXECUTABLE)
+ {
+ executable = ti->second->GetLocation(0);
break;
}
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 3effe38..3883962 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2021,7 +2021,8 @@ bool cmLocalGenerator::GetRealDependency(const char* inName,
}
// Look for a CMake target with the given name.
- if(cmTarget* target = this->Makefile->FindTargetToUse(name.c_str()))
+ if(cmGeneratorTarget* target
+ = this->Makefile->FindGeneratorTargetToUse(name.c_str()))
{
// make sure it is not just a coincidence that the target name
// found is part of the inName
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index da22ab5..698c426 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -562,7 +562,8 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
autogenTargetName.c_str());
return;
}
- makefile->AddDefinition("_qt_moc_executable", qt5Moc->GetLocation(0));
+ makefile->AddDefinition("_qt_moc_executable",
+ qt5Moc->ImportedGetLocation(0));
}
else
{
@@ -751,7 +752,8 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
}
else
{
- makefile->AddDefinition("_qt_uic_executable", qt5Uic->GetLocation(0));
+ makefile->AddDefinition("_qt_uic_executable",
+ qt5Uic->ImportedGetLocation(0));
}
}
else
@@ -940,7 +942,8 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
targetName);
return;
}
- makefile->AddDefinition("_qt_rcc_executable", qt5Rcc->GetLocation(0));
+ makefile->AddDefinition("_qt_rcc_executable",
+ qt5Rcc->ImportedGetLocation(0));
}
else
{
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index c5e8e65..e96ab1a 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2460,19 +2460,6 @@ std::string cmTarget::GetPDBDirectory(const char* config) const
}
//----------------------------------------------------------------------------
-const char* cmTarget::GetLocation(const char* config) const
-{
- if (this->IsImported())
- {
- return this->ImportedGetLocation(config);
- }
- else
- {
- return this->NormalGetLocation(config);
- }
-}
-
-//----------------------------------------------------------------------------
const char* cmTarget::ImportedGetLocation(const char* config) const
{
static std::string location;
@@ -2481,45 +2468,6 @@ const char* cmTarget::ImportedGetLocation(const char* config) const
}
//----------------------------------------------------------------------------
-const char* cmTarget::NormalGetLocation(const char* config) const
-{
- static std::string location;
- // Handle the configuration-specific case first.
- if(config)
- {
- location = this->GetFullPath(config, false);
- return location.c_str();
- }
-
- // Now handle the deprecated build-time configuration location.
- location = this->GetDirectory();
- if(!location.empty())
- {
- location += "/";
- }
- const char* cfgid = this->Makefile->GetDefinition("CMAKE_CFG_INTDIR");
- if(cfgid && strcmp(cfgid, ".") != 0)
- {
- location += "/";
- location += cfgid;
- location += "/";
- }
-
- if(this->IsAppBundleOnApple())
- {
- std::string macdir = this->BuildMacContentDirectory("", config, false);
- if(!macdir.empty())
- {
- location += "/";
- location += macdir;
- }
- }
- location += "/";
- location += this->GetFullName(config, false);
- return location.c_str();
-}
-
-//----------------------------------------------------------------------------
void cmTarget::GetTargetVersion(int& major, int& minor) const
{
int patch;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 26d391f..77c8c52 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -341,10 +341,7 @@ public:
pdb output directory is given. */
std::string GetPDBDirectory(const char* config = 0) const;
- /** Get the location of the target in the build tree for the given
- configuration. This location is suitable for use as the LOCATION
- target property. */
- const char* GetLocation(const char* config) const;
+ const char* ImportedGetLocation(const char* config) const;
/** Get the target major and minor version numbers interpreted from
the VERSION property. Version 0 is returned if the property is
@@ -653,9 +650,6 @@ private:
// Get the target base name.
std::string GetOutputName(const char* config, bool implib) const;
- const char* ImportedGetLocation(const char* config) const;
- const char* NormalGetLocation(const char* config) const;
-
std::string GetFullNameImported(const char* config, bool implib) const;
std::string ImportedGetFullPath(const char* config, bool implib) const;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f6229ef1ffa08c36e7b97b11a07c3a40991917b6
commit f6229ef1ffa08c36e7b97b11a07c3a40991917b6
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Oct 6 17:43:14 2012 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:05 2014 +0100
Add more cmGeneratorTarget API to cmGlobalGenerator.
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 220cb20..9780188 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2078,6 +2078,18 @@ cmGlobalGenerator::FindTarget(const char* project, const char* name,
return 0;
}
+
+//----------------------------------------------------------------------------
+cmGeneratorTarget*
+cmGlobalGenerator::FindGeneratorTarget(const char* project, const char* name)
+{
+ if (cmTarget *t = this->FindTarget(project, name))
+ {
+ return this->GetGeneratorTarget(t);
+ }
+ return 0;
+}
+
//----------------------------------------------------------------------------
bool
cmGlobalGenerator::NameResolvesToFramework(const std::string& libname) const
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 2ed848a..77d3fd8 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -211,6 +211,8 @@ public:
void AddAlias(const char *name, cmTarget *tgt);
bool IsAlias(const char *name) const;
+ cmGeneratorTarget* FindGeneratorTarget(const char* project,
+ const char* name);
/** Determine if a name resolves to a framework on disk or a built target
that is a framework. */
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=824cc50ead5eb9a5178a2215dc6fa38a5549dfab
commit 824cc50ead5eb9a5178a2215dc6fa38a5549dfab
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Oct 20 00:27:17 2013 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:05 2014 +0100
Don't allow include() of the result of export().
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index f883fbe..220cb20 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -195,21 +195,6 @@ cmGlobalGenerator::AddBuildExportExportSet(cmExportBuildFileGenerator* gen)
this->BuildExportExportSets[gen->GetMainExportFileName()] = gen;
}
-bool cmGlobalGenerator::GenerateImportFile(const std::string &file)
-{
- std::map<std::string, cmExportBuildFileGenerator*>::iterator it
- = this->BuildExportSets.find(file);
- if (it != this->BuildExportSets.end())
- {
- bool result = it->second->GenerateImportFile();
- delete it->second;
- it->second = 0;
- this->BuildExportSets.erase(it);
- return result;
- }
- return false;
-}
-
bool
cmGlobalGenerator::IsExportedTargetsFile(const std::string &filename) const
{
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index fc5cab9..2ed848a 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -313,7 +313,6 @@ public:
void AddBuildExportSet(cmExportBuildFileGenerator*);
void AddBuildExportExportSet(cmExportBuildFileGenerator*);
bool IsExportedTargetsFile(const std::string &filename) const;
- bool GenerateImportFile(const std::string &file);
cmExportBuildFileGenerator*
GetExportedTargetsFile(const std::string &filename) const;
void AddCMP0042WarnTarget(const std::string& target);
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index e8ee33f..8870cf8 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -97,37 +97,15 @@ bool cmIncludeCommand
->GetGlobalGenerator();
if (gg->IsExportedTargetsFile(fname_abs))
{
- const char *modal = 0;
- cmake::MessageType messageType = cmake::AUTHOR_WARNING;
-
- switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0024))
- {
- case cmPolicies::WARN:
- modal = "should";
- case cmPolicies::OLD:
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- modal = "may";
- messageType = cmake::FATAL_ERROR;
- }
- if (modal)
- {
- cmOStringStream e;
- e << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0024)) << "\n";
- e << "The file\n " << fname_abs << "\nwas generated by the export() "
- "command. It " << modal << " not be used as the argument to the "
- "include() command. Use ALIAS targets instead to refer to targets "
- "by alternative names.\n";
- this->Makefile->IssueMessage(messageType, e.str().c_str());
- if (messageType == cmake::FATAL_ERROR)
- {
- return false;
- }
- }
- gg->GenerateImportFile(fname_abs);
+ cmOStringStream e;
+ e << (this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0024)) << "\n";
+ e << "The file\n " << fname_abs << "\nwas generated by the export() "
+ "command. It may not be used as the argument to the "
+ "include() command. Use ALIAS targets instead to refer to targets "
+ "by alternative names.\n";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
+ return false;
}
std::string fullFilePath;
diff --git a/Tests/RunCMake/include/CMP0024-WARN-result.txt b/Tests/RunCMake/include/CMP0024-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/include/CMP0024-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/include/CMP0024-WARN-stderr.txt b/Tests/RunCMake/include/CMP0024-WARN-stderr.txt
deleted file mode 100644
index 9c79007..0000000
--- a/Tests/RunCMake/include/CMP0024-WARN-stderr.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-CMake Warning \(dev\) at subdir2/CMakeLists.txt:2 \(include\):
- Policy CMP0024 is not set: Disallow include export result. Run "cmake
- --help-policy CMP0024" for policy details. Use the cmake_policy command to
- set the policy and suppress this warning.
-
- The file
-
- .*/Tests/RunCMake/include/CMP0024-WARN-build/subdir1/theTargets.cmake
-
- was generated by the export\(\) command. It should not be used as the
- argument to the include\(\) command. Use ALIAS targets instead to refer to
- targets by alternative names.
-
-This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/include/CMP0024-WARN.cmake b/Tests/RunCMake/include/CMP0024-WARN.cmake
deleted file mode 100644
index 783cf78..0000000
--- a/Tests/RunCMake/include/CMP0024-WARN.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-
-enable_language(CXX)
-
-add_library(foo SHARED empty.cpp)
-
-add_subdirectory(subdir1)
-add_subdirectory(subdir2)
diff --git a/Tests/RunCMake/include/RunCMakeTest.cmake b/Tests/RunCMake/include/RunCMakeTest.cmake
index bea7d5c..0f1d39d 100644
--- a/Tests/RunCMake/include/RunCMakeTest.cmake
+++ b/Tests/RunCMake/include/RunCMakeTest.cmake
@@ -2,6 +2,5 @@ include(RunCMake)
run_cmake(EmptyString)
run_cmake(EmptyStringOptional)
-run_cmake(CMP0024-WARN)
run_cmake(CMP0024-NEW)
run_cmake(ExportExportInclude)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=44b57fb52bd72a388bc010a37b2be8005e22822c
commit 44b57fb52bd72a388bc010a37b2be8005e22822c
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Oct 19 11:32:18 2013 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 11 11:13:05 2014 +0100
Allow LOCATION property at configure time only on IMPORTED targets.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 4828d20..c5e8e65 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2590,34 +2590,17 @@ bool cmTarget::HandleLocationPropertyPolicy() const
{
return true;
}
- const char *modal = 0;
- cmake::MessageType messageType = cmake::AUTHOR_WARNING;
- switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0026))
- {
- case cmPolicies::WARN:
- modal = "should";
- case cmPolicies::OLD:
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- modal = "may";
- messageType = cmake::FATAL_ERROR;
- }
- if (modal)
- {
- cmOStringStream e;
- e << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0026)) << "\n";
- e << "The LOCATION property " << modal << " not be read from target \""
- << this->GetName() << "\". Use the target name directly with "
- "add_custom_command, or use the generator expression $<TARGET_FILE>, "
- "as appropriate.\n";
- this->Makefile->IssueMessage(messageType, e.str().c_str());
- }
+ cmOStringStream e;
+ e << (this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0026)) << "\n";
+ e << "The LOCATION property may not be read from target \""
+ << this->GetName() << "\". Use the target name directly with "
+ "add_custom_command, or use the generator expression $<TARGET_FILE>, "
+ "as appropriate.\n";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
- return messageType != cmake::FATAL_ERROR;
+ return false;
}
//----------------------------------------------------------------------------
@@ -2668,7 +2651,7 @@ const char *cmTarget::GetProperty(const char* prop,
// cannot take into account the per-configuration name of the
// target because the configuration type may not be known at
// CMake time.
- this->Properties.SetProperty("LOCATION", this->GetLocation(0),
+ this->Properties.SetProperty("LOCATION", this->ImportedGetLocation(0),
cmProperty::TARGET);
}
@@ -2681,8 +2664,8 @@ const char *cmTarget::GetProperty(const char* prop,
}
std::string configName = prop+9;
this->Properties.SetProperty(prop,
- this->GetLocation(configName.c_str()),
- cmProperty::TARGET);
+ this->ImportedGetLocation(configName.c_str()),
+ cmProperty::TARGET);
}
}
if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0)
diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt
deleted file mode 100644
index 9b88194..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CMake Warning \(dev\) at CMP0026-WARN.cmake:5 \(get_target_property\):
- Policy CMP0026 is not set: Disallow use of the LOCATION target property.
- Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
-
- The LOCATION property should not be read from target "somelib". Use the
- target name directly with add_custom_command, or use the generator
- expression \$<TARGET_FILE>, as appropriate.
-
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake b/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake
deleted file mode 100644
index 89c5a8a..0000000
--- a/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-
-enable_language(CXX)
-
-add_library(somelib empty.cpp)
-get_target_property(_loc somelib LOCATION)
diff --git a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
index 68000a6..72a2e3f 100644
--- a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
@@ -1,5 +1,4 @@
include(RunCMake)
-run_cmake(CMP0026-WARN)
run_cmake(CMP0026-NEW)
run_cmake(CMP0026-IMPORTED)
-----------------------------------------------------------------------
Summary of changes:
Source/CMakeVersion.cmake | 2 +-
Source/cmCommands.cxx | 2 -
Source/cmComputeLinkDepends.cxx | 185 +-
Source/cmComputeLinkDepends.h | 22 +-
Source/cmComputeLinkInformation.cxx | 293 +--
Source/cmComputeLinkInformation.h | 17 +-
Source/cmComputeTargetDepends.cxx | 78 +-
Source/cmComputeTargetDepends.h | 16 +-
Source/cmCustomCommandGenerator.cxx | 3 +-
Source/cmExportBuildFileGenerator.cxx | 41 +-
Source/cmExportBuildFileGenerator.h | 7 +-
Source/cmExportFileGenerator.cxx | 52 +-
Source/cmExportFileGenerator.h | 11 +-
Source/cmExportInstallFileGenerator.cxx | 14 +-
Source/cmExportInstallFileGenerator.h | 3 +-
Source/cmExportLibraryDependencies.cxx | 208 --
Source/cmExportLibraryDependencies.h | 37 -
Source/cmExportTryCompileFileGenerator.cxx | 2 +-
Source/cmExportTryCompileFileGenerator.h | 2 +-
Source/cmExtraCodeBlocksGenerator.cxx | 4 +-
Source/cmGeneratorExpressionEvaluator.cxx | 67 +-
Source/cmGeneratorTarget.cxx | 3009 ++++++++++++++++++-
Source/cmGeneratorTarget.h | 266 ++-
Source/cmGlobalGenerator.cxx | 105 +-
Source/cmGlobalGenerator.h | 14 +-
Source/cmGlobalKdevelopGenerator.cxx | 13 +-
Source/cmGlobalNinjaGenerator.cxx | 14 +-
Source/cmGlobalUnixMakefileGenerator3.cxx | 23 +-
Source/cmGlobalVisualStudio7Generator.cxx | 5 +-
Source/cmGlobalVisualStudio8Generator.cxx | 5 +-
Source/cmGlobalVisualStudioGenerator.cxx | 15 +-
Source/cmGlobalXCodeGenerator.cxx | 35 +-
Source/cmGraphVizWriter.cxx | 98 +-
Source/cmIncludeCommand.cxx | 40 +-
Source/cmInstallTargetGenerator.cxx | 71 +-
Source/cmInstallTargetGenerator.h | 5 +-
Source/cmLocalGenerator.cxx | 19 +-
Source/cmLocalUnixMakefileGenerator3.cxx | 3 +-
Source/cmLocalVisualStudio6Generator.cxx | 104 +-
Source/cmLocalVisualStudio7Generator.cxx | 25 +-
Source/cmMakefile.cxx | 8 +-
Source/cmMakefileExecutableTargetGenerator.cxx | 8 +-
Source/cmMakefileLibraryTargetGenerator.cxx | 22 +-
Source/cmMakefileTargetGenerator.cxx | 18 +-
Source/cmNinjaNormalTargetGenerator.cxx | 19 +-
Source/cmNinjaTargetGenerator.cxx | 4 +-
Source/cmOSXBundleGenerator.cxx | 16 +-
Source/cmOSXBundleGenerator.h | 2 +
Source/cmQtAutoGenerators.cxx | 19 +-
Source/cmTarget.cxx | 3338 +-------------------
Source/cmTarget.h | 276 +--
Source/cmTargetDepend.h | 4 +-
Source/cmTestGenerator.cxx | 2 +-
Source/cmVisualStudio10TargetGenerator.cxx | 17 +-
.../CMP0033-NEW-result.txt => TempMerge | 0
Tests/Complex/CMakeLists.txt | 3 -
Tests/ComplexOneConfig/CMakeLists.txt | 3 -
Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt | 1 -
Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt | 12 -
Tests/RunCMake/CMP0026/CMP0026-WARN.cmake | 5 -
Tests/RunCMake/CMP0026/RunCMakeTest.cmake | 1 -
.../DisallowedCommands/CMP0033-NEW-stderr.txt | 4 -
.../RunCMake/DisallowedCommands/CMP0033-NEW.cmake | 2 -
.../DisallowedCommands/CMP0033-OLD-result.txt | 1 -
.../DisallowedCommands/CMP0033-OLD-stderr.txt | 4 -
.../RunCMake/DisallowedCommands/CMP0033-OLD.cmake | 2 -
.../DisallowedCommands/CMP0033-WARN-result.txt | 1 -
.../DisallowedCommands/CMP0033-WARN-stderr.txt | 12 -
.../RunCMake/DisallowedCommands/CMP0033-WARN.cmake | 1 -
.../RunCMake/DisallowedCommands/RunCMakeTest.cmake | 1 -
Tests/RunCMake/include/CMP0024-WARN-result.txt | 1 -
Tests/RunCMake/include/CMP0024-WARN-stderr.txt | 14 -
Tests/RunCMake/include/CMP0024-WARN.cmake | 7 -
Tests/RunCMake/include/RunCMakeTest.cmake | 1 -
74 files changed, 3892 insertions(+), 4872 deletions(-)
delete mode 100644 Source/cmExportLibraryDependencies.cxx
delete mode 100644 Source/cmExportLibraryDependencies.h
rename Tests/RunCMake/DisallowedCommands/CMP0033-NEW-result.txt => TempMerge (100%)
delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt
delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt
delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-WARN.cmake
delete mode 100644 Tests/RunCMake/DisallowedCommands/CMP0033-NEW-stderr.txt
delete mode 100644 Tests/RunCMake/DisallowedCommands/CMP0033-NEW.cmake
delete mode 100644 Tests/RunCMake/DisallowedCommands/CMP0033-OLD-result.txt
delete mode 100644 Tests/RunCMake/DisallowedCommands/CMP0033-OLD-stderr.txt
delete mode 100644 Tests/RunCMake/DisallowedCommands/CMP0033-OLD.cmake
delete mode 100644 Tests/RunCMake/DisallowedCommands/CMP0033-WARN-result.txt
delete mode 100644 Tests/RunCMake/DisallowedCommands/CMP0033-WARN-stderr.txt
delete mode 100644 Tests/RunCMake/DisallowedCommands/CMP0033-WARN.cmake
delete mode 100644 Tests/RunCMake/include/CMP0024-WARN-result.txt
delete mode 100644 Tests/RunCMake/include/CMP0024-WARN-stderr.txt
delete mode 100644 Tests/RunCMake/include/CMP0024-WARN.cmake
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list