[nlohmann-json] Add port feature to control implicit conversions behaviour #22408
Labels
category:port-feature
The issue is with a library, which is requesting new capabilities that didn’t exist
Is your feature request related to a problem? Please describe.
The nlohmann json library is gradually backtracking on providing implicit conversions to their types via
operator T()
. They've added a CMake option (JSON_ImplicitConversions
) to control this behaviour. I think we should expose this option as a feature on the nlohmann-json port.For context, here are some relevant issues and PRs in the nlohmann json project:
Proposed solution
Add a new port version that exposes this option. The library currently defaults to enabling implicit conversions, but I wouldn't be surprised if they change the default in the future. I think we should ensure the default behaviour in vcpkg matches that of the library, so perhaps it's best to frame it as an inverted feature (e.g. "disable-implicit-conversions") and leave it out of the port's default features. When the library changes their default from
JSON_ImplicitConversions=ON
toJSON_ImplicitConversions=OFF
, we should adddisable-implicit-conversions
to the default features for the port.Describe alternatives you've considered
Alternatively, we could make a non-inverted feature (e.g.
implicit-conversions
orenable-implicit-conversions
), include it in the default features now, and then remove it from the default features when/if the library changes its defaults.The text was updated successfully, but these errors were encountered: