Skip to content

Commit d4b1d16

Browse files
Potential clang-format config (#87)
* Potential clang-format config * EOF --------- Co-authored-by: Fabian Greffrath <[email protected]>
1 parent 35f90b0 commit d4b1d16

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

.clang-format

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
Language: Cpp
3+
BasedOnStyle: Microsoft
4+
IndentAccessModifiers: false
5+
IndentCaseLabels: true
6+
IndentCaseBlocks: false
7+
IndentGotoLabels: false
8+
IndentPPDirectives: None
9+
IndentExternBlock: NoIndent
10+
IndentRequires: false
11+
UseTab: Always
12+
IndentWidth: 4
13+
TabWidth: 4
14+
SortIncludes: Never
15+
AlignEscapedNewlines: DontAlign
16+
ColumnLimit: 80
17+
Cpp11BracedListStyle: false
18+
---

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main)
2323
find_package(SDL2_mixer REQUIRED CONFIG REQUIRED COMPONENTS SDL2_mixer)
2424

2525
file(GLOB TARADINO_SOURCES "${PROJECT_SOURCE_DIR}/rott/*.c")
26+
file(GLOB TARADINO_HEADERS "${PROJECT_SOURCE_DIR}/rott/*.h")
2627

2728
if(WIN32 OR MSVC OR CMAKE_SYSTEM_NAME STREQUAL "Windows")
2829
list(APPEND TARADINO_SOURCES "${PROJECT_SOURCE_DIR}/misc/taradino.rc")
@@ -103,6 +104,14 @@ else()
103104
install(TARGETS taradino DESTINATION ${CMAKE_INSTALL_BINDIR})
104105
endif()
105106

107+
find_program(CLANGFORMAT_EXECUTABLE clang-format)
108+
if(CLANGFORMAT_EXECUTABLE)
109+
add_custom_target(clangformat
110+
COMMAND ${CLANGFORMAT_EXECUTABLE} -style=file -i ${TARADINO_SOURCES} ${TARADINO_HEADERS}
111+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
112+
)
113+
endif()
114+
106115
set(CPACK_GENERATOR ZIP)
107116
set(CPACK_PACKAGE_NAME ${TARADINO_EXEC})
108117
set(CPACK_SOURCE_GENERATOR TGZ ZIP)

0 commit comments

Comments
 (0)