summaryrefslogtreecommitdiffstats
path: root/Source/cmIfCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-08-20 15:45:16 (GMT)
committerBrad King <brad.king@kitware.com>2008-08-20 15:45:16 (GMT)
commitfff812db95cea0844833e1cde2942ee52bffe911 (patch)
treefe64788489c02832604f6119a24ba2ff04428b67 /Source/cmIfCommand.cxx
parent07665de0386e3ee572e95f999d6b516391331e26 (diff)
downloadCMake-fff812db95cea0844833e1cde2942ee52bffe911.zip
CMake-fff812db95cea0844833e1cde2942ee52bffe911.tar.gz
CMake-fff812db95cea0844833e1cde2942ee52bffe911.tar.bz2
ENH: Add if(TARGET) command
It is useful to be able to test if a target has been created. Often targets are created only inside conditions. Rather than storing the result of the condition manually for testing by other parts of the project, it is much easier for the other parts to just test for the target's existence. This will also be useful when find-modules start reporting results with IMPORTED targets and projects want to test if a certain target is available.
Diffstat (limited to 'Source/cmIfCommand.cxx')
-rw-r--r--Source/cmIfCommand.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 2806dd4..e82a8fb 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -408,6 +408,13 @@ namespace
makefile->GetPolicies()->GetPolicyID((argP1)->c_str(), pid),
reducible, arg, newArgs, argP1, argP2);
}
+ // does a target exist
+ if (*arg == "TARGET" && argP1 != newArgs.end())
+ {
+ HandlePredicate(
+ makefile->FindTargetToUse((argP1)->c_str())? true:false,
+ reducible, arg, newArgs, argP1, argP2);
+ }
// is a variable defined
if (*arg == "DEFINED" && argP1 != newArgs.end())
{