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-guiis packaged as cmake-qt-gui. Install it with:
sudo apt-get install cmake-qt-gui
If you really need to build it from source do the following:
sudo apt-get update sudo apt-get build-dep cmake-qt-gui wget https://cmake.org/files/v3.11/cmake-3.11.0.tar.gz tar -xzf cmake-3.11.0.tar.gz cd cmake-3.11.0/ ./configure --qt-gui make -j5 bin/cmake-gui
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.
./bootstrap --qt-gui make make install
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.
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
cd cmake mkdir build cd build cmake ..
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 PATH_TO_QT with where your qt directory is, in my case PATH_TO_QT was just /home/myname/Qt.
I would advise against using relative paths or ~.
//Build Qt dialog for CMake BUILD_QtDialog:BOOL=ON QT_QMAKE_EXECUTABLE:FILEPATH=PATH_TO_QT/5.12.7/gcc_64/bin/qmake //The directory containing a CMake configuration file for Qt5Core. Qt5Core_DIR:PATH=PATH_TO_QT/5.12.7/gcc_64/lib/cmake/Qt5Core //The directory containing a CMake configuration file for Qt5Widgets. Qt5Widgets_DIR:PATH=PATH_TO_QT/5.12.7/gcc_64/lib/cmake/Qt5Widgets
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
7. Install the built cmake
- You may be tempted to remove the apt version of cmake before doing this, but it appears that (for some reason), the install part of the cmake requires cmake to be installed to... install cmake.
sudo make install
8. Final operations
sudo make installdoes not replace the version of cmake stored in /usr/bin, unfortunately.
There may be a cleaner way to accomplish this step.
cmake --versionto 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
sudo mv /usr/bin/cmake /usr/bin/cmake_old
Link our built version of cmake into /usr/bin/
sudo ln -s /usr/local/bin/cmake /usr/bin/cmake
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.
cmake-gui to start the UI
Tested on Ubuntu Mate 18.04.1 x86_64
Cmake version I am trying to install: this commit, there's no particular significance to this, I just cloned the latest.
It's my opinion that this method should work if you are using the apt version of cmake to configure the latest version of cmake during this entire process. If this doesn't work, let me know in the comments.
In my case (like the OP), I am looking to go back and build cmake-gui after already installing building the latest version of cmake from source.
Thus, in the (IMO unlikely) chance that the part of the script that builds cmake-gui needs the latest version of cmake to build cmake, but the rest of the build was OK with the apt version, to exactly replicate the steps I did here, you could build cmake with the apt version, then re-configure with the latest built version of cmake, and build again.