[CMake] What is the preferred method of establishing
the dependence of a custom command on an executable target?
Brandon J. Van Every
bvanevery at gmail.com
Tue Apr 10 03:00:32 EDT 2007
Bill Hoffman wrote:
> Actually from the wiki:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Your custom commands should look like this:
>
> ADD_CUSTOM_COMMAND(
> OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/foo0.qaz
> COMMAND ${DOIT_EXE} ${CMAKE_CURRENT_SOURCE_DIR}/someinput0.txt
> ${CMAKE_CURRENT_BINARY_DIR}/foo0.qaz
> DEPENDS ${DOIT_EXE})
I wrote that wiki entry.
>
>
> That will make sure the DOIT_EXE is built before the command is run.
I would swear that once upon a time, that was not true. The DEPENDS was
a file level dependency. It would not trigger a target level dependency.
> Newer versions of cmake also support just using the target name there,
> so you can even have:
> ADD_CUSTOM_COMMAND(
> OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/foo0.qaz
> COMMAND ${DOIT_EXE} ${CMAKE_CURRENT_SOURCE_DIR}/someinput0.txt
> ${CMAKE_CURRENT_BINARY_DIR}/foo0.qaz
> DEPENDS doit)
> )
>
> The wiki should be updated to show that information.
It's a wiki, so you could. Are you saying you want someone else to?
Cheers,
Brandon Van Every
More information about the CMake
mailing list