Linux 的 CMake GUI 在哪里?

Where is the CMake GUI for Linux?

我在 Ubuntu Linux 上安装了 CMake。尝试 运行 在 Linux 中制作 GUI。我发现它在 Windows 中有效,但是在哪里可以得到它以及如何在 Linux 中 运行?

cmake 被记录为命令(键入 man cmake 并参见 cmake.org),因此它不应该有任何 GUI 界面:

DESCRIPTION

  The  "cmake" executable is the CMake command-line interface.  It may be
   used to configure projects in scripts.  Project configuration  settings
   may be specified on the command line with the -D option.

它只是生成一个 Makefile(供 make command 使用)。我不明白你期待什么样的 GUI。

在 Debian 和类似 Ubuntu 的衍生产品上,您可以安装 cmake-guicmake-qt-gui 软件包,然后 运行 cmake-gui 命令。

make往往是运行宁GCC. Try make -p to understand the default rules of GNU make... So read documentation of GNU make and of GCC (and probably of GDB).

更新: 从 CMake 3.7.2 开始,cmake-gui 仍未默认构建,但可以通过指定一个附加标志轻松添加到构建中。仍然需要 Qt,我使用的是 4.8,但我相信其他版本也能正常工作。

从网站下载源代码,解压到您选择的目录,然后运行在命令行输入以下内容:

  • ./bootstrap --qt-gui
  • gmake
  • gmake install(可选 - 如果需要请不要忘记 sudo)

嗨,太棒了! cmake-gui 现在与其他工具一起出现在 bin 目录中。

注意:如果构建过程以某种方式失败,只需检查错误消息并使用它!有太多的先决条件和变量,试图详细说明它们会使 post tl;dr 并且在提交之前就已经过时了(参见其他 post 中的一个示例这个)。


CMake 的基本安装

在linux下,默认安装来自cmake网站(至少3.5.1版)

和cmake安装在同一个地方,在我的机器上是:

/usr/local/bin/cmake-gui

我从源代码构建了我的 cmake,默认情况下,cmake-gui 没有构建。要添加为目标,必须设置以下变量:

BUILD_QtDialog

例如。 SET(BUILD_QtDialog TRUE) 应该这样做

注意:cmake-gui 基于 Qt,因此如果要构建它,您必须安装 Qt。

我也遇到了类似的问题。我做了类似的事情:

  1. 打开https://apps.ubuntu.com/cat/applications/precise/cmake-qt-gui/并在软件中心点击可用。
  2. 新 window 打开并单击安装
  3. 在终端上写cmake-gui

它解决了我的问题。

如果您从源代码构建最新版本,这比这里的其他人建议的要难得多。我终于找到了 this 让它工作:

First, download the source from: https://cmake.org/download/

More specifically for Ubuntu 14.04 or higher, 64 bit get: https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz

Download it to the following directory (or any directory you like!): /opt/dev-tools-sources

Unzip it there, using GUI archive manager or $ tar -zxvf cmake-3.5.2.tar.gz

You should have now a folder like this: /opt/dev-tools-sources/cmake-3.5.2


Go to this folder: $ cd /opt/dev-tools-sources/cmake-3.5.2

Install openssl to allow CMAKE have access to ssl protected websites if it needs to download extra files $ sudo apt install openssl libssl-dev

Edit the bootstrap file and change the line: cmake_options="-DCMAKE_BOOTSTRAP=1"

To this cmake_options="-DCMAKE_BOOTSTRAP=1 -DCMAKE_USE_OPENSSL=ON"

If you want cmake-gui, you will need qt4 libs an ncurses $ sudo apt install libqt4-dev qt4-dev-tools libncurses5-dev

Run the configuration (you need to have gcc and g++ 4.7 or higher installed. I recommend 4.8.4 or higher actually!) $ ./configure --qt-gui


Make sure in the generated CMakeCache.txt, GUI is set to TRUE, open CMakeCache.txt with any editor and check the following line: BUILD_QtDialog:BOOL=ON

If it was OFF or 0, make it ON or 1


It is time to build executables and libraries from source: $ make -j2

Now, install: $ sudo make install

Confirm you also got GUI version with $ cmake-gui

对于 Ubuntu(我猜还有更多 linux 版本):

 sudo apt-get install cmake-qt-gui

可以在安装后作为 cmake-gui 或使用 ubuntu GUI 启动(只需键入 cmake,它将显示典型的 cmake-gui-icon)

ccmake咒骂UI

sudo apt-get install cmake-curses-gui
cd build
ccmake ..

然后:

  • 编辑您的选项
  • 点击c更新缓存
  • q 退出

现在您可以使用新变量再次 make

在 Ubuntu 16.10、cmake 3.5.2 中测试。