[CMake] Automatic Building of dependencies
Thomas.Voss at rub.de
Thomas.Voss at rub.de
Thu May 4 13:01:34 EDT 2006
On Thu, May 04, 2006 at 11:28:32AM -0400, William A. Hoffman wrote:
> At 09:49 AM 5/4/2006, Thomas.Voss at rub.de wrote:
> >Hi,
> >
> >I've just started using cmake for building my projects and encountered the following
> >problem:
> >
> >Assume the following dir structure:
> >
> >Toplevel
> > |
> > ----Application 1
> > |
> > ----cmake
> > |
> > ----CMakeLists.txt
> > |
> > ----Library 1
> > |
> > ----cmake
> > |
> > ----CMakeLists.txt
> > |
> > ----Library 2
> > |
> > ----cmake
> > |
> > ----CMakeLists.txt
> >
> >The libraries depend on qt and include header-files that need to be processed by moc.
> >
> >How Do I tell cmake in the CMakeLists.txt of "Application 1" that it should build the
> >libraries according to the CMakeLists.txt found in the library-specific cmake subdirs?
> >
> >ADD_SUBDIRECTORY() doesn't work as the moc_* files aren't generated.
>
> Something like this should work:
> ADD_SUBDIRECTORY(Library1)
> ADD_SUBDIRECTORY(Library2)
> ADD_SUBDIRECTORY(Application1)
>
> The CMakeLists.txt file in Application1 should be something like this:
> ADD_EXECUTABLE(Application1 ....)
> # tell the application to link to the libraries
> # this will cause the libraries to be built before the application
> # and the moc files should be generated as by-product of that build
> TARGET_LINK_LIBRARIES(Application1 Library1 Library2)
Haven't tried yet but a general concern: To my mind it would be more "generic" to
specify it in 'Application 1' CMakeLists.txt. Is there a reason why it doesn't work that
way?
Thanks anyway:)
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
Url : http://public.kitware.com/pipermail/cmake/attachments/20060504/72a3206b/attachment.pgp
More information about the CMake
mailing list