"cmake -E tar xvf" is implemented...<br><br><div>Does this happen with other tar files, or just that one?</div><div><br></div><div><br><div class="gmail_quote">On Tue, Nov 24, 2009 at 11:07 PM, Brian Davis <span dir="ltr"><<a href="mailto:bitminer@gmail.com">bitminer@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">So I found this thread below and tried the command at the promp (Win7):<br><br>cmake -E tar xvf <br><br>CMake Error: Problem with tar_open(): No such file or directory<br>
CMake Error: Problem extracting tar: ${TARDIR}/mytar.tar<br>
<br>cmake -E tar xvf openssl-0.9.8a.tar<br><br>CMake Error: Problem with tar_open(): No such file or directory<br>CMake Error: Problem extracting tar: openssl-0.9.8a.tar<br><br>so I do a: <br><br>CMake Error: cmake version 2.8.0<br>
Usage: cmake -E [command] [arguments ...]<br>Available commands:<br> chdir dir cmd [args]... - run command in a given directory<br> rename oldname newname - rename a file or directory (on one volume)<br> copy file destination - copy file to destination (either file or directory)<br>
copy_if_different in-file out-file - copy file if input has changed<br> copy_directory source destination - copy directory 'source' content to directory 'destination'<br> compare_files file1 file2 - check if file1 is same as file2<br>
echo [string]... - displays arguments as text<br> echo_append [string]... - displays arguments as text but no new line<br> environment - display the current enviroment<br> make_directory dir - create a directory<br>
md5sum file1 [...] - compute md5sum of files<br> remove_directory dir - remove a directory and its contents<br> remove [-f] file1 file2 ... - remove the file(s), use -f to force it<br> tar [cxt][vfz] file.tar file/dir1 file/dir2 ... - create a tar archive<br>
time command [args] ... - run command and return elapsed time<br> touch file - touch a file.<br> touch_nocreate file - touch a file but do not create it.<br> build build_dir - build the project in build_dir.<br>
write_regv key value - write registry value<br> delete_regv key - delete registry value<br> comspec - on windows 9x use this for RunCommand<br><br>And I pay particular attention to<br>
<br> tar [cxt][vfz] file.tar file/dir1 file/dir2 ... - create a tar archive<br>
<br>and notice no xvf option.<br><br>Is tar xvf implemnted?<br><br>If so why tar and no untar? Curious.<br><br>Brian<br><br clear="all">
<div style="font-family:-moz-fixed;font-size:13px" lang="x-western">
<br>On 25. Mar, 2009, at 10:28, ankit jain wrote:
<br>
<br><blockquote type="cite">2009/3/25 Michael Wild <a href="mailto:themiwi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" target="_blank"><themiwi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org></a>
<br>
<br><blockquote type="cite">
<br>On 25. Mar, 2009, at 9:33, ankit jain wrote:
<br>
<br>2009/3/25 Michael Wild <a href="mailto:themiwi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" target="_blank"><themiwi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org></a>
<br><blockquote type="cite">
<br></blockquote>
<br>[...]
<br>
<br>
<br><blockquote type="cite"><blockquote type="cite">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 "Extracting ${TARDIR}/mytar.tar"
<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
<br>mytar.tar. Then it adds a target which depends on that file. You then can
<br>have other targets depend on that by using add_dependencies.
<br>
<br>
<br></blockquote>
<br>Thanks for your suggestions it works but the problem is that iam making a
<br>library which requires some source files which will come after extracting
<br>it
<br>from tar.
<br>
<br>In that making an custom target for it and then add_dependencies to that
<br>library to this custom build target does not solve the purpose.
<br>
<br>then how to include those files which is required by the library which
<br>came
<br>from tar.
<br>
<br></blockquote>
<br>
<br>if you add all the files from the tar archive to the OUTPUT list of
<br>add_custom_command, CMake should automatically set the GENERATED property of
<br>those file to TRUE. If you don't want to do that, you still can set that
<br>property manually, using e.g.:
<br>
<br>set_source_files_properties( ${TARDIR}/t1 ${TARDIR}/t2 PROPERTIES GENERATED
<br>TRUE )
<br>
<br>you then can use those files in a normal add_library or add_executable
<br>command. if you use the first approach (listing all files in the OUTPUT
<br>list), you don't even need the custom target, since CMake then will know how
<br>to "create" these files (by invoking the custom command).
<br>
<br>
<br></blockquote>Is there any way by which we just give the name of folder where files has
<br>extracted and add_library command will take it by some means it is becoz if
<br>we dont know what files will be genrated inside that folder or if there are
<br>large no.of files then listing them in OUTPUT is really cumbersome..
<br>
<br>
<br>ankit
<br></blockquote>
<br>you could use
<br>
<br>execute_process(
<br> COMMAND ${CMAKE_COMMAND} -E tar tf ${TARDIR}/mytar.tar
<br> OUTPUT_VARIABLE tar_files
<br> )
<br>
<br>to get a list of files contained in the tar file. However, I don't
recommend this. It is much safer to really write the files out. If it
hurts your eyes to put it in the CMakeLists.txt file, you can put the
list in e.g. a file called files.cmake and INCLUDE that one from your
CMakeLists.txt.
<br>
<br>DON'T use file(GLOB ...) or similar. That's a pretty bad idea...
<br>
<br>Michael
<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>
<br></div><br>-- <br>Brian J. Davis<br><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></div>