Instead of having ad-hoc code for gcc, let CMake do its thing. It has a lot of
logic that we may be interested in, for example it will make the clang switch
much smoother.
Note it raises the minimum cmake to 3.7 for Android, which was released almost
2 years ago.