-
How to check the VCPKG_LIBRARY_LINKAGE of the port in project cmake file? Many ports provide different packages depending on whether they are dynamically or statically linked, which results in triplet-related project cmake files. This obviously doesn't make sense. So I want to be able to determine the linkage of the port in the project cmake file to import different packages. how can I do that? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Generally not possible. As a consumer, you search for packages, not static or dynamic libraries. What's your specific use case? |
Beta Was this translation helpful? Give feedback.
-
Cf. zstd: target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>) |
Beta Was this translation helpful? Give feedback.
You can check if a target exists and link it accordingly:
$<TARGET_NAME_IF_EXISTS:tgt>
or andif(TARGET <targetname>)