Skip to content

Commit

Permalink
Fix include directory flags for codecheck (#186)
Browse files Browse the repository at this point in the history
The include directories of cppcheck need individual -I flags ahead of each directory.

Signed-off-by: Addisu Z. Taddese <[email protected]>
  • Loading branch information
azeey authored Sep 1, 2021
1 parent ae1bbbf commit e4aa0b0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmake/IgnCodeCheck.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,15 @@ function(ign_setup_target_for_codecheck)

message(STATUS "Adding codecheck target")

# Each include directory needs an -I flag
set(CPPCHECK_INCLUDE_DIRS_FLAGS)
foreach(dir ${CPPCHECK_INCLUDE_DIRS})
list(APPEND CPPCHECK_INCLUDE_DIRS_FLAGS "-I${dir}")
endforeach()

add_custom_target(cppcheck
# First cppcheck
COMMAND ${CPPCHECK_PATH} ${CPPCHECK_BASE} ${CPPCHECK_EXTRA} -I ${CPPCHECK_INCLUDE_DIRS} ${CPPCHECK_RULES} `${CPPCHECK_FIND}`
COMMAND ${CPPCHECK_PATH} ${CPPCHECK_BASE} ${CPPCHECK_EXTRA} ${CPPCHECK_INCLUDE_DIRS_FLAGS} ${CPPCHECK_RULES} `${CPPCHECK_FIND}`

# Second cppcheck
COMMAND ${CPPCHECK_PATH} ${CPPCHECK_BASE} --enable=missingInclude `${CPPCHECK_FIND}`
Expand Down

0 comments on commit e4aa0b0

Please sign in to comment.