CMAKE_C_COMPILER etc should be set before project(), in which cmake tries to decide which compiler to use.