[CMake] CUSTOM COMMAND triggered several times

Tyler Roscoe tyler at cryptio.net
Tue Aug 18 11:12:08 EDT 2009


On Tue, Aug 18, 2009 at 12:47:24PM +0200, Arnaud Devalkeneer wrote:
> I have a strange behaviour with add_custom_comand with its output form.
> This command is called two or three times, even the file dependency has not
> been changed and the output exists.
> 
> I wrote :
> 
> ADD_CUSTOM_COMMAND(
>     OUTPUT ${${PROJECT_NAME}_WOK_GENERATED_INCLUDE}
>     COMMAND woktcl ARGS ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.tcl
>     DEPENDS ${${PROJECT_NAME}_CDLS}
>     COMMENT "Generating ${PROJECT_NAME} include files from CDLs"
>   )
> 
> ADD_LIBRARY(${PROJECT_NAME} SHARED
>             ${${PROJECT_NAME}_SRCS}
>             ${${PROJECT_NAME}_WOK_GENERATED_INCLUDE}

This looks correct to me. Are you sure you don't have any typos (_CDLS
is actually _CDL or something)?

If this rule is being re-run two or three times per make, you must have
something else going on. Do you have other add_* commands that use
_WOK_GENERATED_INCLUDE? Do any of your CMake commands touch your .cdls?

tyler


More information about the CMake mailing list