Qt和Kde4在运行CMake后运行make

时间:2011-02-02 18:47:59

标签: qt qt4 cmake kde kdevelop

我正在尝试构建自己的插件以与KDevelop一起使用。我可以CMake并构建一个Makefile,但是当我运行make时,我得到很多与它相关的错误,而不是从Qt中找到任何东西,例如“QString没有指定类型。是否需要添加一些内容以便我的KDE插件能够用Qt构建?

错误:

/usr/include/KDE/../kurl.h:27:27: error: QtCore/QVariant: No such file or directory
/usr/include/KDE/../kurl.h:28:23: error: QtCore/QUrl: No such file or directory
In file included from /usr/include/kconfig.h:27,
                 from /usr/include/ksharedconfig.h:25,
                 from /usr/include/KDE/../kcomponentdata.h:23,
                 from /usr/include/KDE/KComponentData:1,
                 from /usr/include/vcs/dvcs/dvcsplugin.h:26,
                 from /home/charlesj/devKDevelopPlugin/CSCMKPlugin.h:8,
                 from /home/charlesj/devKDevelopPlugin/moc_KPlugin.cpp:10,

以及关于QGlobal QObject等的更多相似内容。

这是我的CMakeListst.txt

project(kdev)
find_package( KDE4 REQUIRED )
include(KDE4Defaults)
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
########### next target ###############

set(kdev_PART_SRCS
    KPlugin.cpp
)

kde4_add_plugin(kdev ${kdev_PART_SRCS})



target_link_libraries(kdev ${KDE4_KIO_LIBS}
    ${KDE4_KPARTS_LIBS}
    kdevplatformutil
    kdevplatforminterfaces
    kdevplatformvcs
    kdevplatformproject
    kdevplatformlanguage
)

install(TARGETS kdev DESTINATION ${PLUGIN_INSTALL_DIR} )


########### install files ###############
install( FILES kdev.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install( FILES kdev.rc DESTINATION ${DATA_INSTALL_DIR}/kdev )

这只是一个试图让KDevelop加载我的插件的骨架程序。 再次感谢。

1 个答案:

答案 0 :(得分:1)

你似乎已经找到了,你需要告诉CMake在哪里找到Qt标题,即:

include_directories( ${QT_INCLUDES} )