Better support for custom commands that generate multiple files needed.

Joseph Wenninger jowenn at kde.org
Fri Apr 7 19:16:07 CEST 2006


Hi !

Am Freitag, 7. April 2006 18:30 schrieb Alexander Neundorf:
> 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 haven't looked that deep into cmake yet, but is there a reason, why it 
doesn't it just allow multiple OUTPUT parameters ? (OUTPUT xyz OUTPUT 
asdf  ....) ?

I don't know how portable it is and what happens with parallel builds, but at 
least in gnu make you can write eg

y.tab.c y.tab.h: myfile.y
	yacc -d myfile.y

And the it usually works for me if a helper command generates more than one 
output file

Kind regards
Joseph Wenninger

-- 
It usually takes more than three weeks to prepare a good impromptu speech. 
(Mark Twain)
KATE developer - Joseph Wenninger <jowenn at kde.org>


More information about the Kde-buildsystem mailing list