summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-12-21 20:04:06 (GMT)
committerBrad King <brad.king@kitware.com>2007-12-21 20:04:06 (GMT)
commit3cf3bb664aa9b6c447c90c33cd6b5c1dff8c1a10 (patch)
treea392ebf61b0938354d5a73979a452102ff5eef7c /Source/cmGlobalUnixMakefileGenerator3.cxx
parentd2be142e3bd2b1347a5bce0c75740b3b2e7acd94 (diff)
downloadCMake-3cf3bb664aa9b6c447c90c33cd6b5c1dff8c1a10.zip
CMake-3cf3bb664aa9b6c447c90c33cd6b5c1dff8c1a10.tar.gz
CMake-3cf3bb664aa9b6c447c90c33cd6b5c1dff8c1a10.tar.bz2
ENH: Make static library targets depend on targets to which they "link" for the purpose of build ordering. This makes the build order consistent for static and shared library builds. It is also useful when custom command inputs of one library are generated as custom commands outputs of another. It may be useful in the future for Fortran module dependencies. Implemented for Makefiles, Xcode, and VS 8 and above. Added sample code to do it for VS 7.1 and below, but left it disabled with comments explaining why. Likely it will never be needed on VS 7.1 or below anyway.
Diffstat (limited to 'Source/cmGlobalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx43
1 files changed, 11 insertions, 32 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 96d1b33..8fc5fc2 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -903,24 +903,21 @@ cmGlobalUnixMakefileGenerator3
// A target should not depend on itself.
emitted.insert(target.GetName());
-
- // Loop over all library dependencies but not for static libs
- if (target.GetType() != cmTarget::STATIC_LIBRARY)
+
+ // Loop over all library dependencies.
+ const cmTarget::LinkLibraryVectorType& tlibs = target.GetLinkLibraries();
+ for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin();
+ lib != tlibs.end(); ++lib)
{
- const cmTarget::LinkLibraryVectorType& tlibs = target.GetLinkLibraries();
- for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin();
- lib != tlibs.end(); ++lib)
+ // Don't emit the same library twice for this target.
+ if(emitted.insert(lib->first).second)
{
- // Don't emit the same library twice for this target.
- if(emitted.insert(lib->first).second)
- {
- // Add this dependency.
- this->AppendAnyGlobalDepend(depends, lib->first.c_str(),
- emitted, target);
- }
+ // Add this dependency.
+ this->AppendAnyGlobalDepend(depends, lib->first.c_str(),
+ emitted, target);
}
}
-
+
// Loop over all utility dependencies.
const std::set<cmStdString>& tutils = target.GetUtilities();
for(std::set<cmStdString>::const_iterator util = tutils.begin();
@@ -967,24 +964,6 @@ cmGlobalUnixMakefileGenerator3
std::string tgtName = lg3->GetRelativeTargetDirectory(*result);
tgtName += "/all";
depends.push_back(tgtName);
- if(result->GetType() == cmTarget::STATIC_LIBRARY)
- {
- // Since the static library itself does not list dependencies we
- // need to chain its dependencies here.
- const cmTarget::LinkLibraryVectorType& tlibs
- = result->GetLinkLibraries();
- for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin();
- lib != tlibs.end(); ++lib)
- {
- // Don't emit the same library twice for this target.
- if(emitted.insert(lib->first).second)
- {
- // Add this dependency.
- this->AppendAnyGlobalDepend(depends, lib->first.c_str(),
- emitted, *result);
- }
- }
- }
return;
}
}