【CMake】CMake GUI构建VS等项目

一、CMake官网(https://cmake.org/)上的介绍:

CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice. The suite of CMake tools were created by Kitware in response to the need for a powerful, cross-platform build environment for open-source projects such as ITK and VTK.

CMake是一个跨平台的构建、测试和打包的工具集,可以用特定的语句来描述所有平台的编译过程,指导编译。CMake 的组态档为 CMakeLists.txt,使用此文件指导项目构建,换句话说就是,拥有这个文件的项目可以使用CMake进行构建。Cmake 并不直接建构出最终的软件,而是产生标准的建构档(如 Unix 的 Makefile 或 Windows Visual C++ 的 projects/workspaces),然后再依一般的建构方式使用,如,通过CMake可以将项目源码构建成Visual Studio等项目。

wiki介绍https://en.wikipedia.org/wiki/CMake   https://zh.wikipedia.org/wiki/CMake

CMake是一个开源工具集,github源码https://github.com/Kitware/CMake

二、[基础] 使用

CMake可以直接从官网下载ZIP,根据操作系统环境选择https://cmake.org/download/

解压后可以通过其提供的GUI工具来使用,位于bin目录下:如cmake-3.9.0-rc4-win64-x64\bin\cmake-gui.exe

bin目录:

CMake GUI由Qt开发;

界面:

 

GUI的基本用法:

1 选择CMake所在目录,

2 选择构建的项目输出目录,

构建好的项目需要和源码目录配合使用;

3 选择好目录后,点击下方Configure按钮配置项目,

点击后首次配置需要选择想要构建的项目:

4 然后,进行项目的配置,配置完毕中间的窗口出现红色的提示文本:

5 再次点击Configure,提示文本背景变成白色,配置完毕:

6 最后点击Generate按钮,

等待项目构建完毕:

构建完毕的项目可以导入IDE,或使用gcc等工具进行编译。

 

总之,GUI的使用:选择源码和输出目录,进行两次Configure,然后进行一次Generate。

 

CMake基本使用方法介绍完毕。

 

posted @ 2017-06-27 14:22  esCharacter  阅读(8913)  评论(0编辑  收藏  举报