[CMake] macro within a custom command
Brandon J. Van Every
bvanevery at gmail.com
Fri May 19 14:44:08 EDT 2006
Brad King wrote:
>
> Try using FOREACH:
>
> FOREACH(root batch-driver ...)
> ADD_CUSTOM_COMMAND(
> OUTPUT ${Chicken_BINARY_DIR}/${root}.c
> MAIN_DEPENDENCY ${root}.scm
> DEPENDS parameters.scm
> COMMAND ${VALID_CHICKEN} ${Chicken_SOURCE_DIR}/${root}.scm
> -output-file ${Chicken_BINARY_DIR}/${root}.c ${CHICKEN_FLAGS}
> )
> ENDFOREACH(root)
That would make all files in FOREACH depend on parameters.scm. Not what
I needed. Previously I was listing out each ADD_CUSTOM_COMMAND
separately because I had different DEPENDS and numbers of DEPENDS for
each of them, and I wanted to get some abstraction in the COMMAND part
only. But I found a better solution per my other post. Best trick is
to create a global variable using file's rootname and a suffix like
'_deplist', then use it to communicate additional data about the file.
This kind of pseudo-OO persistent state technique can be applied to
anything.
>
> > ADD_FILE_DEPENDENCIES is useless for that purpose.
>
> The ADD_FILE_DEPENDENCIES macro has a horrible name and was not well
> documented or intentionally added to the release. It is meant only
> for the deprecated OBJECT_DEPENDS target property. Please ignore its
> existence. I'm going to try to get it removed completely in 2.4.3
> since it was not in the 2.2 release.
I've hurled and purged. :-)
Cheers,
Brandon Van Every
More information about the CMake
mailing list