CMake —— 跨平台 编译 软件 & visual studio支持

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.

 

https://cmake.org/

 

https://en.wikipedia.org/wiki/CMake

软件开发方面CMake是一个跨平台的 免费和开源软件,用于构建自动化测试打包安装软件,使用独立于编译器的方法。[3] CMake 本身并不是一个构建系统;它生成另一个系统的构建文件。它支持目录层次结构和依赖于多个库的应用程序。它与原生构建环境结合使用,例如MakeQt CreatorNinjaAndroid Studio、Apple 的XcodeMicrosoft Visual Studio它具有最小的依赖关系,只需要在自己的构建系统上 使用C++编译器。

 

 

CMakeLists.txt [编辑]

CMake 具有相对简单的解释性命令式脚本语言。它支持变量、字符串操作方法、数组、函数/宏声明和模块包含(导入)。CMake 语言命令(或指令)cmake从名为CMakeLists.txt此文件指定源文件和构建参数,CMake 将它们放置在项目的构建规范(例如 Makefile)中。此外,.cmake-suffixed 文件可以包含 CMake 使用的脚本。[20]

要生成项目的构建文件,cmake请在终端中调用并指定包含CMakeLists.txt该文件包含一个或多个 . 格式的命令COMMAND(argument ...)

 

 

https://learn.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=msvc-170

 

Visual Studio 对 CMake 的本机支持使您能够在 Windows、Linux 的 Windows 子系统 (WSL) 以及来自同一 Visual Studio 实例的远程系统上编辑、构建和调试 CMake 项目。Visual Studio 直接使用CMake 项目文件(例如CMakeLists.txt)用于 IntelliSense 和浏览。cmake.exe由 Visual Studio 直接调用以进行 CMake 配置和构建。

 

posted @ 2022-10-28 11:38  PanPan003  阅读(240)  评论(0编辑  收藏  举报