Added a cppcheck rule to the "all" target

- Travis: apt-get install cppcheck
This commit is contained in:
Sébastien Rombauts 2013-10-24 06:58:38 +02:00
parent c93b461628
commit 1af6930fc7
3 changed files with 15 additions and 2 deletions

View File

@ -4,6 +4,10 @@ compiler:
- gcc
- clang
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq cppcheck
# using a symbolic link to get the "make test" to work as if launched from the root directorys
before_script:
- mkdir build

View File

@ -27,6 +27,13 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
add_definitions (-rdynamic -fstack-protector-all -Wall -Wextra -pedantic -Weffc++ -Wformat-security -Winit-self -Wswitch-default -Wswitch-enum -Wfloat-equal -Wundef -Wshadow -Wcast-qual -Wconversion -Wlogical-op -Winline -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn)
endif ()
# add a cppcheck target to the "all" target
add_custom_target(cppcheck
ALL
COMMAND cppcheck -j 4 cppcheck --enable=style,portability,performance,information --quiet --template='{file}:{line}: warning: cppcheck: {message} [{severity}/{id}]' src
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
################################################################################
# add the subdirectory containing the CMakeLists.txt of the wrapper library
add_subdirectory (src)

View File

@ -39,7 +39,7 @@ SQLITE_EXAMPLE1_OBJECTS = \
### Targets: ###
all: $(BUILD) $(BUILD)/example1
all: $(BUILD) $(BUILD)/example1 cppcheck
clean:
rm -f $(BUILD)/*.o
@ -69,8 +69,10 @@ $(BUILD)/Statement.o: src/Statement.cpp
$(BUILD)/Transaction.o: src/Transaction.cpp
$(CXX) -c -o $@ $(SQLITE_CXXFLAGS) $(CPPDEPS) $<
cppcheck:
cppcheck -j 4 cppcheck --enable=style --quiet --template='{file}:{line}: warning: cppcheck: {message} [{severity}/{id}]' src
.PHONY: all clean
.PHONY: all clean cppcheck
# Dependencies tracking: