[CMake] file depending on a target

Brandon J. Van Every bvanevery at gmail.com
Mon May 15 17:38:43 EDT 2006


Brad King wrote:
> Brandon J. Van Every wrote:
>>
>> It seems that "DEPENDS silex" will not refer to the SILEX.EXE 
>> target.  Rather, it thinks it's an ordinary file level dependency.
>
> That's okay.  The make process that evaluates the file-level 
> dependency will not be executed until it is known that the exe target 
> is up to date.  That is what the target-level dependency does.

I have found the specific error.  The following code works:


ADD_CUSTOM_COMMAND(
  OUTPUT ${Chicken_BINARY_DIR}/easyffi.c
  MAIN_DEPENDENCY ${Chicken_SOURCE_DIR}/easyffi.scm
  DEPENDS ${Chicken_BINARY_DIR}/easyffi.l.silex
  COMMAND ${VALID_CHICKEN} ${Chicken_SOURCE_DIR}/easyffi.scm 
-output-file ${Chicken_BINARY_DIR}/easyffi.c ${CHICKEN_FLAGS}
)

The following code does *NOT* work:


#This didn't work.
ADD_FILE_DEPENDENCIES(${Chicken_BINARY_DIR}/easyffi.c
  ${Chicken_BINARY_DIR}/easyffi.l.silex
)
#Below is a full expansion of my easyffi.c generation.

ADD_CUSTOM_COMMAND(
  OUTPUT ${Chicken_BINARY_DIR}/easyffi.c
  MAIN_DEPENDENCY ${Chicken_SOURCE_DIR}/easyffi.scm
#  DEPENDS ${Chicken_BINARY_DIR}/easyffi.l.silex
  COMMAND ${VALID_CHICKEN} ${Chicken_SOURCE_DIR}/easyffi.scm 
-output-file ${Chicken_BINARY_DIR}/easyffi.c ${CHICKEN_FLAGS}
)

So I was right, ADD_FILE_DEPENDENCIES does *not* play properly with 
DEPENDS in ADD_CUSTOM_COMMAND.  Bug or feature?


Cheers,
Brandon Van Every




More information about the CMake mailing list