title: Specify an icon and Menu entry for cmake- cpack application
body: <p>I am trying to create and install package (.deb &amp; .rpm too) for an application I am developing, using CMake and CPack. The package gets created nice and well, however I don't get an entry in the KDE menu after running the dpkg -i mypackage.deb.</p>
  
  <p>Here are the steps I am doing:</p>
  
  <p>Excerpt from CMakeLists.txt:</p>
  
  <pre><code>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} &lt;${CPACK_PACKAGE_CONTACT}&gt;")
      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 ( &gt;= 4.6 ), libqt4-xml ( &gt;= 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)
  </code></pre>
  
  <p>The ddm.desktop looks like:</p>
  
  <pre><code>[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
  </code></pre>
  
  <p>And the ddm.xml looks like:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"&gt;
   &lt;mime-type type="application/x-ddm-item"&gt;
      &lt;sub-class-of type="text/xml"/&gt;
      &lt;sub-class-of type="application/xml"/&gt;
      &lt;comment&gt;Database Deployment Manager solution file&lt;/comment&gt;
      &lt;icon&gt;ddm&lt;/icon&gt;
      &lt;glob pattern=".dmx" weight="50" /&gt;
      &lt;magic priority="90"&gt;
            &lt;match type="string" offset="2" value="!DOCTYPE DBM"/&gt;
      &lt;/magic&gt;
      &lt;root-XML localName="ddm" /&gt;
    &lt;/mime-type&gt;
   &lt;/mime-info&gt;
  </code></pre>
  
  <p>what happens now is that when I run the <code>sudo make install</code> the application installs itself in the menu (But without an icon) but when I run the <code>dpk -i package.deb</code> the application installs itself but does not create any kde menu entry...</p>
  
  <p>Any idea what am I doing wrongly?</p>