[Cmake] ADD_CUSTOM_COMMAND etc

Neil Killeen Neil.Killeen at atnf.csiro.au
Wed Apr 9 22:32:16 EDT 2003


Andy

thanks for your descriptions.  COuple of followups

>
>
> So much to do and so little time...
>

indeed !

> Ok, here is a hopefully working example:
>
> SET (LATEX_COMPILE latex)
> SET(DOC_ROOT ${MITK_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   ${MITK_BINARY_DIR}/junk.dvi
> )
> ADD_CUSTOM_COMMAND(
>     SOURCE    LaTeXDocument
>     TARGET    LaTeXDocument
>     DEPENDS   ${MITK_BINARY_DIR}/junk.dvi
> )
>

This example still produces no actual custom command code
in the resultant Makefile and so running it does nothing.  I have attached
my exact CMakeLists.txt  file and the resultant Makefile
To be clear, I am using CMake V 1.6

> You need the second custom command to drive the first one.


I don't understand this statement.  Isn't the first CUSTOM_COMMAND
self contained ?   I would expect that the outcome was the junk.dvi
file.  Why do I need the second one to drive the first one ?

Why is there a dependency on junk.dvi ?  That is what I
am trying to make, not what I am looking for a dependency on.

The line

>     SOURCE    LaTeXDocument

is confusing to me.  Isn't LaTeXDocument just a label for
the custom command so that you can associate it with the
ADD_CUSTOM_TARGET ?     You said that the SOURCE file was
just checked to be valid before it was used, not the label.


3. I was planning a simple copy for files that are HTML source.  Thus


SET (HTML_COMPILE cp)
SET(DOC_ROOT ${MITK_SOURCE_DIR}/Documentation}

ADD_CUSTOM_TARGET (HTMLDocument ALL)
ADD_CUSTOM_COMMAND(
    SOURCE    ${DOC_ROOT}/junk.html
    COMMAND   ${HTML_COMPILE}
    ARGS      ${DOC_ROOT}/junk.html ${MITK_BINARY_DIR}/junk.html
    TARGET    HTMLDocument
    OUTPUTS   ${MITK_BINARY_DIR}/junk.html
)


Since the output file is now in the ARGS List, what is the role
of the OUTPUTS variable here ?

AGain I suppose I need your second ADD_CUSTOM_COMMAND to drive
this one.



My mind is clearly not yet mapped to the way CMake requires.  :-(



> We have on the board as one of major things to overall the whole custom
> rules thing.
>
> 				Andy
>

I think I'd like to see it re-implemented as a Macro.  In this
way you specify ONE custom command, and then apply it to many
source files/targets.

roughly:

DEFINE_CUSTOM_COMMAND (
   NAME     BIGGLES              # Converts latex to pdf
   ...
)

ADD_CUSTOM_TARGET (junk.pdf junk.tex NAME=BIGGLES)
ADD_CUSTOM_TARGET (junk2.pdf junk2.tex NAME=BIGGLES)

well, you see what I mean.   The way it is now, for each target you have
to write an entire new ADD_CUSTOM_COMMAND.

cheers
Neil
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CMakeLists.txt
URL: <http://public.kitware.com/pipermail/cmake/attachments/20030410/b65a7766/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 7723 bytes
Desc: 
URL: <http://public.kitware.com/pipermail/cmake/attachments/20030410/b65a7766/attachment.obj>


More information about the CMake mailing list