diff options
author | Brad King <brad.king@kitware.com> | 2020-07-14 11:22:24 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-07-14 11:22:30 (GMT) |
commit | 2da778664d3e99ada4e67a5a1b9d377f92a9f75f (patch) | |
tree | 2eb7323137ab1aef0147ed58f13bbdd75319337a /Tests/RunCMake | |
parent | 35928fa7ca4c2b4cc39c4cf6aaa2059ebb3b86ce (diff) | |
parent | 6491d2503c942b9dfb4db94dba6569e400b57a95 (diff) | |
download | CMake-2da778664d3e99ada4e67a5a1b9d377f92a9f75f.zip CMake-2da778664d3e99ada4e67a5a1b9d377f92a9f75f.tar.gz CMake-2da778664d3e99ada4e67a5a1b9d377f92a9f75f.tar.bz2 |
Merge topic 'genx-COMPILE_LANGUAGE-support'
6491d2503c Genex $<COMPILE_LANGUAGE>: Extend contexts supported
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5005
Diffstat (limited to 'Tests/RunCMake')
4 files changed, 36 insertions, 0 deletions
diff --git a/Tests/RunCMake/GenEx-COMPILE_LANGUAGE/COMPILE_LANGUAGE-TARGET_PROPERTY.cmake b/Tests/RunCMake/GenEx-COMPILE_LANGUAGE/COMPILE_LANGUAGE-TARGET_PROPERTY.cmake new file mode 100644 index 0000000..293ddda --- /dev/null +++ b/Tests/RunCMake/GenEx-COMPILE_LANGUAGE/COMPILE_LANGUAGE-TARGET_PROPERTY.cmake @@ -0,0 +1,17 @@ +enable_language(C) + +add_library (lib SHARED empty.c) +set_target_properties(lib PROPERTIES + INCLUDE_DIRECTORIES "$<$<COMPILE_LANGUAGE:C>:/usr/include>" + COMPILE_DEFINITIONS "$<$<COMPILE_LANGUAGE:C>:DEF>" + COMPILE_OPTIONS "$<$<COMPILE_LANGUAGE:C>:-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_LANGUAGE/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-COMPILE_LANGUAGE/RunCMakeTest.cmake index 6691fdf..15a5e79 100644 --- a/Tests/RunCMake/GenEx-COMPILE_LANGUAGE/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenEx-COMPILE_LANGUAGE/RunCMakeTest.cmake @@ -8,3 +8,4 @@ run_cmake(COMPILE_LANGUAGE-add_executable) run_cmake(COMPILE_LANGUAGE-add_library) run_cmake(COMPILE_LANGUAGE-add_test) run_cmake(COMPILE_LANGUAGE-unknown-lang) +run_cmake(COMPILE_LANGUAGE-TARGET_PROPERTY) 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) |