Better support for custom commands that generate multiple files needed.
Brad King
brad.king at kitware.com
Tue Apr 11 17:57:24 CEST 2006
David Faure wrote:
> kdelibs/kabc says:
>
> add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/addressee.cpp
> WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/scripts
> COMMAND ${PERL_EXECUTABLE}
> ARGS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/makeaddressee
> DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/makeaddressee
> ${CMAKE_CURRENT_SOURCE_DIR}/scripts/addressee.src.cpp
> ${CMAKE_CURRENT_SOURCE_DIR}/scripts/addressee.src.h
> ${CMAKE_CURRENT_SOURCE_DIR}/scripts/entrylist
> ${CMAKE_CURRENT_SOURCE_DIR}/scripts/field.src.cpp
> )
>
> The above script in fact generates both addressee.cpp and addressee.h
[snip]
> Could add_custom_command's OUTPUT variable be changed to support a list of output files?
This is now done in CVS CMake. This should now work:
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/addressee.h
${CMAKE_CURRENT_BINARY_DIR}/addressee.cpp
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/scripts
COMMAND ${PERL_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/scripts/makeaddressee
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/makeaddressee
${CMAKE_CURRENT_SOURCE_DIR}/scripts/addressee.src.cpp
${CMAKE_CURRENT_SOURCE_DIR}/scripts/addressee.src.h
${CMAKE_CURRENT_SOURCE_DIR}/scripts/entrylist
${CMAKE_CURRENT_SOURCE_DIR}/scripts/field.src.cpp
)
Note that we do not need to require a new CMake to make these changes in
KDE. If the output currently specified is listed last then that one
will be used by CMake versions before these changes. Meanwhile CVS
CMake will deal properly with the multiple outputs listed.
Note also that the "ARGS" option is no longer needed in custom commands.
It is just ignored if present. The whole command line can be
specified after COMMAND (there can even be multiple commands separated
by COMMAND options).
-Brad
More information about the Kde-buildsystem
mailing list