diff options
author | Brad King <brad.king@kitware.com> | 2008-08-27 10:21:50 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-08-27 10:21:50 -0400 |
commit | 012e4c4f68dc75002468cc043065c358bc12a7b5 (patch) | |
tree | 4dc5915f84f0373ff2e8f1709936dc5af2360bc3 /Source/cmComputeLinkDepends.cxx | |
parent | 32fe1d5b0d79ba4298c95e14f2815e61a05a0e38 (diff) | |
download | cmake-012e4c4f68dc75002468cc043065c358bc12a7b5.tar.gz |
BUG: Do not infer dependencies of link flags
In cmComputeLinkDepends link items that look like flags (starting in
'-') should not be included in dependency inferral. They are not
libraries and therefore have no dependencies. They should just be
passed through to the final link line unchanged. See issue #7546.
Diffstat (limited to 'Source/cmComputeLinkDepends.cxx')
-rw-r--r-- | Source/cmComputeLinkDepends.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index e3ef6040fc..d687d64a60 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -50,7 +50,9 @@ those without known dependencies. We will call the two types "known items" and "unknown items", respecitvely. Known items are those whose names correspond to targets (built or imported) and those for which an old-style <item>_LIB_DEPENDS variable is defined. All other items are -unknown and we must infer dependencies for them. +unknown and we must infer dependencies for them. For items that look +like flags (beginning with '-') we trivially infer no dependencies, +and do not include them in the dependencies of other items. Known items have dependency lists ordered based on how the user specified them. We can use this order to infer potential dependencies @@ -293,6 +295,7 @@ int cmComputeLinkDepends::AddLinkEntry(std::string const& item) LinkEntry& entry = this->EntryList[index]; entry.Item = item; entry.Target = this->FindTargetToLink(entry.Item.c_str()); + entry.IsFlag = !entry.Target && item[0] == '-'; // If the item has dependencies queue it to follow them. if(entry.Target) @@ -312,7 +315,7 @@ int cmComputeLinkDepends::AddLinkEntry(std::string const& item) BFSEntry qe = {index, val}; this->BFSQueue.push(qe); } - else + else if(!entry.IsFlag) { // The item dependencies are not known. We need to infer them. this->InferredDependSets[index] = new DependSetList; @@ -555,7 +558,10 @@ cmComputeLinkDepends::AddLinkEntries(int depender_index, // The depender must come before the dependee. if(depender_index >= 0) { - this->EntryConstraintGraph[dependee_index].push_back(depender_index); + if(!this->EntryList[dependee_index].IsFlag) + { + this->EntryConstraintGraph[dependee_index].push_back(depender_index); + } } else { @@ -572,6 +578,7 @@ cmComputeLinkDepends::AddLinkEntries(int depender_index, // items are outside libraries that should not be depending on // targets. if(!this->EntryList[dependee_index].Target && + !this->EntryList[dependee_index].IsFlag && dependee_index != dsi->first) { dsi->second.insert(dependee_index); |