summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmComputeLinkDepends.cxx13
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx12
-rw-r--r--Source/kwsys/CMakeLists.txt2
3 files changed, 18 insertions, 9 deletions
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index b13a125..1fb8f30 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -263,21 +263,26 @@ cmComputeLinkDepends::Compute()
this->OrderLinkEntires();
// Compute the final set of link entries.
+ // Iterate in reverse order so we can keep only the last occurrence
+ // of a shared library.
std::set<int> emmitted;
- for(std::vector<int>::const_iterator li = this->FinalLinkOrder.begin();
- li != this->FinalLinkOrder.end(); ++li)
+ for(std::vector<int>::const_reverse_iterator
+ li = this->FinalLinkOrder.rbegin(),
+ le = this->FinalLinkOrder.rend();
+ li != le; ++li)
{
int i = *li;
LinkEntry const& e = this->EntryList[i];
cmTarget const* t = e.Target;
- // Entries that we know the linker will re-use for symbols
- // needed by later entries do not need to be repeated.
+ // Entries that we know the linker will re-use do not need to be repeated.
bool uniquify = t && t->GetType() == cmTarget::SHARED_LIBRARY;
if(!uniquify || emmitted.insert(i).second)
{
this->FinalLinkEntries.push_back(e);
}
}
+ // Reverse the resulting order since we iterated in reverse.
+ std::reverse(this->FinalLinkEntries.begin(), this->FinalLinkEntries.end());
// Display the final set.
if(this->DebugMode)
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index c1478df..67a1a6d 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -1286,12 +1286,16 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
std::string obj_dir = gt->ObjectDirectory;
std::string result;
const char* sep = "";
- for(std::map<cmSourceFile const*, std::string>::const_iterator it
- = mapping.begin(); it != mapping.end(); ++it)
+ for(std::vector<cmSourceFile const*>::const_iterator it
+ = objectSources.begin(); it != objectSources.end(); ++it)
{
- assert(!it->second.empty());
+ // Find the object file name corresponding to this source file.
+ std::map<cmSourceFile const*, std::string>::const_iterator
+ map_it = mapping.find(*it);
+ // It must exist because we populated the mapping just above.
+ assert(!map_it->second.empty());
result += sep;
- std::string objFile = obj_dir + it->second;
+ std::string objFile = obj_dir + map_it->second;
cmSourceFile* sf = context->Makefile->GetOrCreateSource(objFile, true);
sf->SetObjectLibrary(tgtName);
sf->SetProperty("EXTERNAL_OBJECT", "1");
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index 8ca4360..2067690 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -265,7 +265,7 @@ STRING(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}"
KWSYS_IN_SOURCE_BUILD)
IF(NOT KWSYS_IN_SOURCE_BUILD)
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsysPrivate.h
- ${PROJECT_BINARY_DIR}/kwsysPrivate.h COPY_ONLY IMMEDIATE)
+ ${PROJECT_BINARY_DIR}/kwsysPrivate.h COPYONLY IMMEDIATE)
ENDIF(NOT KWSYS_IN_SOURCE_BUILD)
# Select plugin module file name convention.