summaryrefslogtreecommitdiffstats
path: root/Tests/CompileDefinitions
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-08-06 13:51:08 (GMT)
committerBrad King <brad.king@kitware.com>2014-08-06 14:13:04 (GMT)
commit3f476beaf7ffc20a27d97fbf04f6699791996f7f (patch)
tree33f348af0065d1c7b9ae6d8d0d3903a28ac9709f /Tests/CompileDefinitions
parentebd8fa2256c9293b3887f6aeecc9aa7ee718137d (diff)
downloadCMake-3f476beaf7ffc20a27d97fbf04f6699791996f7f.zip
CMake-3f476beaf7ffc20a27d97fbf04f6699791996f7f.tar.gz
CMake-3f476beaf7ffc20a27d97fbf04f6699791996f7f.tar.bz2
Genex: Do not consider 'head' when evaluating build properties
When $<TARGET_PROPERTY> names a build property like COMPILE_DEFINITIONS but not the usage requirement (INTERFACE_) version of it, the value should be that used to build the target. It should not be influenced by a dependent 'head' target like usage requirements are. Extend the CompileDefinitions test with a case covering the corrected behavior. Reviewed-by: Stephen Kelly <steveire@gmail.com>
Diffstat (limited to 'Tests/CompileDefinitions')
-rw-r--r--Tests/CompileDefinitions/target_prop/CMakeLists.txt5
-rw-r--r--Tests/CompileDefinitions/target_prop/usetgt.c10
2 files changed, 15 insertions, 0 deletions
diff --git a/Tests/CompileDefinitions/target_prop/CMakeLists.txt b/Tests/CompileDefinitions/target_prop/CMakeLists.txt
index 2ca2869..311975c 100644
--- a/Tests/CompileDefinitions/target_prop/CMakeLists.txt
+++ b/Tests/CompileDefinitions/target_prop/CMakeLists.txt
@@ -53,3 +53,8 @@ set_property(TARGET target_prop_mixed_executable APPEND PROPERTY COMPILE_DEFINIT
"LINK_LANGUAGE_IS_$<TARGET_PROPERTY:LINKER_LANGUAGE>"
"C_EXECUTABLE_LINK_LANGUAGE_IS_$<TARGET_PROPERTY:target_prop_c_executable,LINKER_LANGUAGE>"
)
+
+add_library(tgt STATIC IMPORTED)
+set_property(TARGET tgt APPEND PROPERTY COMPILE_DEFINITIONS TGT_DEF TGT_TYPE_$<TARGET_PROPERTY:TYPE>)
+add_executable(usetgt usetgt.c)
+target_compile_definitions(usetgt PRIVATE $<TARGET_PROPERTY:tgt,COMPILE_DEFINITIONS>)
diff --git a/Tests/CompileDefinitions/target_prop/usetgt.c b/Tests/CompileDefinitions/target_prop/usetgt.c
new file mode 100644
index 0000000..6672a3e
--- /dev/null
+++ b/Tests/CompileDefinitions/target_prop/usetgt.c
@@ -0,0 +1,10 @@
+#ifndef TGT_DEF
+# error TGT_DEF incorrectly not defined
+#endif
+#ifndef TGT_TYPE_STATIC_LIBRARY
+# error TGT_TYPE_STATIC_LIBRARY incorrectly not defined
+#endif
+#ifdef TGT_TYPE_EXECUTABLE
+# error TGT_TYPE_EXECUTABLE incorrectly defined
+#endif
+int main(void) { return 0; }