[CMake] CMake with Qt (plus pkg-config)
S Roderick
kiwi.net at mac.com
Thu Oct 22 08:15:27 EDT 2009
On Oct 22, 2009, at 06:15 , 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?
Try something like this
<code>
SET(SOURCES a.cpp b.cpp)
SET(UIS a.ui b.ui)
SET(MOC_HEADERS a.h b.h)
# generate sources from MOC headers
QT4_WRAP_CPP(MOC_SOURCES ${MOC_HEADERS})
# generate user-interface files
QT4_WRAP_UI(UIS_H ${UIS})
ADD_EXECUTABLE(gui ${SOURCES} ${MOC_SOURCES} ${UIS_H})
</code>
HTH
Stephen
More information about the CMake
mailing list