v
v copied to clipboard
json: support system cJSON library through pkgconfig
We have to either wait for the next cJSON release or add a symbol check before merging: DaveGamble/cJSON#697
It should not be the first choice/the default. The system provided cJSON library may be much older than what V expects.
You can use $if system_cjson ? {
to surround the check, if you do want to support it as an option (i.e. the user will have to then compile with -d system_cjson
passed to V).
https://github.com/vlang/v/blob/fcde63127fdf7588cb54360ee25f4be96cbd5e2b/thirdparty/cJSON/cJSON.h#L81-L84
The latest version is currently 1.7.15, but cJSON_GetErrorPos()
is missing because not upstreamed yet.
I agree that adding an option is probably the best solution right now.
We prefer static linking for binaries generated by V. Especially for something that's part of the language.
Understandable, the upstream pull request is not merged yet anyway.