cmake: Improve checks for compiler flags