[CMake] Define a library target without using the add_library command ? <==> Working with repositories

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


Hi,

 

Is there a way to define a library target, on which I could use
target_link_libraries(), without creating/building this library, i.e.
without defining it with add_library(), but with add_custom_target for
instance ?

 

The goal is to work on a small part of a large project: I'd like to have
my binary linked with the few libraries that I have checked out, and all
other libraries taken from a pre-built repository (i.e. a full build of
the project used as a reference on a shared filesystem)

(Somehow similar to the process described here for scons :
http://www.scons.org/doc/1.2.0/HTML/scons-user/c3810.html, but only at a
library level)

 

Our initial and most straight forward idea (unsuccessful) was to
implement this build system:

-          describe all library dependencies (target_link_libraries) in
a single common file (so that all info are present in the sparse
sandbox)

-          for each library of the full project:

o        if present in the sandbox, build it and use it

o        otherwise, consider the pre-built lib from the reference, and
don't try to rebuild it

 

We also tried without success to create symlink to the missing libs, but
it was not possible then to use target_link_libraries() on these
targets.

 

3rd unsuccessful solution: trying to add_subdirectory() of the reference
sandbox in the sparse sandbox for missing directories: cmake complains
that these directories don't belong to the project (don't share the same
root).

 

 

So, is there any solution for this way of working with cmake?

 

 

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


More information about the CMake mailing list