Make VALIJSON_USE_EXCEPTIONS interface definition

This commit is contained in:
Jon Petrissans 2022-01-30 20:00:31 +01:00
parent c5dac2bc0b
commit 50010fd959
2 changed files with 5 additions and 0 deletions

View File

@ -34,6 +34,10 @@ target_include_directories(valijson INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
if(valijson_USE_EXCEPTIONS)
target_compile_definitions(valijson INTERFACE -DVALIJSON_USE_EXCEPTIONS=1)
endif()
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(TARGETS valijson

View File

@ -65,6 +65,7 @@ Note that Valijson's `SchemaParser` and `Validator` classes expect you to pass i
### Exceptions
By default, Valijson classes will not throw exceptions (e.g. when failing to parse a schema). To enable exceptions for these cases, `VALIJSON_USE_EXCEPTIONS` must be defined.
However note that `VALIJSON_USE_EXCEPTIONS` is defined as interface compile definition of the cmake target, and the definition populates all the targets linking Valijson with cmake.
### Strong vs Weak Types