[CMake] Compiling OpenGL application with CMake

Philip Lowman philip at yhbt.com
Tue Feb 24 22:03:51 EST 2009


On Tue, Feb 24, 2009 at 8:48 PM, Andrea Tagliasacchi <ata2 at cs.sfu.ca> wrote:

> This is a bit odd to me. Why would not everything be required?
> Are there situations in which you might not need a package?
>
> Maybe I can answer my own question...
>
> If you have 2 libraries A and B that do the same task maybe you can
> use different compile rules like you showed below, while if A is the only
> one, then "REQUIRED" gives the trick.


It all depends on the needs of the software really and also how it's
designed.  Many software projects have no need for optional dependencies but
others would be extremely annoying to build without them because every
dependency would have to be available on every platform in order to compile
& link the project.

Since you appear to be doing 3D work, a good example of optional
dependencies in action could be the OpenSceneGraph's plugin architecture.
By creating well defined interfaces up front, they have made it so that the
project can be built with very few mandatory dependencies (OpenGL and GLUT
are the only two IIRC).  All of the 3rd party dependencies they've added
along the way have been made optional (libpng, libjpeg, libtiff,
libfreetype, libcurl, libgdal, etc.) through their plugin API.  If libpng
isn't available at build time (for whatever reason) the png plugin simply
isn't built.  It can always be built and dropped into the system later
through the magic of dynamic linking.

http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/src/osgPlugins


-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090224/230b738a/attachment.htm>


More information about the CMake mailing list