[CMake] problem with add_custom command

ankit jain ankitguddu at gmail.com
Wed Mar 25 02:51:18 EDT 2009


2009/3/25 Alexander Neundorf <a.neundorf-work at gmx.net>

> On Tuesday 24 March 2009, ankit jain wrote:
> > hi all,
> >
> > Iam doing the following through my cmakelist.txt
> >
> > add_custom_target(mytarget)
> > add_custom_command(TARGET mytarget POST_BUILD
> > COMMAND ${CMAKE_COMMAND} -E tar xvf ${CMAKE_CURRENT_SOURCE_DIR}/t1.tar)
> > this cmakelist is written in subfolder of a mainfolder..
> >
> > But the problem is that files are not extracted and it is not showing any
> > error.
>
> Hm, I never tried to use add_custom_command(TARGET ... ) with a custom
> target.
> So if you do "make mytarget" then tar is not executed ?
> Did you try to do this directly using add_custom_target(), i.e. put the
> tar-command in the add_custom_target() ?
>
> Alex


I followed this approach becoz add_cutom_command with outptu option deos not
seems to work but actually i want to do it by that way only because from the
main tree i issue make only so thats why that target will not build.

Do anyone know what is the problem if i do like this and then run make:

add_custom_command(OUTPUT {TARDIR}/t2 {TARDIR}/t3
{TARDIR}/t1
COMMAND tar ARGS -xvf $(TARDIR)/mytar.tar
WORKING_DIRECTORY ${TARDIR})


> Here i want to extract the files in the same folder where tar exists..

the extraction will actually should give these t1, t2, t3 folder which i
mention in output ..

Is iam doing something wrong....

Ankit


>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090325/bc0bd882/attachment-0001.htm>


More information about the CMake mailing list