There are simple methods to access the libraries on which yake is currently operating.
For OGRE:
Ogre::Root& root = Ogre::Root::getSingleton();
Remember to include the Ogre headers into your project and link it against the Ogre libraries.