[CMake] CMake Project Structure Out of Source Build

Flo devnoop at googlemail.com
Thu Mar 4 08:02:08 EST 2010


Hello,

For our Project, we need a structure where its possible to work/test/deploy
a single module and also build products which uses some modules.

f.e

MODULE 1
      /bin
      /scr
      /test-src
     CMakeLists.txt

MODULE 2
     /bin
     /src
     /test-src
    CMakeLists.txt

PRODUCT 1
     /bin
     /src
     /test-src
    CMakeLists.txt

PRODUCT 1 uses MODULE 1 and Module 2
MODULE 1 uses MODULE 2
MODULE 2 needs no other

in all CMakeLists-Files you can define per Macros Tests, Examples, Libs
etc... If some target is depending on some other, the CMakeLists File will
be called and the necessary target will be linked.

f.e. add_host_test( testModule1
                             DEPS MODULE2)

My Problem is, that PRODUCT 1 and MODULE 1 uses MODULE 2 and  both builds
the same executables libs etc. but its not possible(and necessary) to build
the same executable etc. twice.
every module should be build once per cmake execution.

I tried to use guards. But guards didn't work for me, because there aren't
valid in global scope.

A simmilar stucture is necessary, because we will build a platform solution
with a lot of Products in there.

Has anyone a solution for this problem? Or another project sturcture, that
is better for this type of project?

Thx
Flo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100304/96c1d322/attachment.htm>


More information about the CMake mailing list