Backport a few changes to enable exceptions in all files that use libexiv.
This is required after the recent exiv2 update to 0.27, as exiv requires a
build with exceptions enabled, and KDE disables exceptions by default.
This fixes the build with GCC (for some reason, clang doesn't complain that
code that uses exceptions is built with -fno-exceptions).
PR: 236849