Small build system fixes
This MR contains the first two commits from !86 (closed) since the third one seems to be more problematic / needs to be redone in a more readable way.
This MR contains the first two commits from !86 (closed) since the third one seems to be more problematic / needs to be redone in a more readable way.