CMake honors the CC and CXX environment variable so you can use whatever compiler you prefer by setting these variables. For instance, I use ccache for all my ROS compilation without any trouble.
export CC=/path/to/my/c/compiler
export CXX=/path/to/my/c++/compiler
rosmake
You can then double check which compiler has been used by running:
grep COMPILER CMakeCache.txt
...in any ROS build directory. CMAKE_CXX_COMPILER should be your custom C++ compiler.
Unless you recompile ROS from scratch, you will have to make sure that the ABI are compatible (i.e. that you can link a g++ library against an aspectc++ one).
Be aware that porting the code so that it is compatible with a new compiler is a lot of work. Do not do it unless you are already a C++ experienced programmer and ready to spend a couple of months on this.