You've got the right idea, however the command line you want is:
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 the -D
and the variable being set, which is why CMake is interpreting your variable assignment as a directory. Also CMake uses CXX
for C++ specific variables, which keeps it consistent with Make.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…