Synchronise build system with opm-core

This brings in recent build system improvements from opm-core.