cmakelist文件format

发布时间 2023-10-11 19:06:39作者: pomolnc

这里主要是希望在 vscode 中编写 CMakeList.txt 过程中,对 [[cmake]] 语言进行 format 处理。
首先在 vscode 中安装 cmake-format 插件
cmake-format - Visual Studio Marketplace

然后需要安装 cmake-format.exe 程序。这里需要使用 [[Python]] 进行安装:

pip install cmake_format

这里比较坑的是,cmake-format.exe 并没有安装到 miniconda3\lib\site-packages 里面去,而是安装到了 Miniconda3\Scripts 路径下面。

然后在 vscode 中设置路径:

完成后,回到 CMakeList.txt 中,使用快捷键 alt+shift+F 即可格式化。

Reference

在vscode中使用cmake-format(windows端) - 知乎 (zhihu.com)