2

I'm linking some libraries with the triplet windows-static:

I'm trying to exclude a specific library (openssl) from being linked static, while keeping all others static.

While searching around I found this answer:

If you want to locally override the default linkage for a particular port, you would put the override into a custom (overlay) triplet file.

But i couldn't figure out how to do it.

Also, this answer, but the links in the Microsoft GitHub throw 404 - page not found.

wohlstad
  • 12,661
  • 10
  • 26
  • 39
Steel
  • 29
  • 2

1 Answers1

0

There is tutorial for Linux. I tested it but did not work on Windows.

But, the sample I posted in the comment also works for Visual Studio.

You could modify the x64-windows-static.cmake file in folder(vcpkg-master\triplets).

Then remove openssl package and install vcpkg.exe install openssl --triplet x64-windows-static

It will link openssl dll dynamically with x64-windows-static option.

cmake file Eg.

set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE static)

if(${PORT} MATCHES "openssl")
    
    set(VCPKG_LIBRARY_LINKAGE dynamic)
else()
    
    set(VCPKG_LIBRARY_LINKAGE static)
endif()
Minxin Yu - MSFT
  • 2,234
  • 1
  • 3
  • 14