Really, the target_link_libraries command for a given lib or exe belongs in
the same CMakeLists.txt file that you call add_library or add_executable
from. What is your reason for wanting to put the list of dependencies
somewhere else?


On Mon, Jan 12, 2009 at 9:29 AM, Alexandre Feblot <
[email protected]> wrote:

>  Hi Andreas,
>
>
>
> In fact, this is already what I did:
>
>
>
> Here is a synopsis of my CMakeLists files:
>
>
>
> ROOT CMakeLists.txt:
>
> -        define some general stuff, options, macros.
>
> -        call add_subdirectory() for all subdirectories
>
> -        *trying* to set link dependencies with target_link_libraries()
>
>
>
> subdir CMakeLists.txt:
>
>       - defining libs with add_library()
>
>
>
> Or don't I understand what you mean by " before linking the libs "?
>
>
>
>
>
> Alexandre
>
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf
> Of Andreas Pakulat
> Sent: Monday, 12 January 2009 14:32
> To: [email protected]
> Subject: Re: [CMake] add_library and target_link_libraries in
> differentdirectories?
>
>
>
> On 12.01.09 11:27:28, Alexandre Feblot wrote:
>
> > Hi,
>
> >
>
> >
>
> >
>
> > I have not been able to define a library dependency in a directory
>
> > different from the one in which the library target is created.
>
> >
>
> > Is this done by design, or is there any way to do it?
>
> >
>
> >
>
> >
>
> > My goal would be to have
>
> >
>
> > -          each library in it's own directory (and a CMakeLists.txt file
>
> > with a add_library command)
>
> >
>
> > -          all dependencies stored in a single file at the root level
>
> >
>
>
>
> Then you need to call add_subdirectory() for the library subdirs before
>
> linking the libs. You can't link a target that you havent' defined yet.
>
>
>
> Andreas
>
>
>
> --
>
> Chicken Little was right.
>
> _______________________________________________
>
> CMake mailing list
>
> [email protected]
>
> http://www.cmake.org/mailman/listinfo/cmake
>
>
>
> This email was sent to you by Thomson Reuters, the global news and
> information company.
> Any views expressed in this message are those of the individual sender,
> except where the sender specifically states them to be the views of Thomson
> Reuters.
>
> _______________________________________________
> CMake mailing list
> [email protected]
> http://www.cmake.org/mailman/listinfo/cmake
>
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to