Fix compatibility for old cmake before CMP0042