TheLartians/Format.cmake

Add more information about `CMAKE_FORMAT_EXCLUDE`

mscofield0 opened this issue · 2 comments

The readme doesn't specify how to properly set the option. Should the list be semicolon-delimited, space-delimited? Currently both delimiters don't get errored in CMake, but neither work.

Please add a bit more information about the option in the readme.

Thanks in advance!

I was also wondering the same. I looked up the code that is checking this (https://github.com/TheLartians/Format.cmake/blob/master/cmake-format.cmake#L18 ), and it's using a regex. so I used https://cmake.org/cmake/help/v3.6/command/string.html#regex-match for reference

For example, using the following command it excludes any file in cmake/ directory, any file in _deps/ directory, and the file cpm-package-lock.cmake:

include(cmake/CPM.cmake)

cpmaddpackage(
  NAME
  Format.cmake
  VERSION
  1.7.0
  GITHUB_REPOSITORY
  TheLartians/Format.cmake
  OPTIONS
  # set to yes skip cmake formatting
  "FORMAT_SKIP_CMAKE NO"
  # path to exclude (optional, supports regular expressions)
  "CMAKE_FORMAT_EXCLUDE (cmake/.*|_deps/.*|cpm-package-lock\.cmake)"
)

Thanks for the help!