Skip to content

RobertIndie/Format.cmake

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Actions Status Actions Status

Format.cmake

clang-format for CMake

About

Format.cmake adds three additional targets to your CMake project.

  • format Shows which files are affected by clang-format
  • check-format Errors if files are affected by clang-format (for CI integration)
  • fix-format Applies clang-format to all affected files

To run the targets, invoke CMake with cmake --build <build directory> --target <target name>.

Demo

How to integrate

Using CPM.cmake (recommended)

Run the following from the project's root directory to add CPM to your project.

mkdir -p cmake
wget -O cmake/CPM.cmake https://raw.githubusercontent.com/TheLartians/CPM/master/cmake/CPM.cmake

Add the following lines to the project's CMakeLists.txt after calling project(...).

include(cmake/CPM.cmake)

CPMAddPackage(
  NAME Format.cmake
  GITHUB_REPOSITORY TheLartians/Format.cmake
  VERSION 1.3
)

Using git submodules (not suited for libraries)

Run the following from the project's root directory.

git submodule add https://github.com/TheLartians/Format.cmake 

In add the following lines to the project's CMakeLists.txt after calling project(...).

add_subdirectory(Format.cmake)

Dependencies

Format.cmake requires clang-format, CMake and python 2.7 or python 3.

About

clang-format targets for CMake

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 93.1%
  • CMake 5.8%
  • C++ 1.1%