Rework CFLAGS assignments

CMAKE_C_FLAGS is global and -O2 is intrusive.
On the other hand, build type specific CFLAGS can be easily
overwritten by distros setting their own build types, so move -O2
to CMAKE_C_FLAGS_{RELEASE,RELWITHDEBINFO}.