Why does Cmake always choose GCC?

For reasons that I cannot fully understand, Cmake awlays chooses the GNU compiler toolkit when compiling software.

My environment is as follows:

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 

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 

And he creates all the software using g ++ commands. Why is this happening? How to install the compiler?

+1
environment-variables cmake cray
Jun 01 '12 at 20:30
source share
2 answers

I'm not sure why CMake stands for GCC.

However, to install 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 

These values ​​will be cached, so subsequent CMake runs (if required) can simply be called:

 cmake . 
+1
Jun 01 2018-12-12T00:
source share

You can also install env vars CC and CXX in the same way as autotools.

CC = cc CXX = CC cmake ...

Make sure you start with an empty assembly tree.

+5
Jun 02 2018-12-12T00:
source share



All Articles