diff options
author | Brad King <brad.king@kitware.com> | 2006-01-14 01:51:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-01-14 01:51:45 (GMT) |
commit | 8340c0d18611d9ff6a8237ffe3d3cd6655a1c518 (patch) | |
tree | 412c5eb73b7b014c665b96511f31047a7616d13c /Source/cmLocalUnixMakefileGenerator3.cxx | |
parent | 18477b194ca49a58c253af76bf11504dd51edaef (diff) | |
download | CMake-8340c0d18611d9ff6a8237ffe3d3cd6655a1c518.zip CMake-8340c0d18611d9ff6a8237ffe3d3cd6655a1c518.tar.gz CMake-8340c0d18611d9ff6a8237ffe3d3cd6655a1c518.tar.bz2 |
ENH: Further centralized custom command dependency computation. Custom command dependencies in the source tree may now also be specified relative to the source directory.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 56 |
1 files changed, 14 insertions, 42 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index e484a3c..c66bdea 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2270,6 +2270,7 @@ cmLocalUnixMakefileGenerator3 ::AppendTargetDepends(std::vector<std::string>& depends, cmTarget& target) { + // Static libraries never depend on anything for linking. if(target.GetType() == cmTarget::STATIC_LIBRARY) { return; @@ -2289,48 +2290,17 @@ cmLocalUnixMakefileGenerator3 // Don't emit the same library twice for this target. if(emitted.insert(lib->first).second) { - // Add this dependency. - this->AppendAnyDepend(depends, lib->first.c_str()); - } - } -} - -//---------------------------------------------------------------------------- -void -cmLocalUnixMakefileGenerator3 -::AppendAnyDepend(std::vector<std::string>& depends, const char* name) -{ - // There are a few cases for the name of the target: - // - CMake target. - // - Full path to a file: depend on it. - // - Other format (like -lm): no file on which to depend, do nothing. - - // Lookup the real name of the dependency in case it is a CMake target. - bool local; - std::string dep = this->GetRealDependency(name, - m_ConfigurationName.c_str(), - &local); - if(dep == name) - { - if(local) - { - // The dependency is on a CMake utility target in the current - // makefile. Just depend on it directly. - depends.push_back(name); - } - else if(cmSystemTools::FileIsFullPath(name)) - { - // This is a path to a file. Just trust the listfile author - // that it will be present or there is a rule to build it. - depends.push_back(cmSystemTools::CollapseFullPath(name)); + // Depend only on other CMake targets. + if(cmTarget* tgt = m_GlobalGenerator->FindTarget(0, lib->first.c_str())) + { + if(const char* location = + tgt->GetLocation(m_ConfigurationName.c_str())) + { + depends.push_back(location); + } + } } } - else - { - // The dependency is on a CMake target and has been transformed to - // the target's location on disk. - depends.push_back(dep); - } } //---------------------------------------------------------------------------- @@ -2370,8 +2340,10 @@ cmLocalUnixMakefileGenerator3 for(std::vector<std::string>::const_iterator d = cc.GetDepends().begin(); d != cc.GetDepends().end(); ++d) { - // Add this dependency. - this->AppendAnyDepend(depends, d->c_str()); + // Lookup the real name of the dependency in case it is a CMake target. + std::string dep = this->GetRealDependency(d->c_str(), + m_ConfigurationName.c_str()); + depends.push_back(dep); } } |