<FONT face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size=2><div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace">Hi Andreas,</font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace"><br></font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace">I too am new to CMake, but let me take a crack at this... someone correct me if there's a better way.</font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace"><br></font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace">You shouldn't need a find module. You only need them when you're including libraries that CMake doesn't already know the location of. Since you're building Library_1 in CMake you can just give the library target name directly to target_link_libraries.</font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace"><br></font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace">Assuming you have:<br><br>Source/CMakeLists.txt</font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace">&nbsp; &nbsp; ...</font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace">&nbsp; &nbsp; add_subdirectory(Library_1)<br>&nbsp; &nbsp; add_subdirectory(Application_1)</font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace"><br></font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace">Source/Library_1/CMakeLists.txt</font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace">&nbsp; &nbsp; add_library(Library_1&nbsp;</font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace"><br></font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace">then you can simply do this:</font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace"><br></font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace">Source/Application_1/CMakeLists.txt</font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace">&nbsp; &nbsp; add_executable( Application_1 app1.cpp )</font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><font face="'Default Monospace', 'Courier New', Courier, monospace">&nbsp; &nbsp; target_link_libraries( Application_1 Library_1 )</font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><span style="font-family: 'Default Monospace', 'Courier New', Courier, monospace; ">&nbsp; &nbsp; # That said, I'm not quite sure the nicest way to include_directories of said library.</span></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Times New Roman'; "><span style="font-family: 'Default Monospace', 'Courier New', Courier, monospace; ">&nbsp; &nbsp; # I've been using this:</span></div><div><font face="'Default Monospace', 'Courier New', Courier, monospace"><font size="2">&nbsp; &nbsp; include_directories( "${PROJECT_SOURCE_DIR}/Library_1" )</font><br><font size="2"><br></font></font></div><div><font face="'Default Monospace', 'Courier New', Courier, monospace"><font size="2">Hope this helps,</font></font></div><div><font face="'Default Monospace', 'Courier New', Courier, monospace"><font size="2"><br></font></font></div><div><font face="'Default Monospace', 'Courier New', Courier, monospace"><font size="2">-Carl</font></font></div></div><div style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: small; font-family: 'Default Sans Serif', Verdana, Arial, Helvetica, sans-serif; "><div><br></div><font color="#990099">-----cmake-bounces@cmake.org wrote: -----<br><br></font><blockquote style="padding-right:0px;padding-left:5px;margin-left:5px;border-left:#000000 2px solid;margin-right:0px">To: cmake@cmake.org<br>From: "m.hergarden" &lt;m.hergarden@euphoria-it.nl&gt;<br>Sent by: cmake-bounces@cmake.org<br>Date: 02/29/2012 01:50AM<br>Subject: Re: [CMake] Question regarding source tree structure and how to find libraries easily within that structure<br><br>        <!--Notes ACF <meta content="text/html; charset=windows-1252"       http-equiv="Content-Type">-->           On 02/26/2012 09:18 AM, Andreas Guther wrote:     <blockquote cite="mid:1FEE06D3-CBB4-48B3-9552-59BBBD101F29@guther.net" type="cite">       <font face="Courier New,Courier,monospace" size="3">Hello,<br><br>I'm justing starting to learn/use CMake and I have a question regarding the usage of it in regards of source tree structure and library usage.<br><br>I have the following folder structure:<br><br>Root<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        Bin<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        Win32X86Debug<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        Win32X86Release<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        ...<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        Lib<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        Win32X86Debug<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        Win32X86Release<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        ...<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        Source<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        ace<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        Application_1<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        Application_2<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        boost<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        Library_1<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        Library_2<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        Library_3<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        ...<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        Tools<br><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>        &#8230;<br><br>I'd like to point out the structure within "Source". In the source directory there are libraries that may be used by one or more applications. That means for example that "Application_1" may use "Library_1" and "Library_3" and "Application_2" may use "Library_1" and "Library_2".<br><br>I have currently no idea how I should solve this without creating a find module for every library in the tree. Is there any other solution than creating find modules I can use?<br>If there is really no other (good) solution than creating find modules, is it possible to place the find modules (Library_n.cmake files, right?) within the library folders? I ask this, because I think it would make it much more easy to maintain them.<br><br>Kind regards,<br>Andreas <br>--<br><br>Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the CMake FAQ at: <a class="moz-txt-link-freetext" href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a class="moz-txt-link-freetext" href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a><br></font>     </blockquote>     <font face="DejaVu Sans">Is there a reason you can't use the       'include_directories' and 'link_directories' commands to add the       correct linkpaths?<br>       <br>       Micha<br>       <br>     </font>    <font face="Courier New,Courier,monospace" size="3">--<br><br>Powered by www.kitware.com<br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">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">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">http://www.cmake.org/mailman/listinfo/cmake</a></font> </blockquote><br></div></FONT>