Skip to content

Commit

Permalink
use globally defined varible for cppcheck include dirs (#125)
Browse files Browse the repository at this point in the history
* use globally defined varible for cppcheck include dirs

Signed-off-by: Karsten Knese <karsten@openrobotics.org>

* update docblock

Signed-off-by: Karsten Knese <karsten@openrobotics.org>

period
  • Loading branch information
Karsten1987 committed Feb 12, 2019
1 parent 4f9bfc0 commit e08e905
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ if(_source_files)

# Get include paths for added targets
set(_all_include_dirs "")
if(DEFINED ament_cmake_cppcheck_ADDITIONAL_INCLUDE_DIRS)
list(APPEND _all_include_dirs ${ament_cmake_cppcheck_ADDITIONAL_INCLUDE_DIRS})
endif()

# BUILDSYSTEM_TARGETS only supported in CMake >= 3.7
if(NOT CMAKE_VERSION VERSION_LESS "3.7.0")
get_directory_property(_build_targets DIRECTORY ${CMAKE_SOURCE_DIR} BUILDSYSTEM_TARGETS)
Expand Down Expand Up @@ -59,5 +63,6 @@ if(_source_files)
endforeach()
endif()

message(STATUS "Configured cppcheck include dirs: ${_all_include_dirs}")
ament_cppcheck(INCLUDE_DIRS ${_all_include_dirs})
endif()
4 changes: 4 additions & 0 deletions ament_cmake_cppcheck/cmake/ament_cppcheck.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
#
# Add a test to perform static code analysis with cppcheck.
#
# The include dirs for cppcheck to consider can either be set by the function
# parameter 'INCLUDE_DIRS` or by a global variable called
# 'ament_cmake_cppcheck_ADDITIONAL_INCLUDE_DIRS'.
#
# :param TESTNAME: the name of the test, default: "cppcheck"
# :type TESTNAME: string
# :param LANGUAGE: the language argument for cppcheck, either 'c' or 'c++'
Expand Down

0 comments on commit e08e905

Please sign in to comment.