Out of source builds possible?

Is it possible to run Hugo builds out of source?

Of course there are config options such as publishDir or staticDir but it is not as easy as setting these. I have e.g. files in static which are part of the source (e.g. JavaScript libraries) but others get generated as part of the build (such as custom JavaScript code build by webpack).

I would like to use Hugo as part of a C++ project, therefore the separation between source and build directories. Has anybody of you tried Hugo out-of-source-builds with success?