[osg-users] [build] cmake build questions

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Mon Apr 11 07:07:36 PDT 2011

Hi Gianni,

> 1) I would like the generated lib files to be put in a specific directory.

Set CMAKE_INSTALL_PREFIX to the directory where you want things to be 
put after the build, and then build the INSTALL target.

BTW, I personally prefer having CMake generate Visual Studio project 
files (which you can use anytime you need them), and then using devenv 
/build ... to automate building in a build system. See this page for 
some examples of this command:


I just find using a single set of build files both when I need to look 
at OSG source and when automating the build makes it easier for me.

> 2) I would need to use 3rd party libs such zlib, libjpeg, libpng and freetype to build some plug-ins. What should I add in cmake command line?

If you really want to run CMake from the command line, you can use the 
CMake GUI to find out what the options are for each 3rdparty lib you 
need to use (be sure to enable Advanced view to see all the settings, 
they'll generally have the form <libname>_INCLUDE_DIR, 
<libname>_LIBRARY, <libname>_LIBRARY_DEBUG). Then add these options to 
your CMake command line (-D<libname>_INCLUDE_DIR=C:\...)

Or if you use a 3rd party package you might just need to set 
ACTUAL_3RDPARTY_DIR to the root of the 3rdparty directory.

Hope this helps,

Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com

More information about the osg-users mailing list