[CMake] [Help] Build Qt Plugin with CMake
Yang, Y.
Y.Yang at tue.nl
Mon Feb 4 04:40:45 EST 2008
My plugin interface declaration is:
interface.h
#ifndef INTERFACES_H
#define INTERFACES_H
#include <QtPlugin>
#include <QString>
class MyPluginInterface {
public:
//virtual ~MyPluginInterface() {
//}
virtual QString name() const = 0;
};
Q_DECLARE_INTERFACE(MyPluginInterface,
"com.trolltech.PlugAndPaint.MypluginInterface/1.0")
#endif
My plugin declaration is:
Myplugin.h
#ifndef MYPLUGIN_H
#define MYPLUGIN_H
#include "interface.h"
class MyPlugin: QObject,MyPluginInterface
{
Q_OBJECT
Q_INTERFACES(MyPluginInterface)
public:
QString name();
private:
QString mName;
};
#endif
and myplugin.cpp
#include "interface.h"
#include "myplugin.h"
QString MyPlugin::name()
{
return mName;
}
________________________________
From: Tomasz Piotrowski [mailto:tomaszpio at gmail.com]
Sent: Monday, February 04, 2008 9:20 AM
To: Yang, Y.
Subject: Re: [CMake] [Help] Build Qt Plugin with CMake
How do you define plugin interface. I'v also use cmake to generate Qt
plugins and it's works.
Add your headers then we can say more. It's also important that your
application and plugin should use the same Qt version.
2008/2/3, Yang, Y. <Y.Yang at tue.nl>:
Hi All,
when I try to build a plugin with my qt application on windows,
I found that the dll build successfully, but when I launch my
application it failed with a message that myplugin.dll is not a valid Qt
plugin.
The following file is my CMakeLists.txt. Is there anything
wrong?
**************************************************
project(myplugin)
set(myplugin_SRCS
myplugin.cpp
)
set(myplugin_MOC_HDRS
myplugin.h
)
include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../../core)
add_definitions(${QT_DEFINITIONS})
add_definitions(-DQT_PLUGIN)
add_definitions(-DQT_SHARED)
add_definitions(-DQT_NO_DEBUG)
qt4_wrap_cpp(myplugin_MOC_SRCS ${myplugin_MOC_HDRS})
add_library(myplugin SHARED ${myplugin_SRCS}
${myplugin_MOC_SRCS})
target_link_libraries(myplugin ${QT_LIBRARIES}
${QT_QTXML_LIBRARY} mycore)
_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20080204/a85f0635/attachment-0001.htm
More information about the CMake
mailing list