Refactor OpenMP support to be reusable

This is needed in opm-porsol; added here since this is the master project for the build files