[CMake] Fwd: Targets organisation of complex project

Pau Garcia i Quiles pgquiles at elpauer.org
Sun Oct 11 22:57:54 EDT 2009


> I've grappled with the same problem recently when rewriting the build system
> for the aqsis renderer project.  I certainly don't know what's *best*, but I
> did find a solution which somewhat satisfied me.  Let's suppose we have two
> individual subdirectories, libA and libB, and we want to combine them
> together.
>
> Here's how I have laid that kind of thing out in aqsis:
>
> src/
>    CMakeLists.txt
>    libA/
>        project.cmake
>        ... lots of source
>    libB/
>        project.cmake
>        ... lots of source
>
> The idea is to define a file (arbitrarily named "project.cmake" in my system)
> in the individual library directories which defines variables corresponding to
> the library source.  The main CMakeLists.txt then include()s these files,
> makes a source list from all the individual sources, and uses those in an
> add_library command to create the final library.  I wrote some macros to
> automate the inclusion process a little better so that the project.cmake files
> were a bit like what you'd normally write in a CMakeLists.txt.
>
> The system has some remaining shortcomings - in particular the project.cmake
> files still look more different from a plain CMakeLists.txt than I'd like -
> but perhaps it can give you some ideas.  You can browse the aqsis source tree
> online at

What are the advantages of this? Why don't you rename you
"project.cmake" files to "CMakeLists.txt" and use add_subdirectory on
those directories? I see no difference :-?

-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)


More information about the CMake mailing list