Cmake Error Installation Compiler

For some reason, CMake C and C ++ compilers are installed by default on /usr/bin/qcc . I followed this post and tried the command

cmake -D CMAKE_C_COMPILER = / usr / bin / gcc -D CMAKE_CXX_COMPILER = / usr / bin / g ++

but i get an error

CMake error: source directory [current directory] / CMAKE_CXX_COMPILER = / usr / bin / g ++ "does not exist.

Why does CMake interpret my commands as a directory, and what is the correct way to install CMake compilers?

+3
linux cmake
Apr 21 '13 at 5:17
source share
2 answers

You have the right idea, however on the command line you want:

 cmake -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ <path_to_source> 

The differences are subtle. There should be no space between -D and the variable, so CMake interprets your variable assignment as a directory. CMake also uses CXX for special C ++ variables, which saves it according to Make.

+7
Apr 21 '13 at 14:03
source share

This is CMAKE_CXX_COMPILER , not C++ .

+1
Apr 21 '13 at 5:53 on
source share



All Articles