CMake Project use local g++ version

cmake, g++, macos

Solution

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++

Problem

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?

Original source