Hello,

* dherr...@ll.mit.edu wrote on Tue, Mar 31, 2009 at 06:00:37PM CEST:
> I'm using Qt 4's moc to generate source files in an autotools project.
>
> The pattern looks something like
>
> cat <<_EOF > Makefile.am
> # Makefile fragment
> bin_PROGRAMS=test
> test_SOURCES=a.cpp b.cpp
> test_META=a.hpp b.hpp
> test_SOURCES+=$(test_META)
> test_LDADD = $(test_META:%.hpp=%_moc.$(OBJEXT))
>
> %_moc.cpp : %.hpp
>       $(QT_MOC) -o $@ $<
> _EOF
>
> This all works fine for building the project, but it doesn't track  
> dependencies for the moc source files properly.  The dependencies are  
> getting dropped in $(DEPDIR)/*_moc.Po, but the Makefile doesn't have any  
> lines which actually include them.

FWIW, here's what we do, and it's been working well.

Have manually written *.cpp files which contain as last line
   #include "file.moc"

with this in Makefile.am:

bin_PROGRAMS = foo
foo_SOURCES = $(sources) $(headers)
nodist_foo_SOURCES = $(moc_sources)
BUILT_SOURCES = $(moc_sources)
CLEANFILES = $(moc_sources)

SUFFIXES = .cpp .moc .h
.h.moc:
        $(MOC) -i $< -o $@

moc_sources = $(headers:.h=.moc)
headers = ...
sources = ...

Cheers,
Ralf


Reply via email to