CMake和CCMake的区别 -- cmake-curses-gui

来源:互联网 发布:哔哩哔哩录制软件 编辑:程序博客网 时间:2024/04/28 18:43

上一篇:“Install CMake”中已经安装好CMake,本文安装CCMake。


自从2年前一起接触了CMake和CCMake这两个概念,一直机械性的重复着使用那一套编译路子。从没仔细研究过这2者有什么区别?今天重装环境,偶然查了会,了解到CCMake is the GUI for manipulating files generated by / used by the cmake system.


网友这么总结:

ccmake is curses (terminal handling library) interface to CMake.

cmake is the CLI (Command Line Interface)


事实上有三个相关概念:

cmake:   A command line interface (CLI).

ccmake: An ncurses (terminal) GUI. (only available on Unix-like systems)

cmake-gui: A Qt-based GUI.


cmake is a console program so you need to fire up a console to use it. Then, in the console, switch to your designated build directory. If it doesn't exist yet, create it. The most basic form of calling cmake looks like this:


cmake /path/to/source/dir


cmake stores a lot of configuration settings in the project’s cache. This cache can be viewed and edited using the CMake GUI. This can be quite useful for seeing how a project is configured as the settings are presented in a nice list. You can also change these values so you can set your build type to “Release” to make a release build or you can add specific compiler flags.



Like cmake, ccmake is a console program, but it uses ncurses to make editing the cache variables more accessible. It inherits cmake's command line options, so anything said above about cmake essentially also applies to ccmake. To start, type


ccmake /path/to/source/dir


You will be presented with a ncurses UIwhich lets you edit the contents of the CMake cache. Use the cursor keys to navigate to any variable you want to change, then press Enter. If the variable is boolean, this will switch its state from ON to OFF or vice versa. Otherwise you can type in the new value of the variable and press Enter again to finish your edit. A short help text to each variable is displayed at the bottom in a status bar. Once you are done, press 'c' to reconfigure the build, then press 'g' to generate the native build system and exit ccmake. If you want to quit without generating, press 'q'.

By default, ccmake only displays a part of the available cache variables. Others may be marked as advanced settings and will only be shown to you if you press 't' - this toggles the display of advanced variables.



cmake-gui is a true graphical frontend for CMake, that is you don't have to mess with command line options. Once you've started cmake-gui, it will look similar to the first picture below. The first thing to do is to tell it the location of the source and build directories which is done via the two path selectors at the top.



摘录自:

https://secure.mash-project.eu/wiki/index.php/CMake:_Getting_Started#ccmake



参考:

http://johnlamp.net/cmake-tutorial-3-gui-tool.html         (讲的非常好,有空学习、翻译一下)

http://www.itk.org/Wiki/ITK/Configuring_and_Building   


CCMake的安装:

CCMake包含在cmake-curses-gui包中,所以安装很简单,已安装完CMake以后,只需执行如下命令:

sudo apt-get install cmake-curses-gui

即可完成CCMake的安装。
1 0
原创粉丝点击