Merge upstream cmake changes