[CMake] Building a library with a complex hierarchy

Tilo Wiklund noteventime at gmail.com
Mon Jul 24 21:00:58 EDT 2006


Hello,
I'm going to begin with the usual "I'm not sure this is the right
place to post this, but hopefully it is", so with that done I can get
on to my real question.
I'm trying to build a game engine, or rather what is currently there,
I'm currently developing.
The output of the build is supposed to be a library, a shared one is
preferable, and a few functional tests I will worry about later.
The problem is that I'm not quite sure on how to structure the build,
as the directory hierarchy is a little more complex than I'm used to.
The directories of the project root (just to show what my situation is):
core i18n math subsystem util
With core/ being the most interesting part at the moment.
core:
eventsystem log time worldobject kernel memorymanager datamanager
script threadmanager
My first thought was to compile all the different parts into their own
libraries and then link them all into a common shared one. This,
apperently, wasn't possible and maybe not a very clever way to do it.
Simply having a ADD_LIBRARY with all the source files would look very
ugly, and be error prone. Another way to do it could be by defining
lots of varibles, but that doesn't sound very good to me either.
So if anyone could give me a hint on how to do this, or a good
documentation on writing builds for these kind of more complicated
projects (doesn't have to be cmake), it'd be very happy.


More information about the CMake mailing list