clang-format
Having ported my projects and workflows to cmake based CLion I’m trying to add some more automation to the development and building process. Today I managed to integrate 2 awesome tools into the process.
cppcheck
clang-format
Both can be installed via homebrew and configuration is fairly simple, assuming you want to use some predefined style. For your own set of rules the configuration might be a bit more complex.
Here’s how my CMakeLists.txt entries look like:
add_custom_target(cppcheck WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND /usr/local/bin/cppcheck --enable=warning,performance,portability,information,missingInclude --std=c++11 --library=qt.cfg --template="[{severity}][{id}] {message} {callstack} \(On {file}:{line}\)" --verbose --quiet ${SOURCE_FILES} ) add_custom_target(clangformat WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND /usr/local/bin/clang-format -style=WebKit -i ${SOURCE_FILES})













