diff options
author | Brad King <brad.king@kitware.com> | 2020-06-16 15:02:53 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-06-17 12:13:57 (GMT) |
commit | 5f97e449122804c2f34a1f8b119ca76faf0e7773 (patch) | |
tree | 81421ceea7cf08efcf3efa7f78de35729249d4ba /Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake | |
parent | 0951b1fe072da311e9adb55337ef364e2b6c01d0 (diff) | |
download | CMake-5f97e449122804c2f34a1f8b119ca76faf0e7773.zip CMake-5f97e449122804c2f34a1f8b119ca76faf0e7773.tar.gz CMake-5f97e449122804c2f34a1f8b119ca76faf0e7773.tar.bz2 |
Tests: Shorten case names in RunCMake.target_link_libraries-* tests
Drop the portion of the case names that repeats the name of the
containing test.
Diffstat (limited to 'Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake')
-rw-r--r-- | Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake | 72 |
1 files changed, 72 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 new file mode 100644 index 0000000..f3fe955 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake @@ -0,0 +1,72 @@ + +cmake_minimum_required(VERSION 3.16...3.17) + +enable_language(C) +enable_language(CXX) + +add_library(shared_C SHARED func.c) +add_library(shared_CXX SHARED func.cxx) + + +add_library(static1_C STATIC empty.c) +target_link_libraries (static1_C INTERFACE $<$<LINK_LANGUAGE:C>:shared_C>) + +add_library(static2_C STATIC empty.c) +target_link_libraries (static2_C PRIVATE $<$<LINK_LANGUAGE:C>:shared_C>) + + +set (binary_dir "${CMAKE_BINARY_DIR}") +get_property (is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if (is_multi_config) + string (APPEND binary_dir "/Release") +endif() +add_library(import STATIC IMPORTED) +set_property(TARGET import PROPERTY IMPORTED_LOCATION "${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}static1_C${CMAKE_STATIC_LIBRARY_SUFFIX}") +target_link_libraries (import INTERFACE $<$<LINK_LANGUAGE:C>:shared_C>) +target_link_libraries (import INTERFACE $<$<LINK_LANGUAGE:CXX>:shared_CXX>) + + +add_library(interface INTERFACE) +target_link_libraries (interface INTERFACE $<$<LINK_LANGUAGE:C>:shared_C> + $<$<LINK_LANGUAGE:CXX>:shared_CXX>) + + +add_library(interface2 INTERFACE) +target_link_libraries (interface2 INTERFACE import) + + +add_library(static3 STATIC empty.c) +target_link_libraries (static3 PRIVATE interface) + + +add_library(LinkLibraries_lib SHARED lib.c) +target_link_libraries (LinkLibraries_lib PRIVATE $<$<LINK_LANGUAGE:C>:shared_C>) + +add_library(LinkLibraries_lib2 SHARED lib.c) +target_link_libraries (LinkLibraries_lib2 PRIVATE $<$<LINK_LANGUAGE:C>:static1_C>) + +add_library(LinkLibraries_lib3 SHARED lib.c) +target_link_libraries (LinkLibraries_lib3 PRIVATE $<$<LINK_LANGUAGE:C>:static2_C>) + +add_executable(LinkLibraries_exe main.c) +target_link_libraries (LinkLibraries_exe PRIVATE $<$<LINK_LANGUAGE:C>:shared_C>) + +add_executable(LinkLibraries_C_import main.c) +target_link_libraries (LinkLibraries_C_import PRIVATE import) +add_executable(LinkLibraries_CXX_import main.cxx) +target_link_libraries (LinkLibraries_CXX_import PRIVATE import) + +add_executable(LinkLibraries_C_interface main.c) +target_link_libraries (LinkLibraries_C_interface PRIVATE interface) +add_executable(LinkLibraries_CXX_interface main.cxx) +target_link_libraries (LinkLibraries_CXX_interface PRIVATE interface) + +add_executable(LinkLibraries_C_interface2 main.c) +target_link_libraries (LinkLibraries_C_interface2 PRIVATE interface2) +add_executable(LinkLibraries_CXX_interface2 main.cxx) +target_link_libraries (LinkLibraries_CXX_interface2 PRIVATE interface2) + +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) |