[CMake] add_library and target_link_libraries in different directories?

Alexandre Feblot Alexandre.Feblot at thomsonreuters.com
Mon Jan 12 05:27:28 EST 2009


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

 

root dependency file example:

    target_link_libraries(mylib1 mylib2 mylib4)

    target_link_libraries(mylib2 mylib2 mylib5)

    target_link_libraries(mylib3 mylib4 mylib5)

    . . . 

 

This fails with such a message:

 

CMake Error: Attempt to add link library "mylib2" to target "mylib1"
which is not built by this project.

CMake Error: Attempt to add link library "mylib4" to target "mylib1"
which is not built by this project.

 

Can I work around this?

 

Thanks



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/230b0d66/attachment.htm>


More information about the CMake mailing list