summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeCommands/target_compile_definitions
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-01-30 22:38:04 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-01-31 16:34:20 (GMT)
commit0b92602b816e2584db3781b120a1e5200da72ada (patch)
treeccf0d78b89d14d2bc317725b81ff3281d8b83ed1 /Tests/CMakeCommands/target_compile_definitions
parent0fa7f69c0e2cdcd8b7ece400651ee7821b2ede4b (diff)
downloadCMake-0b92602b816e2584db3781b120a1e5200da72ada.zip
CMake-0b92602b816e2584db3781b120a1e5200da72ada.tar.gz
CMake-0b92602b816e2584db3781b120a1e5200da72ada.tar.bz2
Add the $<LINKED:...> generator expression.
This is both a short form of using a TARGET_DEFINED expression together with a TARGET_PROPERTY definition, and a way to strip non-target content from interface properties when exporting.
Diffstat (limited to 'Tests/CMakeCommands/target_compile_definitions')
-rw-r--r--Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt6
-rw-r--r--Tests/CMakeCommands/target_compile_definitions/consumer.cpp4
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 8a4437b..0bfcc1b 100644
--- a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt
@@ -16,9 +16,15 @@ add_executable(consumer
"${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp"
)
+add_library(linked UNKNOWN IMPORTED)
+set_property(TARGET linked PROPERTY
+ INTERFACE_COMPILE_DEFINITIONS "MY_LINKED_DEFINE")
+
+
target_compile_definitions(consumer
PRIVATE $<TARGET_PROPERTY:target_compile_definitions,INTERFACE_COMPILE_DEFINITIONS>
$<$<TARGET_DEFINED:notdefined>:SHOULD_NOT_BE_DEFINED>
$<$<TARGET_DEFINED:target_compile_definitions>:SHOULD_BE_DEFINED>
+ $<LINKED:linked>
-DDASH_D_DEFINE
)
diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp
index 1a46aa5..c077593 100644
--- a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp
+++ b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp
@@ -23,4 +23,8 @@
#error Expected DASH_D_DEFINE
#endif
+#ifndef MY_LINKED_DEFINE
+#error Expected MY_LINKED_DEFINE
+#endif
+
int main() { return 0; }