<br><br>
<div class="gmail_quote">2009/3/25 Michael Wild <span dir="ltr">&lt;<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="im"><br>On 25. Mar, 2009, at 7:51, ankit jain wrote:<br><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">2009/3/25 Alexander Neundorf &lt;<a href="mailto:a.neundorf-work@gmx.net" target="_blank">a.neundorf-work@gmx.net</a>&gt;<br>
<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">On Tuesday 24 March 2009, ankit jain wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">hi all,<br><br>Iam doing the following through my cmakelist.txt<br><br>add_custom_target(mytarget)<br>add_custom_command(TARGET mytarget POST_BUILD<br>
COMMAND ${CMAKE_COMMAND} -E tar xvf ${CMAKE_CURRENT_SOURCE_DIR}/t1.tar)<br>this cmakelist is written in subfolder of a mainfolder..<br><br>But the problem is that files are not extracted and it is not showing any<br>error.<br>
</blockquote><br>Hm, I never tried to use add_custom_command(TARGET ... ) with a custom<br>target.<br>So if you do &quot;make mytarget&quot; then tar is not executed ?<br>Did you try to do this directly using add_custom_target(), i.e. put the<br>
tar-command in the add_custom_target() ?<br><br>Alex<br></blockquote><br><br>I followed this approach becoz add_cutom_command with outptu option deos not<br>seems to work but actually i want to do it by that way only because from the<br>
main tree i issue make only so thats why that target will not build.<br><br>Do anyone know what is the problem if i do like this and then run make:<br><br>add_custom_command(OUTPUT {TARDIR}/t2 {TARDIR}/t3<br>{TARDIR}/t1<br>
COMMAND tar ARGS -xvf $(TARDIR)/mytar.tar<br></blockquote><br></div>-------------------------^------^<br>those should probably be { and } instead of ( and )... 
<div class="im"><br><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>WORKING_DIRECTORY ${TARDIR})<br><br><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Here i want to extract the files in the same folder where tar exists..<br></blockquote><br>the extraction will actually should give these t1, t2, t3 folder which i<br>
mention in output ..<br><br>Is iam doing something wrong....<br><br>Ankit<br><br><br></blockquote><br><br></div>What I usually do is this:<br><br>add_custom_command( OUTPUT ${TARDIR}/t1<br> COMMAND ${CMAKE_COMMAND} -E tar xvf ${TARDIR}/mytar.tar<br>
 WORKING_DIRECTORY ${TARDIR}<br> COMMENT &quot;Extracting ${TARDIR}/mytar.tar&quot;<br> VERBATIM<br> )<br><br>add_custom_target( extract_mytar<br> DEPENDS ${TARDIR}/t1<br> )<br><br>This tells CMake how to obtain the file ${TARDIR}/t1 by unpacking mytar.tar. Then it adds a target which depends on that file. You then can have other targets depend on that by using add_dependencies.<br>
</blockquote>
<div> </div>
<div> </div>
<div>Thanks for your suggestions it works but the problem is that iam making a library which requires some source files which will come after extracting it from tar.</div>
<div> </div>
<div>In that making an custom target for it and then add_dependencies to that library to this custom build target does not solve the purpose.</div>
<div> </div>
<div>then how to include those files which is required by the library which came from tar.</div>
<div> </div>
<div> </div>
<div>Ankit</div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><span id=""></span><br>Another thing: Please make sure that TARDIR is in the build tree (i.e. somewhere below CMAKE_BINARY_DIR). Extracting tar-balls in the source tree is a pretty bad idea.<br>
<br>HTH<br><font color="#888888"><br>Michael<br></font></blockquote></div><br>