Dealing with The compiler /usr/bin/c++ has no C++11 support for CentOS 6

If you compiling using cmake and you make encounter error like this. This is despite the fact that you use the latest compiler like GNU-5.2.0. But somehow the cmake is still looking at the older gnu that comes with CentOS 6

[user1@node1 build]$ cmake ..
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:24 (message):
The compiler /usr/bin/c++ has no C++11 support. Aborting.

To resolve this, you have to be more explicit in the cmake parameter point to the corrcet g++, gcc

[user1@node1 build]$ cmake .. -DCMAKE_CXX_COMPILER=/usr/local/gcc-5.2.0/bin/g++ -DCMAKE_C_COMPILER=/usr/local/gcc-5.2.0/bin/gcc