cmake: support using a separate build directory