diff options
author | Brad King <brad.king@kitware.com> | 2010-12-08 21:13:07 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-12-15 19:53:48 (GMT) |
commit | f0cdb6001b3e915fc0d9c1120165d49725440bbd (patch) | |
tree | a310c36370b6935d7458f70a61e3eada72ce8b08 /Source/cmTarget.cxx | |
parent | 4749e4cb76cc1e23cb23f37ceec2e856a18218ce (diff) | |
download | CMake-f0cdb6001b3e915fc0d9c1120165d49725440bbd.zip CMake-f0cdb6001b3e915fc0d9c1120165d49725440bbd.tar.gz CMake-f0cdb6001b3e915fc0d9c1120165d49725440bbd.tar.bz2 |
Introduce "generator expression" syntax to custom commands (#11209)
Evaluate in the COMMAND arguments of custom commands the generator
expression syntax introduced in commit d2e1f2b4 (Introduce "generator
expressions" to add_test, 2009-08-11). These expressions have a syntax
like $<TARGET_FILE:mytarget> and are evaluated during build system
generation. This syntax allows per-configuration target output files to
be referenced in custom command lines.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c82c11e..40f68e4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -17,6 +17,7 @@ #include "cmGlobalGenerator.h" #include "cmComputeLinkInformation.h" #include "cmListFileCache.h" +#include "cmGeneratorExpression.h" #include <cmsys/RegularExpression.hxx> #include <map> #include <set> @@ -1402,6 +1403,7 @@ cmTargetTraceDependencies { // Transform command names that reference targets built in this // project to corresponding target-level dependencies. + cmGeneratorExpression ge(this->Makefile, 0, cc.GetBacktrace(), true); for(cmCustomCommandLines::const_iterator cit = cc.GetCommandLines().begin(); cit != cc.GetCommandLines().end(); ++cit) { @@ -1418,6 +1420,21 @@ cmTargetTraceDependencies this->Target->AddUtility(command.c_str()); } } + + // Check for target references in generator expressions. + for(cmCustomCommandLine::const_iterator cli = cit->begin(); + cli != cit->end(); ++cli) + { + ge.Process(*cli); + } + } + + // Add target-level dependencies referenced by generator expressions. + std::set<cmTarget*> targets = ge.GetTargets(); + for(std::set<cmTarget*>::iterator ti = targets.begin(); + ti != targets.end(); ++ti) + { + this->Target->AddUtility((*ti)->GetName()); } // Queue the custom command dependencies. |