Synchronise build system with opm-core

Bring in recent build system fix from opm-core.