diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2023-07-17 21:44:26 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-07-18 17:21:01 (GMT) |
commit | 7351d590ee6a846ed0f2bd4793384a33bf49ea0d (patch) | |
tree | 35ade287824ea6c02e450f3e215eaa67364e8338 /Tests/RunCMake/target_link_libraries-ALIAS | |
parent | 83574a47726b8824d58b65a262c289573fb69bb0 (diff) | |
download | CMake-7351d590ee6a846ed0f2bd4793384a33bf49ea0d.zip CMake-7351d590ee6a846ed0f2bd4793384a33bf49ea0d.tar.gz CMake-7351d590ee6a846ed0f2bd4793384a33bf49ea0d.tar.bz2 |
cmTarget: Add a way to represent imported shared library stubs
Shared library stubs can be used for linking, but not at runtime.
Their role is similar to import libraries on Windows, so represent
their location with the `IMPORTED_IMPLIB` target property.
Fixes: #24940
Diffstat (limited to 'Tests/RunCMake/target_link_libraries-ALIAS')
-rw-r--r-- | Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake b/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake index 4a0f068..65c708c 100644 --- a/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake +++ b/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake @@ -14,8 +14,14 @@ set_property(TARGET import-local PROPERTY IMPORTED_LOCATION "${binary_dir}/${CMA set_property(TARGET import-local PROPERTY IMPORTED_IMPLIB "${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}func${CMAKE_IMPORT_LIBRARY_SUFFIX}") add_library(alias::local ALIAS import-local) +if(NOT DEFINED CMAKE_IMPORT_LIBRARY_SUFFIX) + add_library(import-local-stub SHARED IMPORTED) + set_property(TARGET import-local-stub PROPERTY IMPORTED_IMPLIB "${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}func${CMAKE_SHARED_LIBRARY_SUFFIX}") + add_library(alias::local-stub ALIAS import-local-stub) +endif() + add_library (lib-local SHARED lib.c) -target_link_libraries (lib-local PRIVATE alias::local) +target_link_libraries (lib-local PRIVATE alias::local $<TARGET_NAME_IF_EXISTS:alias::local-stub>) add_executable (main-local main.c) target_link_libraries (main-local PRIVATE alias::local) |