Better support for custom commands that generate multiple files needed.

David Faure faure at kde.org
Wed Apr 5 22:10:53 CEST 2006


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

I had a problem due to addressee.h being deleted but not addressee.cpp, so the
above command wouldn't be run, and compilation would fail. No idea how
I ended up with only addressee.cpp and no .h, but well... the old buildsystem
handled this case since Makefiles support the notion of "custom commands 
that generate multiple files" :
addressee.cpp addressee.h field.cpp: [....]

I tried to add something like Alex's recent fix for kcfg files:
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/addressee.h DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/addressee.cpp)
but this doesn't help; the .cpp exists so the dependency does nothing, if the .h is missing.

Could add_custom_command's OUTPUT variable be changed to support a list of output files?

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).



More information about the Kde-buildsystem mailing list