My computer doesn't have g2o from source installed right now as I am doing some other testing... For gtsam, I have one installed here:
$ ls /usr/local/include/gtsam/
3rdparty base config.h discrete dllexport.h geometry global_includes.h inference linear navigation nonlinear sam slam symbolic
For g2o, I have the one installed with ROS (replace kinetic by indigo for ros indigo):
$ sudo apt-get install ros-kinetic-libg2o
$ ls /opt/ros/kinetic/include/g2o
apps config.h core examples solvers stuff types
In both cases above, cmake should detect them when building rtabmap.
cheers,
Mathieu