Really, the target_link_libraries command for a given lib or exe belongs in the same CMakeLists.txt file that you call add_library or add_executable from. What is your reason for wanting to put the list of dependencies somewhere else?<br>
<br><div><br><div class="gmail_quote">On Mon, Jan 12, 2009 at 9:29 AM, Alexandre Feblot <span dir="ltr"><<a href="mailto:Alexandre.Feblot@thomsonreuters.com">Alexandre.Feblot@thomsonreuters.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="FR" link="blue" vlink="#606420">
<div>
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt">Hi Andreas,</span></font></p>
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt"> </span></font></p>
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt">In fact, this is already what I did:</span></font></p>
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt"> </span></font></p>
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt">Here is a synopsis of my CMakeLists files:</span></font></p>
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt"> </span></font></p>
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt">ROOT CMakeLists.txt:</span></font></p>
<p style="margin-left:53.25pt;text-indent:-18.0pt"><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt"><span>-<font size="1" face="Times New Roman"><span style="font:7.0pt "Times New Roman"">
</span></font></span></span></font><span lang="EN-GB">define some
general stuff, options, macros.</span></p>
<p style="margin-left:53.25pt;text-indent:-18.0pt"><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt"><span>-<font size="1" face="Times New Roman"><span style="font:7.0pt "Times New Roman"">
</span></font></span></span></font><span lang="EN-GB">call add_subdirectory()
for all subdirectories</span></p>
<p style="margin-left:53.25pt;text-indent:-18.0pt"><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt"><span>-<font size="1" face="Times New Roman"><span style="font:7.0pt "Times New Roman"">
</span></font></span></span></font><span lang="EN-GB">*trying* to set
link dependencies with target_link_libraries()</span></p>
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt"> </span></font></p>
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt">subdir CMakeLists.txt:</span></font></p>
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt"> - defining libs with add_library()</span></font></p>
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt"> </span></font></p>
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt">Or don't I understand what you mean by " before linking
the libs "?</span></font></p>
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt"> </span></font></p><font color="#888888">
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt"> </span></font></p>
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt">Alexandre</span></font></p></font><div><div></div><div class="Wj3C7c">
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt"> </span></font></p>
<p><font size="2" face="Courier New"><span lang="EN-US" style="font-size:10.0pt">-----Original Message-----<br>
From: <a href="mailto:cmake-bounces@cmake.org" target="_blank">cmake-bounces@cmake.org</a> [mailto:<a href="mailto:cmake-bounces@cmake.org" target="_blank">cmake-bounces@cmake.org</a>] On Behalf Of Andreas
Pakulat<br>
Sent: Monday, 12 January 2009 14:32<br>
To: <a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a><br>
Subject: Re: [CMake] add_library and target_link_libraries in
differentdirectories?</span></font><span lang="EN-GB"></span></p>
<p><font size="2" face="Courier New"><span lang="EN-GB" style="font-size:10.0pt"> </span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">On 12.01.09 11:27:28, Alexandre Feblot wrote:</span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> Hi,</span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> </span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> </span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> </span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> I have not been able to define a library dependency in a directory</span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> different from the one in which the library target is created.</span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> </span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> Is this done by design, or is there any way to do it?</span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> </span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> </span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> </span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> My goal would be to have</span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> </span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> - each
library in it's own directory (and a CMakeLists.txt file</span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> with a add_library command)</span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> </span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> - all
dependencies stored in a single file at the root level</span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">> </span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt"> </span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">Then you need to call add_subdirectory() for the library subdirs before</span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">linking the libs. You can't link a target that you havent' defined yet.</span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt"> </span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">Andreas</span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt"> </span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">-- </span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">Chicken Little was right.</span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">_______________________________________________</span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt">CMake mailing list</span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt"><a href="mailto:CMake@cmake.org" target="_blank">CMake@cmake.org</a></span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt"><a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a></span></font></p>
<p><font size="2" face="Courier New"><span style="font-size:10.0pt"> </span></font></p>
</div></div></div>
<br clear="all"><div class="Ih2E3d"> This email was sent to you by Thomson Reuters, the global news and information company.<br>
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.
</div></div>
<br>_______________________________________________<br>
CMake mailing list<br>
<a href="mailto:CMake@cmake.org">CMake@cmake.org</a><br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br></div>