CMake .desktop file on Ubuntu

This is probably a really simple thing to do, but on Linux (Ubuntu), if I download a CMake binary distribution from https://cmake.org/download/, is there a quick simple step to run to get the .desktop file installed and working correctly?

I see there is one included in share/applications/cmake-gui.desktop, but it’s not completely clear to me what I need to do with this. I’ve tried running desktop-file-install --dir=$HOME/.local/share/applications cmake-gui.desktop to copy it to the right spot, but it doesn’t get picked up after that.

I’ve created a cmake-gui.desktop file manually, which I can get to work, but annoyingly I can’t get the icon to show up :see_no_evil:

If anyone has a quick description of how to achieve this I’d really appreciate it. Thanks!

I think icons need installed in a standard search location as well to be referred to by name. For the same reason, I think desktop-file-install doesn’t quite understand that the application is not being relocated as well; there may be flags you can use for that.

Hi @ben.boeckel,

Thanks for getting back to me about this, I fortunately found a workaround that worked for me.

I created a cmake-gui.desktop file in my home directory that looks like the following:

[Desktop Entry] 
Name=CMake GUI 
Comment=Graphical interface for CMake 
Exec=/opt/cmake-3.28.1-linux-aarch64/bin/cmake-gui 
Icon=/opt/cmake-3.28.1-linux-aarch64/share/icons/hicolor/128x128/apps/CMakeSetup.png 
Terminal=false 
Type=Application 
Categories=Development 

Where Exec and Icon refer to the installed location of CMake GUI and the CMakeSetup.png icon. I then run:

desktop-file-install --dir=$HOME/.local/share/applications ~/cmake-gui.desktop 
update-desktop-database ~/.local/share/applications 

To install the desktop file to $HOME/.local/share/applications and then refresh that folder to populate the icons.

It might not be the most idiomatic usage but worked well for me, hopefully it might be useful to someone else potentially.

Thanks!