[CMake] Adding MIME-types and .desktop files using CMake

Amir Pakdel pakdel at gmail.com
Tue Sep 7 00:45:53 EDT 2010


Hi developers,

I am trying to add a MIME type for "Basket Note Pads" files so that
Desktop Environments (KDE and GNOME) can recognise them. For that
purpose, I created a basket.xml and included the MIME type in the
basket.desktop file; then, I have added the MIME
type and associated this MIME type with the basket.desktop using the
following commands:

xdg-mime install --novendor basket.xml
xdg-desktop-menu install --novendor basket.desktop
xdg-mime default basket.desktop application/x-basket-item

This procedure seems work fine, but I cannot add it to the CMake. I
mean, I cannot do it automatically during installation via CMake
rules.

Below is basket.xml:
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
  <mime-type type="application/x-basket-item">
    <sub-class-of type="text/xml"/>
    <sub-class-of type="application/xml"/>
    <comment>Basket Note Pads</comment>
    <icon>basket</icon>
    <glob pattern=".basket" weight="50" />
    <magic priority="90">
        <match type="string" offset="2" value="xml">
          <match type="string" offset="39" value="!DOCTYPE basket>"/>
        </match>
    </magic>
    <root-XML localName="basket" />
  </mime-type>
</mime-info>


And this is the basket.desktop file:
[Desktop Entry]
Type=Application
Exec=basket %f
MimeType=application/x-basket-archive;application/x-basket-template;application/x-basket-item;
Icon=basket
Categories=Qt;KDE;Office;
X-DBUS-StartupType=Unique
Name=BasKet Note Pads
GenericName=Multi-Purpose Notepad
Comment=Taking care of your ideas.





Can anyone help me please.

Cheers,

Amir


More information about the CMake mailing list