[CMake] add_subdiretory() help

Ramazan Girgin ramazangirgin at gmail.com
Mon Dec 3 05:59:39 EST 2007


I didn't understant your solution. Ex: Modul A built library liba
Modul B built library b and Modul C builds libc and depends liba and libb,
if i do this ;
target_link_libraries(libc liba libb)

if libb doesn't exist , libb will be built before libc??? I know cmake
doesn't do this .must I do another thing?

On 12/3/07, Andreas Pakulat <apaku at gmx.de> wrote:
>
> On 03.12.07 11:12:33, Ramazan Girgin wrote:
> > Hi all,
> > I want to use function like add_subdirectory for build order. I have 3
> > modul. Modul_A and Modul_B must be built before building Module_C .But
> > Modul_A,Modul_B and Modul_C are at the same level.When i used
> > ADD_SUBDIRECTORY(../Modul_A) and ADD_SUBDIRECTORY(../Modul_B) in
>
> The CMakeLists.txt with the add_subdirectory commands should sit at the
> same level as the 3 module directories.
>
> > CMakelists.txt file in Modul_C cmake gives error. Error is Modul_A and
> > Modul_B is not subdirectory of Modul_C. Every modul is have
> > CMakeLists.txtfiles and build different
> > libraries.This is library dependency for me.
>
> So some of the libraries in module C depend on libraries in module A or
> B? If so, you should express that in the target_link_libraries command
> by naming the targets of the libraries that the libs in C link to, i.e.:
>
> add_library(modC_foo)
> target_link_libraries(modC_foo modA_bar modB_baz)
>
> Then CMake will figure out the right order of building the libraries in
> modules A and B for you.
>
> Andreas
>
> --
> Try to get all of your posthumous medals in advance.
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20071203/c911a16c/attachment.html


More information about the CMake mailing list