为什么Cmake总是选择GCC?

Mik*_*ail 1 cmake environment-variables cray

由于我无法完全理解的原因,Cmake awlays在编译软件时选择了GNU编译器工具集.

我的环境看起来像这样:

which cc
/opt/cray/xt-asyncpe/4.9/bin/cc
which CC
/opt/cray/xt-asyncpe/4.9/bin/CC
echo $CC
/opt/cray/xt-asyncpe/4.9/bin/cc
echo $CXX
/opt/cray/xt-asyncpe/4.9/bin/CC
Run Code Online (Sandbox Code Playgroud)

但是当我使用cmake时,我得到了这个

Using existing /opt/cmake/2.8.4/bin/cmake
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
Run Code Online (Sandbox Code Playgroud)

它使用g ++命令构建所有软件.为什么会这样?如何设置编译器?

小智 5

你也可以设置env vars CC和CXX,就像autotools一样.

CC = cc CXX = CC cmake ...

确保从空构建树开始.