Skip to content

How can I enforce the static build of a dependency in a manifest file? #23881

Answered by Osyotr
McKillroy asked this question in Q&A
Discussion options

You must be logged in to vote

It's not possible to set linkage in manifest file. You should pass VCPKG_TARGET_TRIPLET to cmake (for example, via CMakePresets.json).
If you want only certain libraries to be static, you should create an overlay-triplet and make a condition on packages you want to be static.
x64-windows-mixed.cmake:

set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)

if("${PORT}" STREQUAL "portnameiwanttobestatic")
    set(VCPKG_LIBRARY_LINKAGE static)
endif()

See
https://github.com/microsoft/vcpkg/blob/master/docs/users/triplets.md#per-port-customization
https://github.com/microsoft/vcpkg/blob/master/docs/examples/overlay-triplets-linux-dynamic.md

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@McKillroy
Comment options

Answer selected by McKillroy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants