CPack improvements and allow in-source build, from Frédéric Devernay.

Fixes #860.