What are the cmake commands you're running?
Back when I got it to compile on FreeBSD (didn't actually do any runtime testing) I had to override CC and CXX like
Code:
CC=/path/to/gcc-whatever.version CXX=/path/to/g++-whatever.version cmake -G "Unix Makefiles" -i ..
the '..' because I was building in a subfolder.