cmake-format

Endless_daydream Lv4

安装

1
2
3
4
5
# apt
sudo apt install cmake-format

# pip
pip install cmake_format # 没错是下划线

使用

格式化非CMakeLists.txt文件会报错

1
2
3
4
5
cmake-format CMakeLists.txt # 默认打印到标准输出

cmake-format -i CMakeLists.txt # 替换原文件

find -name 'CMakeLists.txt' | cmake-format -i # 接受标准输入
1
2
# 生成格式化规则
cmake-format --dump-config json > ~/.cmake-format.json

vscode使用

安装插件

格式化快捷键Ctrl+Shift+I

  • Title: cmake-format
  • Author: Endless_daydream
  • Created at : 2024-05-02 20:13:55
  • Updated at : 2024-05-02 20:22:05
  • Link: https://endless_daydream.gitee.io/2024/05/02/cpp/cmake-format/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments
On this page
cmake-format