[cmake-commits] hoffman committed cmLocalGenerator.cxx 1.163 1.164
cmTarget.cxx 1.107 1.108
cmake-commits at cmake.org
cmake-commits at cmake.org
Sat Nov 25 10:59:29 EST 2006
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv10661
Modified Files:
cmLocalGenerator.cxx cmTarget.cxx
Log Message:
BUG: fix problem when a target name is the same as the output of a custom command
Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -d -r1.163 -r1.164
--- cmLocalGenerator.cxx 25 Oct 2006 15:23:03 -0000 1.163
+++ cmLocalGenerator.cxx 25 Nov 2006 15:59:26 -0000 1.164
@@ -1857,6 +1857,22 @@
// Look for a CMake target with the given name.
if(cmTarget* target = this->GlobalGenerator->FindTarget(0, name.c_str()))
{
+ // make sure it is not just a coincidence that the target name
+ // found is part of the inName
+ if(cmSystemTools::FileIsFullPath(inName))
+ {
+ std::string tLocation = target->GetLocation(config);
+ tLocation = cmSystemTools::GetFilenamePath(tLocation);
+ std::string depLocation = cmSystemTools::GetFilenamePath(
+ std::string(inName));
+ if(depLocation != tLocation)
+ {
+ // it is a full path to a depend that has the same name
+ // as a target but is in a different location so do not use
+ // the target as the depend
+ return inName;
+ }
+ }
switch (target->GetType())
{
case cmTarget::EXECUTABLE:
Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- cmTarget.cxx 16 Nov 2006 15:57:00 -0000 1.107
+++ cmTarget.cxx 25 Nov 2006 15:59:26 -0000 1.108
@@ -229,16 +229,42 @@
// 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());
More information about the Cmake-commits
mailing list