[CMake] file depending on a target
William A. Hoffman
billlist at nycap.rr.com
Mon May 15 17:45:25 EDT 2006
At 05:38 PM 5/15/2006, Brandon J. Van Every wrote:
>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?
All ADD_FILE_DEPENDENCIES does is set OBJECT_DEPENDS on the source. So, it will
not cause a custom command to run. It will cause a .o file to be compiled.
It is a different thing than the DEPENDS of a custom command. Which will add a depend
to the custom command, and will re-run the custom command if that depend changes.
OBJECT_DEPENDS currently only affects the building of an object file.
-Bill
More information about the CMake
mailing list