I tried downloading https://cmake.org/files/v3.11/cmake-3.11.0.tar.gz and building it, but there is no cmake-gui in ./bin subfolder after build. Is cmake-gui supplied in another source archive?
I tried downloading https://cmake.org/files/v3.11/cmake-3.11.0.tar.gz and building it, but there is no cmake-gui in ./bin subfolder after build. Is cmake-gui supplied in another source archive?
Two options here:
cmake-gui
is packaged as cmake-qt-gui. Install it with:If you really need to build it from source do the following:
Nothing else depends on cmake (probably) so it's a leaf node. Uninstall the deb. Get the latest source from https://cmake.org/ and unpack the tarball somewhere, cd into it.
Assuming you have the QT dev stuff installed. You end up with both regular command-line cmake and cmake-qui. Start them from the command line by typing cmake or cmake-gui, I don't know about adding to menus.
tested with cmake 3.20.1 on ubuntu 18.04 LTS
check installation of Qt5 before compiling (sudo apt install qt5-default)
if you already have cmake of lower version
else if no cmake in your system
Just in case you can't build cmake-gui because of problems with QT5 widgets, try the following:
apt install qt5-default
Process
In this particular process I decided to configure the latest version of cmake, with the apt version of cmake (sorry if this is confusing).
cmake-gui is compiled with the same repository as the cmake command line tool, but the default build configuration for cmake is not set up to build cmake-gui (neither the curses interface or the Qt interface).
To build cmake with cmake-gui, it's necessary to set some variables in the cmake build script. You might normally do this through the UI, but it's also possible to set these variables by manually editing CMakeCache.txt in the build directory, which is what I will show how to do in this answer.
CMake requires Qt, but it can't find it automatically, one of the things we need to do is show where the Qt CMake scripts are.
1. Install Qt (if you don't have it already)
Download the installer from Qt's website. In my case, I selected the latest version of 5.12 (at the time of writing, 5.12.7) and I installed it with all default settings.
You'll need to make an account with Qt to download the installer using this method; the account is free for open source users (which you are if you are using this to just build cmake for your own use; if you plan on using Qt for anything else you should verify if you can use this version).
I installed Qt to a folder named Qt in my home directory.
This installation process will take a while.
I think Qt might be available through apt, but for my purposes I needed the full download for another project, so I had it here anyway.
2. git clone the cmake sources from their git repository to somewhere (e.g., your home directory).
git clone https://gitlab.kitware.com/cmake/cmake.git
3. Make a build directory
That will, among other things, place a file named CMakeCache.txt in your build folder.
4. Edit CMakeCache.txt to configure the ui
Open this file in your text editor, and edit the following lines to enable the qt ui (I found these by searching for qt).
Note that you need to replace with where your qt directory is, in my case was just
/home/jrh/Qt5.12.11
.For example the Qt5Core_DIR directory for me (running Qt 5.12.11) was
/home/jrh/Qt5.12.11/5.12.11/gcc_64/lib/cmake/Qt5Core
I would advise against using relative paths or ~.
5. Re-run cmake .. in the build directory
6. Compile cmake (in the build directory)
Where N is the number of cores you want to compile, in my case I typed
make -j10
.7. Install the built cmake
8. Final operations
sudo make install
does not replace the version of cmake stored in /usr/bin, unfortunately.There may be a cleaner way to accomplish this step.
Use
cmake --version
to verify if you need to do this, if it gives the version that came with apt (for me at the time of writing, 3.10.2), you will need to do this.You should also verify that your version of cmake is in /usr/local/bin/
I needed to do the following:
Rename the apt installed cmake binary
Link our built version of cmake into /usr/bin/
I was not expecting to need to link the new version of cmake into /usr/bin/, since /usr/local/bin should be in PATH; for some reason, it would stubbornly only look for cmake in /usr/bin, and give me an error saying that /usr/bin/cmake was not found even though the latest version of cmake was available in /usr/local/bin.
I guess it's possible that a reset of bash or a reboot could have fixed the need for linking, but I am not sure.
Type
cmake-gui
to start the UICool!
Notes