[cmake-commits] alex committed cmLocalUnixMakefileGenerator3.cxx
1.204.4.1 1.204.4.2 cmTarget.cxx 1.134.4.1 1.134.4.2
cmake-commits at cmake.org
cmake-commits at cmake.org
Mon May 7 14:42:15 EDT 2007
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv7708
Modified Files:
Tag: CMake-ACC-TargetUsedAsCommand
cmLocalUnixMakefileGenerator3.cxx cmTarget.cxx
Log Message:
ENH: if a target name is used as command in add_custom_command,
automatically add the dependency to this target
Alex
Index: cmLocalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v
retrieving revision 1.204.4.1
retrieving revision 1.204.4.2
diff -u -d -r1.204.4.1 -r1.204.4.2
--- cmLocalUnixMakefileGenerator3.cxx 4 May 2007 20:43:29 -0000 1.204.4.1
+++ cmLocalUnixMakefileGenerator3.cxx 7 May 2007 18:42:13 -0000 1.204.4.2
@@ -847,21 +847,6 @@
(d->c_str(), this->ConfigurationName.c_str());
depends.push_back(dep);
}
-
- // if the any of the commands for this custom command are a target
- // within cmake, add the dependency to the generated executable
-/* for(cmCustomCommandLines::const_iterator cl = cc.GetCommandLines().begin();
- cl != cc.GetCommandLines().end(); ++cl)
- {
- const cmCustomCommandLine& commandLine = *cl;
- cmTarget *target =
- this->GetGlobalGenerator()->FindTarget(0, commandLine[0].c_str());
- if ((target!=0) && (target->GetType()==cmTarget::EXECUTABLE))
- {
- depends.push_back( target->GetLocation( this->ConfigurationName.c_str()));
- fprintf(stderr, "adding file dep %s\n", target->GetLocation( this->ConfigurationName.c_str()));
- }
- }*/
}
//----------------------------------------------------------------------------
Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.134.4.1
retrieving revision 1.134.4.2
diff -u -d -r1.134.4.1 -r1.134.4.2
--- cmTarget.cxx 4 May 2007 20:43:29 -0000 1.134.4.1
+++ cmTarget.cxx 7 May 2007 18:42:13 -0000 1.134.4.2
@@ -533,6 +533,26 @@
srcFilesQueued.insert(temp);
}
}
+
+ // check if commands for this custom commands are names of targets and
+ // if that's the case add these targets as dependencies
+ std::vector<std::string> automaticTargetDepends;
+ for(cmCustomCommandLines::const_iterator it=
+ outsf->GetCustomCommand()->GetCommandLines().begin();
+ it!=outsf->GetCustomCommand()->GetCommandLines().end();
+ ++it)
+ {
+ const std::string& currentCommand = (*it)[0];
+ // see if we can find a target with this name
+ cmTarget* t = this->Makefile->GetLocalGenerator()->
+ GetGlobalGenerator()->FindTarget(0, currentCommand.c_str());
+ if (( t) && (t->GetType()==cmTarget::EXECUTABLE))
+ {
+ automaticTargetDepends.push_back(currentCommand);
+ }
+ }
+ outsf->GetCustomCommand()->AppendDepends(automaticTargetDepends);
+
// add its dependencies to the list to check
for (unsigned int i = 0; i < outsf->GetCustomCommand()->GetDepends().size(); ++i)
{
@@ -589,19 +609,7 @@
}
}
}
-
- // add its dependencies to the list to check
-/* for (unsigned int i = 0; i < outsf->GetCustomCommand()->GetCommandLines().size(); ++i)
- {
- // see if we can find a target with this name
- cmTarget* t = this->Makefile->GetLocalGenerator()->
- GetGlobalGenerator()->FindTarget(0, outsf->GetCustomCommand()->GetCommandLines()[i][0].c_str());
- if (( t) && (t->GetType()==cmTarget::EXECUTABLE))
- {
- this->AddUtility(t->GetName());
- fprintf(stderr, "adding dep: %s\n", t->GetName());
- }
- }*/
+
}
// finished with this SF move to the next
srcFilesToProcess.pop();
More information about the Cmake-commits
mailing list