build with cmake.
include origin in exceptions and be more specific about the cause