I propose to introduce a concept of a feature -- this is something that is set in the triplet definition and is supposed to be used in every port being installed using that triplet.
It would be nice to have following features:
VCPKG_LIBRARY_LTO -- this feature turns on link-time-optimization for all ports (CMAKE_INTERPROCEDURAL_OPTIMIZATION if port is using CMake)
VCPKG_LIBRARY_SYM_GC -- this is equivalent to -ffunction-sections -fdata-sections -Wl,--gc-sections used with gcc
VCPKG_LIBRARY_PIC -- to generate position-independent code (to be used if VCPKG_LIBRARY_LINKAGE is static)
Notes:
feature can be declared mandatory or optional; if mandatory and port doesn't support it -- related port installation will fail. I suspect optional will be default and mandatory will be used by people who need to be absolutely sure that feature is used by every port (being used), even if port definition got updated
feature can be boolean (on/off) or more flexible (e.g. string with context-depending meaning)
vcpkg list should (be able to) list features given port was installed with, e.g.:
I imagine, each port will have to query features it is aware of and explicitly acknowledge them in run-time (if it can support in in given environment/configuration). Some features (e.g. CMake-specific ones) can be auto-acknowledged by vcpkg machinery (inside of all these vcpkg_* function most ports are using)
naturally, given feature may be not applicable in some contexts (header-only library, or smth static-lib specific when VCPKG_LIBRARY_LINKAGE is set to dynamic)
I propose to introduce a concept of a feature -- this is something that is set in the triplet definition and is supposed to be used in every port being installed using that triplet.
It would be nice to have following features:
VCPKG_LIBRARY_LTO
-- this feature turns on link-time-optimization for all ports (CMAKE_INTERPROCEDURAL_OPTIMIZATION
if port is using CMake)VCPKG_LIBRARY_SYM_GC
-- this is equivalent to-ffunction-sections -fdata-sections -Wl,--gc-sections
used withgcc
VCPKG_LIBRARY_PIC
-- to generate position-independent code (to be used ifVCPKG_LIBRARY_LINKAGE
isstatic
)Notes:
optional
will be default andmandatory
will be used by people who need to be absolutely sure that feature is used by every port (being used), even if port definition got updatedvcpkg list
should (be able to) list features given port was installed with, e.g.:vcpkg_*
function most ports are using)VCPKG_LIBRARY_LINKAGE
is set todynamic
)