summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2020-07-12 13:25:18 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2020-07-13 14:27:19 (GMT)
commit6491d2503c942b9dfb4db94dba6569e400b57a95 (patch)
tree94e25a580d85774cb4361c0fe56b744da1938698 /Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID
parentc361600fc4b654ececa2f5ebdda64bb39b59ef95 (diff)
downloadCMake-6491d2503c942b9dfb4db94dba6569e400b57a95.zip
CMake-6491d2503c942b9dfb4db94dba6569e400b57a95.tar.gz
CMake-6491d2503c942b9dfb4db94dba6569e400b57a95.tar.bz2
Genex $<COMPILE_LANGUAGE>: Extend contexts supported
When genex $<TARGET_PROPERTY:...> for properties like INCLUDE_DIRECTORIES is evaluated as part of add_custom_command or add_custom_target, genex $<COMPILE_LANGUAGE> and $<COMPLIE_LANG_AND_ID> should be supported. Fixes: #20926
Diffstat (limited to 'Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID')
-rw-r--r--Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID/COMPILE_LANG_AND_ID-TARGET_PROPERTY.cmake17
-rw-r--r--Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID/RunCMakeTest.cmake1
2 files changed, 18 insertions, 0 deletions
diff --git a/Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID/COMPILE_LANG_AND_ID-TARGET_PROPERTY.cmake b/Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID/COMPILE_LANG_AND_ID-TARGET_PROPERTY.cmake
new file mode 100644
index 0000000..6a718d6
--- /dev/null
+++ b/Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID/COMPILE_LANG_AND_ID-TARGET_PROPERTY.cmake
@@ -0,0 +1,17 @@
+enable_language(C)
+
+add_library (lib SHARED empty.c)
+set_target_properties(lib PROPERTIES
+ INCLUDE_DIRECTORIES "$<$<COMPILE_LANG_AND_ID:C,GNU>:/usr/include>"
+ COMPILE_DEFINITIONS "$<$<COMPILE_LANG_AND_ID:C,GNU>:DEF>"
+ COMPILE_OPTIONS "$<$<COMPILE_LANG_AND_ID:C,GNU>:-O>")
+
+add_custom_target(drive
+ COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_PROPERTY:lib,INCLUDE_DIRECTORIES>
+ $<TARGET_PROPERTY:lib,COMPILE_DEFINITIONS>
+ $<TARGET_PROPERTY:lib,COMPILE_OPTIONS>)
+
+add_custom_command(TARGET drive PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_PROPERTY:lib,INCLUDE_DIRECTORIES>
+ $<TARGET_PROPERTY:lib,COMPILE_DEFINITIONS>
+ $<TARGET_PROPERTY:lib,COMPILE_OPTIONS>)
diff --git a/Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID/RunCMakeTest.cmake
index a0a7bb9..68bd05d 100644
--- a/Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GenEx-COMPILE_LANG_AND_ID/RunCMakeTest.cmake
@@ -8,3 +8,4 @@ run_cmake(COMPILE_LANG_AND_ID-add_executable)
run_cmake(COMPILE_LANG_AND_ID-add_library)
run_cmake(COMPILE_LANG_AND_ID-add_test)
run_cmake(COMPILE_LANG_AND_ID-unknown-lang)
+run_cmake(COMPILE_LANG_AND_ID-TARGET_PROPERTY)