Sunday, 15 September 2013

c++ - How can I make CMake use GCC instead of Clang on Mac OS X? -



c++ - How can I make CMake use GCC instead of Clang on Mac OS X? -

i can't find info on it, other way around (e.g., how set cmake utilize clang).

i've installed gcc-4.8 using brew, setup dependencies, headers, etc, , cmake refuses utilize gcc.

i've set bash profile both aliases , actual entries:

export cc=/usr/bin/gcc export cxx=/usr/bin/g++ alias gcc='gcc-4.8' alias cc='gcc-4.8' alias g++='g++-4.8' alias c++='c++-4.8'

yet cmake stubbornly refuses utilize gcc , instead reverts clang:

air:build alex$ cmake -dcmake_build_type=debug .. -- c compiler identification clang 5.1.0 -- cxx compiler identification clang 5.1.0 -- check working c compiler: /usr/bin/gcc -- check working c compiler: /usr/bin/gcc -- works

cmake doesn't hear cc , cxx. instead utilize cmake_c_compiler , cmake_cxx_compiler:

cmake -dcmake_c_compiler=/usr/bin/gcc -dcmake_cxx_compiler=/usr/bin/g++ ...

see documentation.

alternatively, can provide toolchain file, might overkill in case.

c++ cmake

No comments:

Post a Comment