summaryrefslogtreecommitdiff
path: root/cmake/CVC4Config.cmake.in
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2020-06-09 05:44:24 -0700
committerGitHub <noreply@github.com>2020-06-09 07:44:24 -0500
commitc1f8d64f3bc73fe27527046c521c2327e8e310d8 (patch)
treed308f508366a68b00eec06729a2d90a1c977b482 /cmake/CVC4Config.cmake.in
parent61734b41b7b96e7e7cbf46021a357d840d64b42e (diff)
Language bindings: Enable catching of exceptions (#2813)
Fixes #2810. SWIG relies on throw specifiers to determine which exceptions a method can throw. The wrappers generated by SWIG catch those C++ exceptions and turn them into exceptions for the target language. However, we have removed throw specifiers because they have been deprecated in C++11, so SWIG did not know about any of our exceptions. This commit fixes the issue using the %catches directive, declaring that all methods may throw a CVC4::Exception or a general exception. Note: This means that users of the language bindings will just receive a general CVC4::Exception instead of more specific exceptions like TypeExceptions. Given that we are planning to have a single exception type for the new CVC4 API, this seemed like a natural choice. Additionally, the commit (significantly) simplifies the mapping of C++ to Java exceptions and fixes an issue with Python exceptions not inheriting from BaseException. Finally, the commit adds API examples for Java and Python, which demonstrate catching exceptions, and adds Python examples as tests in our build system.
Diffstat (limited to 'cmake/CVC4Config.cmake.in')
-rw-r--r--cmake/CVC4Config.cmake.in1
1 files changed, 1 insertions, 0 deletions
diff --git a/cmake/CVC4Config.cmake.in b/cmake/CVC4Config.cmake.in
index 0047cc0ec..76535762d 100644
--- a/cmake/CVC4Config.cmake.in
+++ b/cmake/CVC4Config.cmake.in
@@ -1,6 +1,7 @@
@PACKAGE_INIT@
set(CVC4_BINDINGS_JAVA @BUILD_SWIG_BINDINGS_JAVA@)
+set(CVC4_BINDINGS_PYTHON @BUILD_SWIG_BINDINGS_PYTHON@)
if(NOT TARGET CVC4::cvc4)
include(${CMAKE_CURRENT_LIST_DIR}/CVC4Targets.cmake)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback