<div>Thanks for all the help its working.</div>
<div> </div>
<div>Regards-</div>
<div>ankit jain <br><br></div>
<div class="gmail_quote">2009/1/30 Philip Lowman <span dir="ltr"><<a href="mailto:philip@yhbt.com">philip@yhbt.com</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="gmail_quote">
<div>
<div></div>
<div class="Wj3C7c">On Thu, Jan 29, 2009 at 11:38 PM, ankit jain <span dir="ltr"><<a href="mailto:ankitguddu@gmail.com" target="_blank">ankitguddu@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid"><br><br>
<div class="gmail_quote">2009/1/29 Pau Garcia i Quiles <span dir="ltr"><<a href="mailto:pgquiles@elpauer.org" target="_blank">pgquiles@elpauer.org</a>></span>
<div><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<div>
<div></div>
<div>On Thu, Jan 29, 2009 at 1:12 PM, ankit jain <<a href="mailto:ankitguddu@gmail.com" target="_blank">ankitguddu@gmail.com</a>> wrote:<br>> hi all,<br>><br>> Problem:<br>><br>> libA : A/foo.cc<br>> libB : B/bar.cc<br>
> and a 3rd library:<br>> libC : A/foo.cc B/bar.cc<br>> ?<br>><br>> here i build the libraries for A and B but not able to build lib for C .<br>> Guide me to do that. What should be the content of cmakelist file of C to<br>
> create lib C<br>><br>> here A and B are sub folders of C<br><br></div></div>Do you ean you are trying this but it's not working?<br><br>ADD_LIBRARY (libA A/foo.cc )<br>ADD_LIBRARY (libB B/bar.cc )<br>ADD_LIBRARY (libC libA libB )<br>
<br>That fails because CMake does not support convenience libraries:<br><a href="http://www.cmake.org/Wiki/CMake_FAQ#Does_CMake_support_.22convenience.22_libraries.3F" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ#Does_CMake_support_.22convenience.22_libraries.3F</a><br>
<br>You need to do this:<br><br>ADD_LIBRARY (libA A/foo.cc )<br>ADD_LIBRARY (libB B/bar.cc )<br>ADD_LIBRARY (libC A/foo.cc B/bar.cc )<br><br>I. e. list the source files for libC<br><br>Is that what you want to do?<br><font color="#888888"></font></blockquote>
<div> </div></div>
<div>Dont you think so it will be too hectic if there are 10 folders inside folder C and each folder has around 10 C files each. then listing all will be really cumbersome. </div>
<div>What should be the alternative for it.</div></div></blockquote></div></div>
<div><br>Here's one idea, in A and B set a variable with all of the source files and add them to the PARENT_SCOPE.<br><br>set(A_SRCS a.cc)<br>set(A_SRCS ${A_SRCS} PARENT_SCOPE)<br>add_library(A ${A_SRCS})<br><br>Then in the higher directory, use a foreach() loop to construct a proper relative path to each source file:<br>
<br>foreach(fname ${A_SRCS})<br> list(APPEND C_SRCS A/${fname})<br>endforeach()<br>foreach(fname ${B_SRCS})<br> list(APPEND C_SRCS B/${fname})<br>endforeach()<br>add_library(both ${C_SRCS})<br><br></div></div>-- <br>
<font color="#888888">Philip Lowman<br></font></blockquote></div><br>