CMake does some introspection and selects an appropriate compiler on it's own. After project is first generated, environment variables do not affect the selected compiler.
To force the specific comiler you can either pass -D CMAKE_*_COMPILER as CMake options, or clean generated CMake folder (Help | Show Generated CMake Files...) and press Reload Project on CMake tool window - it should pick up CC, CXX variables.
Oleg, to access environment variables in CMake, you need to use $ENV{NAME} syntax. Here are some details.
Ok, but why CMAKE_C_COMPILER not set to clang?
CMake does some introspection and selects an appropriate compiler on it's own.
After project is first generated, environment variables do not affect the selected compiler.
To force the specific comiler you can either pass -D CMAKE_*_COMPILER as CMake options, or clean generated CMake folder (Help | Show Generated CMake Files...) and press Reload Project on CMake tool window - it should pick up CC, CXX variables.
Thx, Anton!