Hi Olivier, <br><br>Assuming you have not set the flag, BUILD_SHARED_LIBS [1] set to TRUE, I will  consider you are building static libraries. If this last statement is valid, it seems your approach is the right one.<br><br>

I would also recommend you to read the following entry: <a href="http://vtk.org/Wiki/CMake_FAQ#Does_CMake_support_.22convenience.22_libraries.3F">http://vtk.org/Wiki/CMake_FAQ#Does_CMake_support_.22convenience.22_libraries.3F</a><br>

<br>Hth<br>Jc<br><br>[1] <a href="http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:BUILD_SHARED_LIBS">http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:BUILD_SHARED_LIBS</a><br><br><div class="gmail_quote">

On Tue, Mar 20, 2012 at 3:01 PM, Oliver Smith <span dir="ltr">&lt;<a href="mailto:osmith@playnet.com">osmith@playnet.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


  

    
  
  <div bgcolor="#FFFFFF" text="#000000">
    I&#39;m trying to make a CMakeLists for libevent, and had a couple of
    questions that would make it a bit cleaner:<br>
    <br>
    - Other than using a macro to do { add_executable(...)
    target_link_libraries(...) } is there a <i>clean</i> way to make
    everything in a subdirectory automatically link a given library?<br>
    <br>
    - The makefiles I&#39;m basing this on build libevent_core.lib,
    libevent_extras.lib and then libevent.lib which is basically the two
    previous libraries merged.<br>
    <br>
    I wanted to do:<br>
    <br>
    ADD_LIBRARY(libevent_core ${CoreSrcFiles})<br>
    ADD_LIBRARY(libevent_extras ${ExtraSrcFiles})<br>
    ADD_LIBRARY(libevent)<br>
    TARGET_LINK_LIBRARIES(libevent libevent_core libevent_extras)<br>
    <br>
    but this generates a warning/error,  listing the two libraries in
    add_library doesn&#39;t work either.<br>
    <br>
    So for now I have<br>
    <br>
    ADD_LIBRARY(libevent_core ${CoreSrcFiles})<br>
    ADD_LIBRARY(libevent_extras ${ExtraSrcFiles})<br>
    ADD_LIBRARY(libevent ${CoreSrcFiles} ${ExtraSrcFiles})<br>
    <br>
    but that&#39;s clumsy :)<span class="HOEnZb"><font color="#888888"><br>
    <br>
    - Oliver<br>
    <br>
  </font></span></div>

<br>--<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>+1 919 869 8849<br><br>