[CMake] CMake with Qt (plus pkg-config)
Murray Cumming
murrayc at murrayc.com
Fri Oct 23 07:35:10 EDT 2009
Thanks everyone. I seem to have that working, though I'm still figuring
out how these various incantations work relate to each other.
On Thu, 2009-10-22 at 08:37 -0400, Bill Hoffman wrote:
> Murray Cumming wrote:
> > I'm trying to use CMake for the first time, as an experiment, with
> > little a Qt-based project. It also uses an additional library, via
> > pkg-config.
> >
> > So far Qt's include files don't seem to be found, and I wonder how I can
> > cause moc to be used to generate some of the .cc files.
> >
> > Here's what I have so far:
> > http://github.com/murraycu/qlom/blob/qlom_cmake/CMakeLists.txt
> > based on the many and varied google results.
> >
> > Can anyone give me some clues?
> >
> >
> There is this link here:
>
> http://qtnode.net/wiki/Qt_with_cmake
>
> Although that uses automoc which I don't like that much... :)
>
>
> The CMake cmake-gui program is a good example and can be seen here:
>
> http://public.kitware.com/cgi-bin/viewcvs.cgi/Source/QtDialog/CMakeLists.txt?revision=1.24&root=CMake&view=markup
>
> So, what you are missing is the moc step.
>
> QT4_WRAP_CPP(MOC_SRCS header1.h header2.h)
> add_executable(qlom ${QLOM_SOURCES} ${MOC_SRCS})
>
> The QT4_WRAP_CPP macro will call moc on all the files listed during
> build time and create the moc files. The names of the files that will
> be created are placed in the variable MOC_SRCS, which you then have to
> add to an executable or library target.
>
> -Bill
>
--
murrayc at murrayc.com
www.murrayc.com
www.openismus.com
More information about the CMake
mailing list