diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2006-11-25 15:59:26 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2006-11-25 15:59:26 (GMT) |
commit | 9baa760315f440b6c32087cdd5918d8a46c188d7 (patch) | |
tree | 1454ddd6ef39ce8676bd375c4f9e6fa8e358ad96 /Source/cmTarget.cxx | |
parent | 3ad6f7e8808333133cec8ab3bb8856df31ccc873 (diff) | |
download | CMake-9baa760315f440b6c32087cdd5918d8a46c188d7.zip CMake-9baa760315f440b6c32087cdd5918d8a46c188d7.tar.gz CMake-9baa760315f440b6c32087cdd5918d8a46c188d7.tar.bz2 |
BUG: fix problem when a target name is the same as the output of a custom command
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e7e3b99..0033d16 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -229,16 +229,42 @@ void cmTarget::TraceVSDependencies(std::string projFile, // add its dependencies to the list to check unsigned int i; for (i = 0; i < outsf->GetCustomCommand()->GetDepends().size(); ++i) - { + { std::string dep = cmSystemTools::GetFilenameName( outsf->GetCustomCommand()->GetDepends()[i]); if (cmSystemTools::GetFilenameLastExtension(dep) == ".exe") { dep = cmSystemTools::GetFilenameWithoutLastExtension(dep); } - // watch for target dependencies, - if(this->Makefile->GetLocalGenerator()-> - GetGlobalGenerator()->FindTarget(0, dep.c_str())) + bool isUtility = false; + // see if we can find a target with this name + cmTarget* t = this->Makefile->GetLocalGenerator()-> + GetGlobalGenerator()->FindTarget(0, dep.c_str()); + if(t) + { + // if we find the target and the dep was given as a full + // path, then make sure it was not a full path to something + // else, and the fact that the name matched a target was + // just a coincident + if(cmSystemTools::FileIsFullPath( + outsf->GetCustomCommand()->GetDepends()[i].c_str())) + { + std::string tLocation = t->GetLocation(0); + tLocation = cmSystemTools::GetFilenamePath(tLocation); + std::string depLocation = cmSystemTools::GetFilenamePath( + std::string(outsf->GetCustomCommand()->GetDepends()[i].c_str())); + if(depLocation == tLocation) + { + isUtility = true; + } + } + // if it was not a full path then it must be a target + else + { + isUtility = true; + } + } + if(isUtility) { // add the depend as a utility on the target this->AddUtility(dep.c_str()); |