[CMake] Re: macro within a custom command
Brandon J. Van Every
bvanevery at gmail.com
Fri May 19 15:39:46 EDT 2006
Brad King wrote:
> Brandon J. Van Every wrote:
>> DEPLIST(chicken build chicken-ffi-macros chicken-more-macros tweaks)
>> SIMPLE_SCM_TO_C(chicken)
>
> You could take advantage of variable macro arguments. The token
> "${ARGN}" will be replaced by arguments beyond those explicitly named.
> Try something like this (untested):
>
> MACRO(SIMPLE_SCM_TO_C root)
> SET(deplist ${ARGN})
> ADD_SUFFIX(deplist .scm)
> ADD_CUSTOM_COMMAND(
> OUTPUT ${Chicken_BINARY_DIR}/${root}.c
> MAIN_DEPENDENCY ${root}.scm
> DEPENDS ${deplist}
> COMMAND ${VALID_CHICKEN} ${Chicken_SOURCE_DIR}/${root}.scm
> -output-file ${Chicken_BINARY_DIR}/${root}.c ${CHICKEN_FLAGS}
> )
> ENDMACRO(SIMPLE_SCM_TO_C)
>
> SIMPLE_SCM_TO_C(chicken build chicken-ffi-macros chicken-more-macros
> tweaks)
Hmm I had overlooked ARGN in macros, I kept massaging ARGV. Also I
didn't think about writing 3 different ADD_CUSTOM_COMMANDs as at one
point I was thinking about all the extra compiler options, and I was
using variable arguments for those. But I only have 3 different sets of
compiler options that I use frequently, they could be constantized. Yes
I think your solution is an improvement over what I did.
Cheers,
Brandon Van Every
More information about the CMake
mailing list