Added cppcheck to travis

This commit is contained in:
Linus_Probert 2018-03-12 14:55:09 +01:00
parent 2c803da0cd
commit f025a478b2
3 changed files with 11 additions and 1 deletions

View File

@ -22,7 +22,7 @@ before_install:
install: install:
- sudo apt-get install -y libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev - sudo apt-get install -y libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev
- sudo apt-get install -y cmake cmake-data check lua5.2 liblua5.2-dev - sudo apt-get install -y cmake cmake-data check lua5.2 liblua5.2-dev cppcheck
#g++6 #g++6
- if [ "$CXX" = "g++" ]; then sudo apt-get install -y g++-6; fi - if [ "$CXX" = "g++" ]; then sudo apt-get install -y g++-6; fi
@ -39,3 +39,4 @@ script:
- cmake .. - cmake ..
- make - make
- make test - make test
- make lint

View File

@ -77,6 +77,11 @@ if (NOT WIN32)
-Wmissing-prototypes -Wmissing-prototypes
-Wconversion -Wno-sign-conversion -Wconversion -Wno-sign-conversion
) )
add_custom_target(lint
COMMENT "Running cppcheck"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND cppcheck --language=c --error-exitcode=1 --template=gcc --enable=warning,performance,portability,information,missingInclude --quiet src/*
)
endif (NOT WIN32) endif (NOT WIN32)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")

View File

@ -13,3 +13,7 @@ test:
run: $(all) run: $(all)
@./build/breakhack @./build/breakhack
.PHONY: run .PHONY: run
lint:
@make lint -sC build
.PHONY: lint