Better support for custom commands that generate multiple files needed.

Alexander Neundorf neundorf at kde.org
Wed Apr 5 22:36:42 CEST 2006


On Wednesday 05 April 2006 22:10, 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
>
> 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.

Does adding ${CMAKE_CURRENT_BINARY_DIR}/addressee.h to the list of source 
files help ?

Bye
Alex
-- 
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org                - http://www.kde.org
      alex AT neundorf.net               - http://www.neundorf.net


More information about the Kde-buildsystem mailing list