Since CLion relies on CMake build system. To change the compiler used in CLion, use method #2 from the official CMake documentation.
Go to Preferences/Settings | Build, Execution, Deployment | CMake | CMake options and pass the following commands:
The corresponding CMake cache variables will be overwritten.
Also find more details and samples in our Quick CMake Tutorial.