hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# additional target to perform cppcheck run, requires cppcheck
 
# get all project files
# HACK this workaround is required to avoid qml files checking ^_^
file(GLOB_RECURSE ALL_SOURCE_FILES *.cpp *.h)
foreach (SOURCE_FILE ${ALL_SOURCE_FILES})
    string(FIND "${SOURCE_FILE}" "${PROJECT_THIRDPARTY_DIR}" PROJECT_THIRDPARTY_DIR_FOUND)
    if (NOT ${PROJECT_THIRDPARTY_DIR_FOUND} EQUAL -1)
        list(REMOVE_ITEM ALL_SOURCE_FILES ${SOURCE_FILE})
    endif ()
endforeach ()
 
add_custom_target(
    cppcheck
    COMMAND /usr/bin/cppcheck
    --enable=warning,performance,portability,information,missingInclude
    --std=c++11
    --language=c++
    --library=std.cfg
    --template="[{severity}][{id}] {message} {callstack} \(On {file}:{line}\)"
    --verbose
    --quiet
    ${ALL_SOURCE_FILES}
)