[Cmake] ADD_CUSTOM_COMMAND etc
Neil Killeen
Neil.Killeen at atnf.csiro.au
Tue Apr 15 21:08:43 EDT 2003
On 15 Apr 2003, Andy Cedilnik wrote:
>
> The outputs is hint to CMake and not to the actual command. It is so
> that other custom commands or whatever know that this custom command
> will create file. In your case, the second custom command depends on
> ${Test_BINARY_DIR}/junk.dvi. Now CMake will look at what generates that
> file, by looking at OUTPUTS.
>
oooh, i see. i suspect you already told me this.
> > 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
> >
> You can use foreach:
>
> ADD_CUSTOM_TARGET(HTMLs ALL)
> SET(files junk1.html junk2.html junk3.html junk4.html)
> SET(results)
> FOREACH(file ${files})
> SET(src ${HERE}/${file})
> SET(dst ${THERE}/${file})
> ADD_CUSTOM_COMMAND(SOURCE ${src}
> TARGET HTMLs
> COMMAND ${CMAKE_COMMAND}
> ARGS -E copy ${src} ${dst}
> OUTPUTS ${dst}
> )
> SET(results ${results} ${dst})
> ENDFOREACH(file)
> ADD_CUSTOM_COMMAND(SOURCE HTMLs
> TARGET HTMLs
> DEPENDS ${results}
> )
>
> Looks good?
> Verify the {}().
>
> Andy
>
yah i was aware of FOREACH. i was trying to avoid dependencies
on the actual files in the CMakeLists.txt ...
but ok i will do it this way
cheers
Neil
More information about the CMake
mailing list