Trouble Building Qt4 Plugin - moc not being invoked?

Lindsay Mathieson lindsay.mathieson at
Sat Apr 28 09:48:09 BST 2012

On Sat, 28 Apr 2012 10:21:25 AM Andreas Pakulat wrote:
> You should use MODULE here not SHARED, since a plugin is not a shared
> library and usually doesn't get a soversion set or the version-symlinks.

Thanks, did not know that.

> More importantly though, since you use the basic CMake commands instead of
> the KDE wrappers, you need to add the moc-step yourself. You should use
> QT4_WRAP_CPP to do that and include the generated files into your plugin.
> This also means you need to remove a #include "kspellplugin.moc" in your
> cpp file if it exists.

Yup, just figured it out ! :) Now building and linking.

What are the KDE Wrappers?

cmake file now looks like:


find_package(KDE4 REQUIRED)

include (KDE4Defaults)

include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} )

SET(wk_SOURCES kspellplugin.cpp)
SET(wk_HEADERS kspellplugin.h qwebkitplatformplugin.h)


ADD_LIBRARY(kdewebkit-spellplugin MODULE ${wk_SOURCES} ${wk_HEADERS_MOC})

target_link_libraries(kdewebkit-spellplugin ${KDE4_KDEUI_LIBS} 

Thanks for all the help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the KDevelop mailing list