Synchronise build system with opm-core

Bring in recent build system improvements from opm-core.