Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake Project use local g++ version

Tags:

macos

g++

cmake

I'm using MacOS X Lion with XCode 4.2.1. and I need gcc 2.4.6. to compile a CMake project. Therefor I build gcc 2.4.6. on my own in a local directory $HOME/mygcc/bin. Is there a way to influece the path to the compiler CMake uses?

like image 949
Joachim Avatar asked Dec 31 '25 18:12

Joachim


1 Answers

You can either use the GUI to set these variables:

CMAKE_C_COMPILER=$HOME/mygcc/bingcc
CMAKE_CXX_COMPILER=$HOME/mygcc/bing++

Or you can run cmake from the commandline:

cmake ../path/to/source -DCMAKE_C_COMPILER=$HOME/mygcc/bin/gcc -DCMAKE_CXX_COMPILER=$HOME/mygcc/bin/g++
like image 134
rubenvb Avatar answered Jan 02 '26 06:01

rubenvb