2
我正嘗試使用CMake和CPack爲我正在開發的應用程序創建和安裝軟件包(.deb & .rpm)。該軟件包創建的很好,但是在運行dpkg -i mypackage.deb後,我沒有在KDE菜單中找到條目。爲cmake-cpack應用程序指定一個圖標和菜單項
下面是我做的步驟:
摘自的CMakeLists.txt:
SET(CMAKE_INSTALL_PREFIX /opt/ddm)
SET(DDM_DESKTOP_DIR ${CMAKE_INSTALL_PREFIX}/${DDM_DATA_SUBDIR}/applications/)
SET(DDM_PIXMAPS_DIR ${CMAKE_INSTALL_PREFIX}/${DDM_DATA_SUBDIR}/pixmaps/)
INSTALL (FILES share/ddm.desktop DESTINATION ${DDM_DESKTOP_DIR})
INSTALL (FILES share/ddm.xml DESTINATION ${DDM_DESKTOP_DIR})
# Copy the ddm pixmap
INSTALL (FILES share/ddm.png DESTINATION ${DDM_PIXMAPS_DIR})
# try to set up the menu system
find_program(XDG-MIME_EXECUTABLE xdg-mime)
find_program(XDG-DESKTOP-MENU_EXECUTABLE xdg-desktop-menu)
INSTALL(CODE "
execute_process(COMMAND ${XDG-MIME_EXECUTABLE} install --novendor ${DDM_DESKTOP_DIR}/ddm.xml)
execute_process(COMMAND ${XDG-DESKTOP-MENU_EXECUTABLE} install --novendor ${DDM_DESKTOP_DIR}/ddm.desktop)
execute_process(COMMAND ${XDG-MIME_EXECUTABLE} default ${DDM_DESKTOP_DIR}/ddm.desktop application/x-ddm-item)
"
)
# Debian packages
INCLUDE (${CMAKE_MODULE_PATH}/DpkgBuild.cmake)
IF(DPKG_FOUND AND NOT WIN32)
SET(CPACK_GENERATOR "DEB")
SET(CPACK_DEBIAN_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
SET(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR} <${CPACK_PACKAGE_CONTACT}>")
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
SET(CPACK_DEBIAN_PACKAGE_DEBUG ON)
SET(CPACK_DEBIAN_PACKAGE_DEPENDS ${PACKAGE_REQUIRES})
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt4-gui (>= 4.6), libqt4-xml (>= 4.6), libqt4-sql-mysql, libmysqlclient18, libqt4-dbus, libqt4-network, libqt4-sql, libqt4-sql-mysql, libqt4-xml, libqtcore4, libqtgui4, libqtwebkit4") # Specify dependencies here
SET(CPACK_SET_DESTDIR TRUE)
ENDIF(DPKG_FOUND AND NOT WIN32)
SET(CPACK_PACKAGE_EXECUTABLES "ddm" "DDM")
INCLUDE(CPack)
的ddm.desktop樣子:
[Desktop Entry]
Version=0.1
Name=Database Deployment Manager
Comment=Database Deployment manager
Exec=/opt/ddm/bin/ddm %U
Icon=ddm
Terminal=false
Type=Application
Categories=Qt;Development
MimeType=application/x-ddm-item;
GenericName=Database Deployment Manager
而且ddm.xml樣子:
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-ddm-item">
<sub-class-of type="text/xml"/>
<sub-class-of type="application/xml"/>
<comment>Database Deployment Manager solution file</comment>
<icon>ddm</icon>
<glob pattern=".dmx" weight="50" />
<magic priority="90">
<match type="string" offset="2" value="!DOCTYPE DBM"/>
</magic>
<root-XML localName="ddm" />
</mime-type>
</mime-info>
現在發生的事情是,當我運行sudo make install
時,應用程序將自行安裝到菜單中(但沒有圖標),但是當我運行dpk -i package.deb
時,應用程序會自行安裝,但不會創建任何kde菜單條目...
任何想法我在做什麼錯誤?