为什么Cmake总是选择GCC? [英] Why does Cmake Always Choose GCC?
本文介绍了为什么Cmake总是选择GCC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于我无法完全理解的原因,Cmake在编译软件时选择GNU编译器工具集。
For reasons that I cannot completely understand, Cmake awlays chooses the GNU compiler toolset when compiling software.
我的环境如下所示:
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
但是当我使用cmake我得到这个
but when I use cmake I get this
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
它使用g ++命令构建所有软件。为什么会这样?如何设置编译器?
And it builds all the software with g++ commands. Why is this going on? How does one set the compiler?
推荐答案
我不知道为什么CMake有利于GCC。
I'm not sure why CMake favours GCC.
但是,要设置编译器,请使用:
However, to set the compilers, use:
cmake <path to CMakeLists.txt> -DCMAKE_C_COMPILER=/opt/cray/xt-asyncpe/4.9/bin/cc -DCMAKE_CXX_COMPILER=/opt/cray/xt-asyncpe/4.9/bin/CC
这些值将被缓存,因此CMake的后续运行(如果需要)可以简单地被调用:
These values will be cached, so subsequent runs of CMake (if required) can simply be invoked by:
cmake .
这篇关于为什么Cmake总是选择GCC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文