[CMake] How to differ?

Thomas Lehmann t.lehmann at rtsgroup.net
Fri Oct 29 10:59:12 EDT 2010


At the end you can see a version which was working well
but we found it somewhat complicated with the paths.

>
> 1) Write a single CMake-enabled project with which you may build all
>     or part of the project
>
> 2) Write several separate CMake-enabled project which are inter-
> dependant?
>
> I would personnally try 1) unless you have good reason not to do so.
> The projects/CMakeLists.txt would be the main project
> consisting in some
> add_subdirectory(libs/XXXX)
> add_subdirectory(apps//YYYY)

Yes. we do that.

> then for each lib there will be some
> projects/libs/XXXX/CMakeLists.txt consisting in
> add_library(XXXX <list of source>) command

Yes. we have this.

> and for each app there will be some
> projects/apps/YYYY/CMakeLists.txt which contains
> add_executable(YYYY <list of source>)
> target_link_library(YYYY XXXX)
> include_directories(${CMAKE_SOURCE_DIR}/libs/XXXX)

Yes. But how do that program generate the libraries
when they are not build yet?

>
> from this structure you should be able to build part or all of the
> target
> just by calling the appropriate one. CMake should take care of building
> the dependencies using the "target_link_library" links.
>

cmake can be used for different paths in a source tree.

Trying to create both apps both are trying to build both
libraries on different locations - cmake complains.

The command after here fails without handling to use
"link_directories" or "add_subdirectory" properly:

/tmp/obj> cmake /projects/apps

1) I can rebuild all
2) I can build a set of applications
3) I can build just one application

Independent on what scenario I use I want to ensure that
all dependencies are built and used.

Thomas


Thomas Lehmann
Scrum Master

RTS Realtime Systems Software GmbH, Rembrandtstrasse 13, D-60596 Frankfurt am Main
T: +49.69.61009.0 / F: +49.69.61009.181

Sitz: Frankfurt am Main - HRB 84467 Amtsgericht Frankfurt am Main
Gesch?ftsf?hrer: Steffen Gemuenden, Igor Sluga

www.rtsgroup.net

This email and any attachments are for the exclusive and confidential use of the intended recipient. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please do not read, distribute or take action in reliance upon this message. If you have received this in error, please notify me immediately by return email and promptly delete this message and its attachments from your computer system.


More information about the CMake mailing list