There is a number of configurable settings possible to provide in .cmake-tidy.json
configuration file.
The file is searched in following locations and order of precedence
-
location of
input_file
to be formatted -
parent locations of
input_file
-
current working directory of the tool (
cwd
)
Name | Type | Default Value | Detailed description |
---|---|---|---|
|
|
|
Describes the maximum number of succeeding newlines that can appear in formatted file. |
|
|
|
Dictates whether code indentation should be done using spaces ( |
|
|
|
When |
|
|
|
Convert all command invocations to lowercase (including keywords) eg. |
|
|
|
Insert space between command name and begin parentheses eg. |
|
|
|
Maximum line length that will not cause |
|
|
|
Wrap command invocations into single line when they fit in target_sources(${PROJECT_NAME}
PRIVATE
file1.cpp
) to: target_sources(${PROJECT_NAME} PRIVATE file1.cpp) |
|
|
|
Force closing parentheses to new line when command invocation splitting is needed. from: target_sources(${PROJECT_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/Source/file1.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Source/file2.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Source/file3.cpp) to: target_sources(${PROJECT_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/Source/file1.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Source/file2.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Source/file3.cpp
) |
|
|
|
Consider all unquoted uppercase arguments as keywords. eg.
SOME
TEXT_IS_KEYWORD treated as normal arguments: _SOME
TEXT__IS_KEYWORD
NOT_
a_ARGUMENT
SOMeARG |
|
|
|
Introduces spaces after all conditional invocations only eg. if (Linux STREQUAL ${CMAKE_SYSTEM_NAME})
target_sources(${PROJECT_NAME} PRIVATE file.cpp)
elseif (Windows STREQUAL ${CMAKE_SYSTEM_NAME})
target_sources(${PROJECT_NAME} PRIVATE different.cpp)
endif() |
|
|
|
Forces no splitting between property and value even if the line is too long. eg. set_property(
SOURCE
${CMAKE_CURRENT_SOURCE_DIR}/Source/File.cpp
PROPERTY
COMPILE_FLAGS $<$<CXX_COMPILER_ID:MSVC>:/Y-> # ignore precompiled headers
) |
|
|
|
Keeps add_custom_target(${target}-resources
ALL
COMMAND
${CMAKE_COMMAND} -E echo "Copy resource files for ${target}" Disabled: add_custom_target(${target}-resources
ALL
COMMAND
${CMAKE_COMMAND}
-E
echo
"Copy resource files for ${target}" |
|
|
|
Enforces keyword and its value to be in single line. Disabled: install(
FILES
file.cpp
file.hpp
DESTINATION
"include/folder"
) Enabled: install(
FILES
file.cpp
file.hpp
DESTINATION "include/folder"
) |
|
|
|
When splitting conditional invocation when enabled splits invocation before AND/OR operators: if(CMAKE_GENERATOR STREQUAL "Visual Studio 15 2017"
OR CMAKE_GENERATOR STREQUAL "Visual Studio 16 2019") Disabled: if(CMAKE_GENERATOR STREQUAL "Visual Studio 15 2017" OR
CMAKE_GENERATOR STREQUAL "Visual Studio 16 2019") |
|
|
|
Consider list of provided arguments as keywords when formatting. |