[Cmake] ADD_CUSTOM_COMMAND etc

Neil Killeen Neil.Killeen at atnf.csiro.au
Tue Apr 15 00:33:23 EDT 2003


Andy

  I have finally succeeded in getting a custom command
in my Makefile when I replaced the incorrect trailing
'}' by a ')'.  I need a bigger font or younger eyes !
Thanks for your help, it was actually diffing your file
with mine that finally forced me to see this !  Ack :-(


Two more small questions remain...

1)  From your example


>
> PROJECT(Test)
>
> SET (LATEX_COMPILE latex)
>
> SET(DOC_ROOT ${Test_SOURCE_DIR}/Documentation)
>
> ADD_CUSTOM_TARGET (LaTeXDocument ALL)
> ADD_CUSTOM_COMMAND(
>     SOURCE    ${DOC_ROOT}/junk.tex
>     COMMAND   ${LATEX_COMPILE}
>     ARGS      ${DOC_ROOT}/junk.tex
>     TARGET    LaTeXDocument
>     OUTPUTS   ${Test_BINARY_DIR}/junk.dvi
> )
> ADD_CUSTOM_COMMAND(
>     SOURCE    LaTeXDocument
>     TARGET    LaTeXDocument
>     DEPENDS   ${Test_BINARY_DIR}/junk.dvi
> )
>


the amusing thing  about this, is that the output
goes absoluetly nowhere except in the working
directory.  The bold use of ${Test_BINARY_DIR}
has no actual impact on where the output goes !
Everything stays in $DOC_ROOT

Looking at the Makefile it is clear why.

Now since CMake knows nothing about the actual
command in use, e.g. latex, in this case, the only
way I can see to affect the output location is
throught the 'ARGS'

Now I think in this case latex has no control over
the output.  But imagine we were in the dvipdf phase
then one would do something like

ARGS      ${DOC_ROOT}/junk.tex ${Test_BINARY_DIR}/junk.dvi

being the equivalent of

% dvipdf  $DOC_ROOT/junk.tex $Test_BINARY_DIR/junk.dvi

so I am still left unclear what the OUTPUTS thing is all about !


2)  To copy HTML files to their destnation I used your example
which invokes, ultimately, something like

% cmake -E copy $HERE/junk.html  $THERE/junk.html


Can i wild-card this ? I have lots of html source files to be copied.
Thus the equivalent of

% cp $HERE/*.html $THERE

I tried the obvious things with the above cmake command syntax,
but they fail.  I get the impression I can only do one at a time
which means I have to write a custom command for each one.


cheers
Neil









More information about the CMake mailing list