summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-02-24 14:45:37 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-02-24 14:45:51 (GMT)
commitd4ce3d65f3e82fd1a8549cc525a661d929e5ad10 (patch)
treed4d513e573f435fb5d6625f0a7f21dc1b10659e2 /Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake
parent022990c352ff2f0addbc8c36637880ea167bbae2 (diff)
parentb722eea9253acd9e33921779175fc615d064577a (diff)
downloadCMake-d4ce3d65f3e82fd1a8549cc525a661d929e5ad10.zip
CMake-d4ce3d65f3e82fd1a8549cc525a661d929e5ad10.tar.gz
CMake-d4ce3d65f3e82fd1a8549cc525a661d929e5ad10.tar.bz2
Merge topic 'LINK_LANGUAGE-genex-respects-LINKER_LANGUAGE-property'
b722eea925 Genex: LINK_LANGUAGE respects LINKER_LANGUAGE property Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5841
Diffstat (limited to 'Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake')
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake9
1 files changed, 9 insertions, 0 deletions
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake
index f3fe955..22d3df7 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake
@@ -7,6 +7,8 @@ enable_language(CXX)
add_library(shared_C SHARED func.c)
add_library(shared_CXX SHARED func.cxx)
+add_library(static_cxx STATIC func.cxx)
+target_compile_definitions(static_cxx PRIVATE BUILD_STATIC)
add_library(static1_C STATIC empty.c)
target_link_libraries (static1_C INTERFACE $<$<LINK_LANGUAGE:C>:shared_C>)
@@ -70,3 +72,10 @@ add_executable(LinkLibraries_C_static main.c)
target_link_libraries (LinkLibraries_C_static PRIVATE static3)
add_executable(LinkLibraries_CXX_static main.cxx)
target_link_libraries (LinkLibraries_CXX_static PRIVATE static3)
+
+# $<LINK_LANGUAGE:> change, by default, link language from C to CXX
+# but because LINKER_LANGUAGE property is set, keep C as link language
+add_executable(LinkLibraries_C_static_CXX main.c)
+target_compile_definitions (LinkLibraries_C_static_CXX PRIVATE C_USE_CXX)
+target_link_libraries (LinkLibraries_C_static_CXX PRIVATE $<$<LINK_LANGUAGE:C>:static_cxx>)
+set_property(TARGET LinkLibraries_C_static_CXX PROPERTY LINKER_LANGUAGE C)