summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudio8Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-10-20 20:38:37 (GMT)
committerBrad King <brad.king@kitware.com>2009-10-20 20:38:37 (GMT)
commitbc43b0f2a4dcecaaf653bb2d8b2bc13b4245f4d6 (patch)
treea574ad6e61fee1b5b4865812746159359203d0e5 /Source/cmGlobalVisualStudio8Generator.cxx
parent8d94703cc2532ea51aef5101462e90ac61e04994 (diff)
downloadCMake-bc43b0f2a4dcecaaf653bb2d8b2bc13b4245f4d6.zip
CMake-bc43b0f2a4dcecaaf653bb2d8b2bc13b4245f4d6.tar.gz
CMake-bc43b0f2a4dcecaaf653bb2d8b2bc13b4245f4d6.tar.bz2
Do not link library dependencies in VS solutions
In VS 8 and greater this commit implements add_dependencies(myexe mylib) # depend without linking by adding the LinkLibraryDependencies="false" option to project files. Previously the above code would cause myexe to link to mylib in VS 8 and greater. This option prevents dependencies specified only in the solution from being linked. We already specify the real link library dependencies in the project files, and any project depending on this to link would not have worked in Makefile generators. We were already avoiding this problem in VS 7.1 and below by inserting intermediate mylib_UTILITY targets. It was more important for those versions because if a static library depended on another library the librarian would copy the dependees into the depender! This is no longer the case with VS 8 and above so we do not need that workaround. See issue #9732.
Diffstat (limited to 'Source/cmGlobalVisualStudio8Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index e8b8782..8aec865 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -281,6 +281,29 @@ cmGlobalVisualStudio8Generator
}
//----------------------------------------------------------------------------
+bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies(
+ cmTarget& target)
+{
+ // Look for utility dependencies that magically link.
+ for(std::set<cmStdString>::const_iterator ui =
+ target.GetUtilities().begin();
+ ui != target.GetUtilities().end(); ++ui)
+ {
+ if(cmTarget* depTarget = this->FindTarget(0, ui->c_str()))
+ {
+ if(depTarget->GetProperty("EXTERNAL_MSPROJECT"))
+ {
+ // This utility dependency names an external .vcproj target.
+ // We use LinkLibraryDependencies="true" to link to it without
+ // predicting the .lib file location or name.
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+//----------------------------------------------------------------------------
static cmVS7FlagTable cmVS8ExtraFlagTable[] =
{
{"CallingConvention", "Gd", "cdecl", "0", 0 },