[CMake] add_library and target_link_libraries in differentdirectories?

Alexandre Feblot Alexandre.Feblot at thomsonreuters.com
Mon Jan 12 09:29:59 EST 2009


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: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf
Of Andreas Pakulat
Sent: Monday, 12 January 2009 14:32
To: cmake at cmake.org
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

CMake at cmake.org

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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090112/b0425b48/attachment-0001.htm>


More information about the CMake mailing list