<div dir="ltr"><div><div><div><div><div><div>Hi,<br><br></div>the name given after the : in the TARGET_OBJECTS generator expression is the logical (CMake) name of a target. There's no scoping in target names, they're all at the same global scope. So if you have this:<br><br></div>add_library(A OBJECT ...)<br><br></div>then you will access its objects like this:<br><br></div>add_library(... $<TARGET_OBJECTS:A> ...)<br><br></div>regardless of whether this happens in the same CMakeList or an entirely different one (parent, child, sibling, it makes not difference).<br><br></div><div>Which also means there's no need for progressively going up levels: just use all the A, B, C, D directly in the toplevel add_library call.<br></div><div><br></div>Petr<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 25, 2016 at 3:34 PM, Vania Joloboff <span dir="ltr"><<a href="mailto:vania.joloboff@inria.fr" target="_blank">vania.joloboff@inria.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
In a library project there are two level of subdirectories that contain modules<br>
to be included into the main library.<br>
In other words, directory lib contains subdirectories foo and bar<br>
Subdirectory foo contains A and B.<br>
Subdirectory bar contains C and D.<br>
All of the objects from A, B, C and D must belong to the library<br>
<br>
I understand I can use at the bottom levels A, B, C, D<br>
 add_library() with the OBJECT argument<br>
and I should be able to use add_library() in the top directory<br>
to collect all of the object files from the subdirectories<br>
<br>
add_library(... $<TARGET_OBJECTS:some_name> ...)<br>
<br>
for each of the sub directories. But the documentation is unclear<br>
about the naming schema to use. What is the syntax/meaning of some_name ?<br>
<br>
add_library(... $<TARGET_OBJECTS:foo/A> $<TARGET_OBJECTS:foo/B> $<TARGET_OBJECTS:bar/C> $<TARGET_OBJECTS:bar/D> ...)<br>
<br>
Or I need to gather at level foo and bar the objects from bottom layer<br>
and recursively make them go up one level by one level ?<br>
<br>
Thanks<br>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
</blockquote></div><br></div>