Ralf Habacker schrieb:
Bill Hoffman schrieb:
Brad King has committed a fix for this in CVS CMake:
(If you could give it a try, I will merge it into the 2.6 branch for
2.6.2.)
This does not help with the related issue. After a few more digging I
recognized that the following method
cmComputeLinkDepends::AddLinkEntries(int depender_index,
std::vector<std::string> const& libs)
{
is called with a libs parameter containing optimized and debug terms -
the general terms are already been stripped anywhere before.
I guess that this method should sort out the libraries not intended for
the given buildtype or this must be happen somewhere else - I haven't
found out yet.
In case cmComputeLinkDepends::AddLinkEntries is the right place the
append patch fixes this issue on windows (tested with "NMake Makefiles"
generator)
BTW: Because there are already several places where the
general/optimized/debug stuff is used
[E:\daten\kde\emerge-msvc-root\tmp\cmake-src-2.6.1\work\cmake-2.6.1\Source\cmComputeLinkDepends.cxx]
Line 452 : else if(*di == "general")
Line 570 : else if(item == "general")
[E:\daten\kde\emerge-msvc-root\tmp\cmake-src-2.6.1\work\cmake-2.6.1\Source\cmExportLibraryDependencies.cxx]
Line 130 : ltValue = "general";
Line 164 : ltEntry = "general";
Line 202 : if(i->second != "general")
[E:\daten\kde\emerge-msvc-root\tmp\cmake-src-2.6.1\work\cmake-2.6.1\Source\cmTarget.cxx]
Line 1323 : dependencies += "general";
Line 1617 : else if (l == "general")
[E:\daten\kde\emerge-msvc-root\tmp\cmake-src-2.6.1\work\cmake-2.6.1\Source\cmTargetLinkLibrariesCommand.cxx]
Line 21 : "general",
Line 71 : else if(*i == "general")
[E:\daten\kde\emerge-msvc-root\tmp\cmake-src-2.6.1\work\cmake-2.6.1\Source\cmComputeLinkDepends.cxx]
Line 447 : else if(*di == "optimized")
Line 474 : else if(strcmp(val, "optimized") == 0)
Line 565 : else if(item == "optimized")
[E:\daten\kde\emerge-msvc-root\tmp\cmake-src-2.6.1\work\cmake-2.6.1\Source\cmExportLibraryDependencies.cxx]
Line 138 : ltValue = "optimized";
[E:\daten\kde\emerge-msvc-root\tmp\cmake-src-2.6.1\work\cmake-2.6.1\Source\cmLinkLibrariesCommand.cxx]
Line 44 : else if (*i == "optimized")
[E:\daten\kde\emerge-msvc-root\tmp\cmake-src-2.6.1\work\cmake-2.6.1\Source\cmTarget.cxx]
Line 1329 : dependencies += "optimized";
Line 1613 : else if (l == "optimized")
[E:\daten\kde\emerge-msvc-root\tmp\cmake-src-2.6.1\work\cmake-2.6.1\Source\cmTargetLinkLibrariesCommand.cxx]
Line 23 : "optimized"
Line 62 : else if(*i == "optimized")
Line 106 : if(strcmp(linkTypeString, "optimized") == 0)
it may be good to have a common method which does this filtering for a
given library vector - just a guess.
Ralf
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv12085/Source
Modified Files:
cmTargetLinkLibrariesCommand.cxx
cmTargetLinkLibrariesCommand.h
Log Message:
ENH: Tolerate repeated link library types
The "debug", "optimized", and "general" link library type specifier
arguments to the target_link_library commands are sometimes repeated in
user code due to variable expansion and other complications. Instead of
silently accepting the duplicates and trying to link to a bogus library
like "optimized.lib", warn and ignore the earlier specifiers.
Index: cmTargetLinkLibrariesCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTargetLinkLibrariesCommand.h,v
retrieving revision 1.15
retrieving revision 1.16
RCS file: /cvsroot/CMake/CMake/Source/cmTargetLinkLibrariesCommand.cxx,v
retrieving revision 1.25
retrieving revision 1.26
Thanks
-Bill
_______________________________________________
Kde-windows mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-windows
Index: cmComputeLinkDepends.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkDepends.cxx,v
retrieving revision 1.20
diff -u -r1.20 cmComputeLinkDepends.cxx
--- cmComputeLinkDepends.cxx 6 Aug 2008 21:48:53 -0000 1.20
+++ cmComputeLinkDepends.cxx 8 Aug 2008 12:32:14 -0000
@@ -537,6 +537,15 @@
// Track inferred dependency sets implied by this list.
std::map<int, DependSet> dependSets;
+ // Compute which library configuration to link.
+ cmTarget::LinkLibraryType linkType = cmTarget::OPTIMIZED;
+ if(this->Config && cmSystemTools::UpperCase(this->Config) == "DEBUG")
+ {
+ linkType = cmTarget::DEBUG;
+ }
+ cmTarget::LinkLibraryType llt = cmTarget::GENERAL;
+ bool haveLLT = false;
+
// Loop over the libraries linked directly by the depender.
for(std::vector<std::string>::const_iterator li = libs.begin();
li != libs.end(); ++li)
@@ -548,41 +557,59 @@
{
continue;
}
-
- // Add a link entry for this item.
- int dependee_index = this->AddLinkEntry(item);
-
- // The depender must come before the dependee.
- if(depender_index >= 0)
+ if(item == "debug")
{
- this->EntryConstraintGraph[dependee_index].push_back(depender_index);
+ llt = cmTarget::DEBUG;
+ haveLLT = true;
}
- else
+ else if(item == "optimized")
{
- // This is a direct dependency of the target being linked.
- this->OriginalEntries.push_back(dependee_index);
+ llt = cmTarget::OPTIMIZED;
+ haveLLT = true;
}
+ else if(item == "general")
+ {
+ llt = cmTarget::GENERAL;
+ haveLLT = true;
+ }
+ else if(!haveLLT || llt == cmTarget::GENERAL || llt == linkType )
+ {
+ haveLLT = false;
- // Update the inferred dependencies for earlier items.
- for(std::map<int, DependSet>::iterator dsi = dependSets.begin();
- dsi != dependSets.end(); ++dsi)
- {
- // Add this item to the inferred dependencies of other items.
- // Target items are never inferred dependees because unknown
- // items are outside libraries that should not be depending on
- // targets.
- if(!this->EntryList[dependee_index].Target &&
- dependee_index != dsi->first)
+ // Add a link entry for this item.
+ int dependee_index = this->AddLinkEntry(item);
+
+ // The depender must come before the dependee.
+ if(depender_index >= 0)
{
- dsi->second.insert(dependee_index);
+ this->EntryConstraintGraph[dependee_index].push_back(depender_index);
+ }
+ else
+ {
+ // This is a direct dependency of the target being linked.
+ this->OriginalEntries.push_back(dependee_index);
}
- }
- // If this item needs to have dependencies inferred, do so.
- if(this->InferredDependSets[dependee_index])
- {
- // Make sure an entry exists to hold the set for the item.
- dependSets[dependee_index];
+ // Update the inferred dependencies for earlier items.
+ for(std::map<int, DependSet>::iterator dsi = dependSets.begin();
+ dsi != dependSets.end(); ++dsi)
+ {
+ // Add this item to the inferred dependencies of other items.
+ // Target items are never inferred dependees because unknown
+ // items are outside libraries that should not be depending on
+ // targets.
+ if(!this->EntryList[dependee_index].Target &&
+ dependee_index != dsi->first)
+ {
+ dsi->second.insert(dependee_index);
+ }
+ }
+ // If this item needs to have dependencies inferred, do so.
+ if(this->InferredDependSets[dependee_index])
+ {
+ // Make sure an entry exists to hold the set for the item.
+ dependSets[dependee_index];
+ }
}
}
_______________________________________________
Kde-windows mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-windows