File: fix-codestyle.cmake

package info (click to toggle)
psi-plus 1.4.1456-2.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 26,188 kB
  • sloc: cpp: 211,254; ansic: 19,786; javascript: 13,687; xml: 4,056; sh: 1,610; makefile: 437; objc: 407; python: 277; ruby: 171
file content (31 lines) | stat: -rw-r--r-- 761 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
cmake_minimum_required( VERSION 3.1.0 )

#Find clang-format binary
find_program(CLF_BIN clang-format DOC "Path to clang-format binary")
if(CLF_BIN)
    #Obtain list of source files
    file(GLOB_RECURSE SRC_LIST
        *.c
        *.cc
        *.cpp
        *.hpp
        *.h
        *.mm
        ../qcm/*.qcm
    )
    foreach(src_file ${SRC_LIST})
        #Exclude libpsi
        if("${src_file}" MATCHES ".*/libpsi/.*")
            list(REMOVE_ITEM SRC_LIST ${src_file})
        endif()
    endforeach()
    add_custom_target(fix-codestyle
        COMMAND ${CLF_BIN}
        --verbose
        -style=file
        -i ${SRC_LIST}
        WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
        COMMENT "Fix codestyle with clang-format"
        VERBATIM
    )
endif()