summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeCommands/target_compile_definitions
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2012-11-19 22:56:12 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-01-13 23:08:47 (GMT)
commit2bee6f5ba5b3f33817cc00e056a7df60d05c9399 (patch)
treedd762381e9921188650734c85cdb22f4f6243333 /Tests/CMakeCommands/target_compile_definitions
parent3367d0cc7fe50e6b6fc06c85c8c38c683c1d3805 (diff)
downloadCMake-2bee6f5ba5b3f33817cc00e056a7df60d05c9399.zip
CMake-2bee6f5ba5b3f33817cc00e056a7df60d05c9399.tar.gz
CMake-2bee6f5ba5b3f33817cc00e056a7df60d05c9399.tar.bz2
Add the TARGET_DEFINED generator expression
This tests whether the parameter is a usable target.
Diffstat (limited to 'Tests/CMakeCommands/target_compile_definitions')
-rw-r--r--Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt2
-rw-r--r--Tests/CMakeCommands/target_compile_definitions/consumer.cpp8
2 files changed, 10 insertions, 0 deletions
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; }