[Cmake] Basic questions

Bernhard Glück bernhard at realspace.org
Thu, 25 Mar 2004 20:26:21 +0100


On Thu, 25 Mar 2004 14:12:50 -0500, William A. Hoffman 
<billlist at nycap.rr.com> wrote:

> I guess I don't understand what you are trying to do.
> SOURCE_GROUP can take a group of files either by matching
> a regex or by explicit list of files and put them in a VC folder.
> How is that different than what you want?


The problem is not how to use the source group command.
Its how to make it work with a full source tree.

I will elaborate more ( using actual directories from our project and 
files )

We have a source tree as follows:

Source --
        Core --
             Math --

             Platform --
               Application.cpp
               Window.cpp

                      Win32 --
                        Utility.cpp

             Resource --
               Manager.cpp
               Handle.cpp



Now i want to build the whole Core tree into one Library... my aproach was 
as follows:
( CMakeLists.txt in the Core directory )

AUX_SOURCE_DIRECTORY( Platform FR_CORE_PLATFORM_SOURCES )
AUX_SOURCE_DIRECTORY( Resource FR_CORE_RESOURCE_SOURCES )
SET( FR_CORE_SOURCES ${FR_CORE_PLATFORM_SOURCES} 
$(FR_CORE_RESOURCE_SOURCES} )
ADD_LIBRARY( Fr.Core SHARED FR_CORE_SOURCES )
SUBDIRS( Platform Resource )

And in CmakeLists.txt in Platform:
SOURCE_GROUP( Platform FILES Application.cpp Window.cpp )

( as well as in Resource)
SOURCE_GROUP( Resource FILES Manager.cpp Handle.cpp )


This correctly ( note that any typos or command errors are from writing it 
down again, it works )
buils the Fr.Core Shared Libary project, but puts all source files in a 
root folder "Source Files" .....

And it concerns me since our project will comprise many more files ( we 
estimate a size of about 500.000 lines )
so having all those AUX_SOURCE_DIRECTORY commands... seems akward.. is 
there a way to create on top level project and recursivly add all source 
file in the directory structure below to it ? I tried using variables but 
they seem not to be propagated bakc in up in recursion...

How would any of you setup such a project that its easy to extend lateron 
? ANd provides those features ?