Closed playgithub closed 3 years ago
@playgithub, for dynamic lib, it will deduce a triplet for your project. if you use it with cmake, you can pass the triplet with 'VCPKG_TARGET_TRIPLET'. For static lib, it depends on how you use the pkg: With cmake: You can set VCPKG_TARGET_TRIPLET on the configure line. With msbuild: you can specify the MSBuild property VcpkgTriplet in your .vcxproj.
See https://github.com/microsoft/vcpkg/blob/master/docs/users/integration.md#triplet-selection for details.
@playgithub, for dynamic lib, it will deduce a triplet for your project. if you use it with cmake, you can pass the triplet with 'VCPKG_TARGET_TRIPLET'. For static lib, it depends on how you use the pkg: With cmake: You can set VCPKG_TARGET_TRIPLET on the configure line. With msbuild: you can specify the MSBuild property VcpkgTriplet in your .vcxproj.
See https://github.com/microsoft/vcpkg/blob/master/docs/users/integration.md#triplet-selection for details.
As far as I know, triplets are used for building the libs. My question is, if a lib got both shared and static versions installed, how to determine which one to use?
My question is, if a lib got both shared and static versions installed, how to determine which one to use?
In the context of vcpkg, if a lib from a vcpkg port has both shared and static versions installed, it is a bug in that port: The linkage is defined by the triplet, either "dynamic" or "static". (Triplet files may even define per-port exceptions.)
In the context of vcpkg, if a lib from a vcpkg port has both shared and static versions installed, it is a bug in that port: The linkage is defined by the triplet, either "dynamic" or "static". (Triplet files may even define per-port exceptions.)
Does it mean I can't use dynamic libs and static libs in vcpkg together? This might be inconvenient in some cases, e.g. I prefer dynamic link, but some libs (e.g. wxcharts) doesn't support dynamic link on Windows natively.
Does it mean I can't use dynamic libs and static libs in vcpkg together?
Dynamic and static libs can be used together if necessary: "Within a triplet, libraries are generally built with the same configuration, but it is not a requirement." (https://vcpkg.io/en/docs/users/triplets.html)
If a lib can't be build in one way, then linkage can be overwritten in the lib's portfile. The portfile may issue a hint when building the port
If you want to locally override the default linkage for a particular port, you would put the override into a custom (overlay) triplet file.
Dynamic and static libs can be used together if necessary: "Within a triplet, libraries are generally built with the same configuration, but it is not a requirement." (https://vcpkg.io/en/docs/users/triplets.html)
If a lib can't be build in one way, then linkage can be overwritten in the lib's portfile. The portfile may issue a hint when building the port
If you want to locally override the default linkage for a particular port, you would put the override into a custom (overlay) triplet file.
Understand, I have to learn the details. Thanks
When using the lib, only header files are included, how does vcpkg know to use the static lib or the dynamic lib?