[Cmake] Simple building question:

Bernhard Glück bernhard at realspace.org
Thu, 25 Mar 2004 22:23:19 +0100


On Thu, 25 Mar 2004 15:56:16 -0500, Brad King <brad.king at kitware.com> 
wrote:

Thanks for your help, i just naturally assumed that CMake would allow me 
to do this recursivly too :-) No biggie there.

Second part of my question
If i go with the proposed approach how would you create a VC Project 
Folder for each subdirectory ?



> Bernhard Glück wrote:
>
>> In response to my previous post ( which seemed to complicated ) i will 
>> formulate my questions in easier parts.
>>
>> How do you people go on building a whole directory tree into one 
>> library/executable ?
>> Suppose you have a root dir with many sub directories and sub sub 
>> directories full of source files and want to build them all into one
>> library.. How do you organize that ?
>
> Create a CMakeLists.txt file in the root of the directory containing all 
> the sources.  Use a command like this to create the library:
>
> ADD_LIBRARY(mylib
>    src1.cxx
>    src2.cxx
>    DirA/src3.cxx
>    DirB/src4.cxx
>    # ...
> )
>
> While listing all the source files explicitly may seem tedious the first 
> time, it is not very hard to maintain.  Also, unless the CMakeLists.txt 
> file changes when a new source file is added, there is no way that the 
> native build system can know that CMake needs to be rerun to add the 
> source to the build.  Therefore a command like AUX_SOURCE_DIRECTORY 
> should not be used in this case.
>
> -Brad
>
> _______________________________________________
> Cmake mailing list
> Cmake at www.cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/