Fix build on XCode and simplify tests where possible.

XCode places binary outputs in CMAKE_CFG_INTDIR, so we need to trace
that by writing out its value at build time and reading it later
in the verify stage.