CMake build settings
The following cmake variables can be used to control the build behavior of ryml:
RYML_WITH_TAB_TOKENS=ON/OFF. Enable/disable support for tabs as valid container tokens after:and-. Defaults toOFF, because this may cost up to 10% in processing time.RYML_DEFAULT_CALLBACKS=ON/OFF. Enable/disable ryml’s default implementation of error and allocation callbacks. Defaults toON.RYML_DEFAULT_CALLBACK_USES_EXCEPTIONS=ON/OFF- Enable/disable the same-named macro, which will make the default error handlers provided by ryml throw exceptions. Defaults toOFF.RYML_USE_ASSERT=ON/OFF. Enable/disable assertions regardless ofof the
NDEBUGmacro. When set toOFF(the default), ryml asserts unlessNDEBUGis defined, making it so that assertions are enabled in Debug builds and disabled in Release builds (which usually haveNDEBUGdefined). WhenRYML_USE_ASSERTis set toON, assertions are enabled even ifNDEBUGis defined; with this, assertions will be enabled in all build types regardless ofNDEBUGdefinition status. Failed assertions will trigger a call to the error callback.
RYML_SHORT_CHECK_MSG- Use shorter error message from checks/asserts: do not show the check condition in the error message.RYML_STANDALONE=ON/OFF. Use ryml in standalone mode, where thecode from c4core is used as part of ryml (ie, as part of the ryml library). Defaults to
ON. See the next section for further details.
RYML_INSTALL=ON/OFF. enable/disable install target. Defaults toON.
If you’re developing ryml or just debugging problems with ryml itself, the following cmake variables can be helpful:
RYML_DEV=ON/OFF: a bool variable which enables development targets such as unit tests, benchmarks, etc. Defaults toOFF.RYML_DBG=ON/OFF: a bool variable which enables verbose prints from parsing code; can be useful to figure out parsing problems. Defaults toOFF.
Forcing ryml to use a different c4core version
ryml uses code from c4core, a C++ library with low-level multi-platform utilities. (c4core in turn uses code from fast_float and debugbreak). By default, the files from c4core that ryml uses are provided as part of ryml’s source distribution and installation.
More importantly, c4core is NOT a dependency of ryml. To use ryml, just link with ryml, and you’re done.
c4core was initially a submodule of this project, and maybe this prompted some users to see c4core as a hard dependency, despite this not being the intended usage in the general case. So it was decided to remove the submodule and provide the c4core files as part of the source code of ryml. This makes it necessary for users wishing to opt in to use a full c4core.
However, you may prefer to use a separate or installed version of
c4core, maybe even with a different version. This is opt-in behavior:
you need to set RYML_STANDALONE=OFF while invoking cmake. You can
find out how to achieve this by looking at the custom_c4core sample.