[Cmake-commits] CMake branch, next, updated. v2.8.10.2-1598-gdb10988
Stephen Kelly
steveire at gmail.com
Sun Jan 13 18:10:08 EST 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via db1098843424b5f3553600799f162aa08214ecb3 (commit)
via 2bee6f5ba5b3f33817cc00e056a7df60d05c9399 (commit)
from 49c0ab65f72bd822bc1ee2aa39d3d85690363838 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=db1098843424b5f3553600799f162aa08214ecb3
commit db1098843424b5f3553600799f162aa08214ecb3
Merge: 49c0ab6 2bee6f5
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jan 13 18:10:06 2013 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Jan 13 18:10:06 2013 -0500
Merge topic 'TARGET_DEFINED-genex' into next
2bee6f5 Add the TARGET_DEFINED generator expression
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2bee6f5ba5b3f33817cc00e056a7df60d05c9399
commit 2bee6f5ba5b3f33817cc00e056a7df60d05c9399
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Nov 19 23:56:12 2012 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Jan 14 00:08:47 2013 +0100
Add the TARGET_DEFINED generator expression
This tests whether the parameter is a usable target.
diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h
index b8889ac..fa21907 100644
--- a/Source/cmDocumentGeneratorExpressions.h
+++ b/Source/cmDocumentGeneratorExpressions.h
@@ -37,6 +37,7 @@
"target in the same buildsystem. Expands to the empty string " \
"otherwise.\n" \
" $<TARGET_FILE:tgt> = main file (.exe, .so.1.2, .a)\n" \
+ " $<TARGET_DEFINED:tgt> = '1' if tgt is a target, else '0'\n" \
" $<TARGET_LINKER_FILE:tgt> = file used to link (.a, .lib, .so)\n" \
" $<TARGET_SONAME_FILE:tgt> = file with soname (.so.3)\n" \
"where \"tgt\" is the name of a target. " \
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index f4e4131..8e40815 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -289,6 +289,22 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
} configurationTestNode;
+static const struct TargetDefinedNode : public cmGeneratorExpressionNode
+{
+ TargetDefinedNode() {}
+
+ virtual int NumExpectedParameters() const { return 1; }
+
+ std::string Evaluate(const std::vector<std::string> ¶meters,
+ cmGeneratorExpressionContext *context,
+ const GeneratorExpressionContent *,
+ cmGeneratorExpressionDAGChecker *) const
+ {
+ return context->Makefile->FindTargetToUse(parameters.front().c_str())
+ ? "1" : "0";
+ }
+} targetDefinedNode;
+
//----------------------------------------------------------------------------
static const char* targetPropertyTransitiveWhitelist[] = {
"INTERFACE_INCLUDE_DIRECTORIES"
@@ -702,6 +718,8 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
return &buildInterfaceNode;
else if (identifier == "INSTALL_INTERFACE")
return &installInterfaceNode;
+ else if (identifier == "TARGET_DEFINED")
+ return &targetDefinedNode;
return 0;
}
diff --git a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt
index 84a23ef..a37c597 100644
--- a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt
@@ -23,4 +23,6 @@ add_executable(consumer
target_compile_definitions(consumer
PRIVATE target_compile_definitions importedlib
+ $<$<TARGET_DEFINED:notdefined>:SHOULD_NOT_BE_DEFINED>
+ $<$<TARGET_DEFINED:importedlib>:SHOULD_BE_DEFINED>
)
diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp
index e3788dd..1ef657d 100644
--- a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp
+++ b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp
@@ -15,4 +15,12 @@
#error Expected MY_IMPORTEDINTERFACE_DEFINE
#endif
+#ifdef SHOULD_NOT_BE_DEFINED
+#error Unexpected SHOULD_NOT_BE_DEFINED
+#endif
+
+#ifndef SHOULD_BE_DEFINED
+#error Expected SHOULD_BE_DEFINED
+#endif
+
int main() { return 0; }
-----------------------------------------------------------------------
Summary of changes:
Source/cmDocumentGeneratorExpressions.h | 1 +
Source/cmGeneratorExpressionEvaluator.cxx | 18 ++++++++++++++++++
.../target_compile_definitions/CMakeLists.txt | 2 ++
.../target_compile_definitions/consumer.cpp | 8 ++++++++
4 files changed, 29 insertions(+), 0 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list