diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ac535d..38f614a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,10 @@ target_include_directories(valijson INTERFACE $ $) +if(valijson_USE_EXCEPTIONS) + target_compile_definitions(valijson INTERFACE -DVALIJSON_USE_EXCEPTIONS=1) +endif() + install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(TARGETS valijson diff --git a/README.md b/README.md index 49b23a8..a2b3eb7 100644 --- a/README.md +++ b/README.md @@ -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