This is not what you were asking for explicitly, but may solve your problem:<br><br>- If your subdirectories are all at the same depth (e.g., they all hang from src/) you could just populate your source list in a variable set with the PARENT_SCOPE option, and then generate your library (in src/) with all the collected sources.<br>
<br>- If your sources are scattered across an arbitrary subdirectory structure with varying depths, then the above will be a big pain. In this case you can either accumulate a list of your source files in an environment variable using SET(ENV{myenv} value), or, more elegantly, create a custom property for this.<br>
<br>This topic has popped on the list quite recently (maybe one or two months ago), so it may be a good idea to browse the archives to get more details on the subject.<br><br>Cheers!<br><br><br><div class="gmail_quote">On Wed, Apr 29, 2009 at 7:29 PM, Tyler Roscoe <span dir="ltr">&lt;<a href="mailto:tyler@cryptio.net">tyler@cryptio.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I have a fairly complex library with a bunch of small pieces scattered<br>
throughout subdirectories.<br>
<br>
Each subdirectory has its own CMakeLists.txt. This is nice because the<br>
list of .cpp files for each subdirectory is right there in the<br>
subdirectory, and because these subdirectories behave just like all the<br>
other subdirectories in the system (you can go to them and build them<br>
and get something useful dropped into a results directory).<br>
<br>
What I would like is for each subdirectory to compile its .cpp files<br>
into object files and then stop. There is no need for each subdir to<br>
generate a library because the object files will later be collected into<br>
a single higher-level library.<br>
<br>
Is there a way to tell CMake to only compile a list of source files and<br>
not to link them? I tried setting CMAKE_CXX_LINK_EXECUTABLE,<br>
CMAKE_LINKER, and LINKER_LANGUAGE to nothing but the generated Makefiles<br>
still happily call g++.<br>
<br>
Should I give up on this approach and just list all my .cpp files in the<br>
CMakeLists for the higher-level. Maybe I could include() stubs from the<br>
subdirectories into my higher-level CMakeLists?<br>
<br>
A related problem: how can I get the path to the object files that are<br>
created in my binary directory? We are currently using this, but it&#39;s<br>
kinda ugly and probably quite fragile:<br>
<br>
if (WIN32)<br>
    set (TEST_OBJ_LOC ${${local_project_name}_BINARY_DIR}/${local_project_name}.dir/debug)<br>
    set (OBJ_EXTENSION ${CMAKE_CXX_OUTPUT_EXTENSION})<br>
else ()<br>
    string(REPLACE &quot;/_build/..&quot; &quot;/&quot; ABS_OBJ_LOC ${${local_project_name}_SRC})<br>
    set (TEST_OBJ_LOC ${${local_project_name}_BINARY_DIR}/CMakeFiles/${local_project_name}.dir${ABS_OBJ_LOC})<br>
    set (OBJ_EXTENSION .cpp${CMAKE_CXX_OUTPUT_EXTENSION})<br>
endif ()<br>
<br>
<br>
thanks,<br>
tyler<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Adolfo Rodríguez Tsouroukdissian<br><br>Robotics engineer<br>PAL ROBOTICS S.L<br><a href="http://www.pal-robotics.com">http://www.pal-robotics.com</a><br>Tel. +34.93.414.53.47<br>
Fax.+34.93.209.11.09<br>