[osg-users] basic compiling with cmake

Jean-Sébastien Guay jean-sebastien.guay at polymtl.ca
Fri Oct 26 10:26:17 PDT 2007

Hello Nathan,

> Can someone post a simple CMakeFile.txt
> for just compiling one .cpp outside the OSG 2 src
> tree?

Probably not that simple, but here's what I use for my project (see attached).

I've only used CMake for one of my projects, the only one I have right  
now that I need to be able to compile and run on both Windows and  
Linux. It's currently the only "big" project I'm working on. The rest  
are little testers for which I'll just make a VS solution manually.

So anyways, this is based on the OSG CMake files. I have included a  
CMakeLists.txt, src/CMakeLists.txt, and CMakeModules/ directory with  
modules to find OSG and OpenThreads.

In CMakeLists.txt and src/CMakeLists.txt, search for TODO and you'll  
see what you need to change or add for your project. It's not very  
general, so you might need to customize it for your project. My  
project simply has a src/ directory where all sources are located...

> Or are we supposed to add our own apps at
> OpenSceneGraph*/applications and
> hack the supplied CMakefiles?

I would definitely *not* do that. I prefer to keep my OSG source tree  
clean. If you have things set up correctly, the included  
FindOpenSceneGraph.cmake and FindOpenThreads.cmake should find things  
and set the include and link paths correctly, so you don't need to  
deal with the whole of OSG's source tree for your own projects.

Hope this helps.

Jean-Sebastien Guay     jean-sebastien.guay at polymtl.ca

This message was sent using IMP, the Internet Messaging Program.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMake OSG example.zip
Type: application/x-zip-compressed
Size: 6957 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071026/1e989f29/attachment-0003.bin>

More information about the osg-users mailing list