[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-buildsystem
Subject:    Better support for custom commands that generate multiple files
From:       brad.king () kitware ! com (Brad King)
Date:       2006-04-11 15:57:24
Message-ID: 443BD1E4.7080107 () kitware ! com
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic