[Qt-interest] How to write CMakeLists.txt when Q_OBJECT in xxx.cpp file
Guido Seifert
Wargand at gmx.de
Sat Jul 31 13:41:51 CEST 2010
What I do:
SET(YourProject_MOC_HDRS
${CMAKE_SOURCE_DIR}/xxx.h
}
QT4_WRAP_CPP(YourProject_MOC_SRCS ${YourProject_MOC_HDRS})
SET(YourProject_executable_SRCS
${CMAKE_SOURCE_DIR}/xxx.cpp
)
ADD_EXECUTABLE(YourProject
${YourProject_executable_SRCS}
${YourProject_MOC_SRCS}
)
Not sure if this is the most elegant method. I am still new to cmake.
But it works like a charm.
Guido
-------- Original-Nachricht --------
> Datum: Sat, 31 Jul 2010 19:33:02 +0800
> Von: "1+1=2" <dbzhang800 at gmail.com>
> An: qt-interest at trolltech.com
> Betreff: Re: [Qt-interest] How to write CMakeLists.txt when Q_OBJECT in xxx.cpp file
> Tranks for your answer, but this does not work.
>
> if i use qt4_automoc(xxx.cpp)
>
> i will get
>
> NMAKE : fatal error U1073: don't know how to make '..\xxx.h'
> or
> make[2]: *** No rule to make target `../xxx.h', needed by `xxx.moc'.
> Stop.
>
>
> Regards,
> Debao
> On Sat, Jul 31, 2010 at 6:22 PM, Andreas Pakulat <apaku at gmx.de> wrote:
> > On 31.07.10 16:58:38, 1+1=2 wrote:
> >> Hi,everyone
> >>
> >> I am new to cmake. I don't know how to write a CMakeList.txt file if
> >> Q_OBJECT in a "xxx.cpp" source file.
> >
> > You usually do a #include "moc_xxx.cpp" and let the qt4_automoc macro
> > handle the rest. Also this question would be better suited on the cmake
> > list ;)
> >
> > Andreas
> >
> > --
> > Accent on helpful side of your nature. Drain the moat.
> > _______________________________________________
> > Qt-interest mailing list
> > Qt-interest at trolltech.com
> > http://lists.trolltech.com/mailman/listinfo/qt-interest
> >
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
More information about the Qt-interest-old
mailing list