Synchronise build system with opm-core

Bring in recent changes and build-system improvements from opm-core.