cmake: update GCC like compiler detection code

We also use G++.