[Cmake] Re: ADD_CUSTOM_COMMAND etc

Andy Cedilnik andy.cedilnik at kitware.com
Wed Apr 9 07:36:02 EDT 2003


Hi Nils,

The difference is that ADD_CUSTOM_TARGET adds something that will be
always executed (provided that you run that target or that target has
ALL). The custom command on the other hand has to be associated with a
target and does dependency checking.

			Andy

On Wed, 2003-04-09 at 07:17, Nils H. Busch wrote:
> I must say, that I did not understand the necessity of having to use ADD_CUSTOM_COMMAND in
> conjunction with ADD_CUSTOM_TARGET either.
> For my use of creating docs with doxygen, it was sufficient to place
> 
> IF (BUILD_DOCUMENTATION)
> 
> 
>   CONFIGURE_FILE(
>     ${FOO_SOURCE_DIR}/utilities/Doxygen/doxygen.config.in
>     ${FOO_BINARY_DIR}/utilities/Doxygen/doxygen.config.)
> 
>   ADD_CUSTOM_TARGET(doc
>    ALL
>    ${DOXYGEN}
>    ${FOO_BINARY_DIR}/utilities/Doxygen/doxygen.config)
> 
> ENDIF (BUILD_DOCUMENTATION)
> 
> in a CMakeLists.txt file.
> 
> When specifying ALL, the target is automatically added to the make all  target ;-), so you
> don't have to type
> make doc explicitly.
> 
> If I remember correctly, ADD_CUSTOM_COMMAND did add a Custom Command entry to the Makefile,
> the purpose of which, I did not fully understand as the target entry  did not use it.
> 
> So, I am no less confused than you are other than knowing that above approach worked for me.





More information about the CMake mailing list