Fix copying libraries when static building