|
@@ -33,9 +33,9 @@ if(CPPCHECK_EXECUTABLE)
|
|
|
message("cppcheck version: ${CPPCHECK_VERSION}")
|
|
|
endif(CPPCHECK_EXECUTABLE)
|
|
|
|
|
|
-if(NOT TARGET analyse-all)
|
|
|
- add_custom_target(analyse-all)
|
|
|
- set_target_properties(analyse-all PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
|
|
+if(NOT TARGET cppcheck_analyse_all)
|
|
|
+ add_custom_target(cppcheck_analyse_all)
|
|
|
+ set_target_properties(cppcheck_analyse_all PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
|
|
endif()
|
|
|
|
|
|
# ::
|
|
@@ -63,7 +63,7 @@ endfunction()
|
|
|
|
|
|
# ::
|
|
|
#
|
|
|
-# add_cppcheck(<target>
|
|
|
+# target_add_cppcheck(<target>
|
|
|
# [ALL]
|
|
|
# [IGNORE_WARNINGS]
|
|
|
# [IGNORE_STYLE]
|
|
@@ -100,7 +100,7 @@ endfunction()
|
|
|
# include directories for a library, when it is being linked with an
|
|
|
# executable.
|
|
|
#
|
|
|
-function(add_cppcheck _target_name)
|
|
|
+function(target_add_cppcheck _target_name)
|
|
|
if(NOT TARGET ${_target_name})
|
|
|
message(FATAL_ERROR
|
|
|
"[CppCheck] add_cppcheck given a target name that does not exist: '${_target_name}' !")
|
|
@@ -124,8 +124,8 @@ function(add_cppcheck _target_name)
|
|
|
endif()
|
|
|
|
|
|
set(_cppcheck_args)
|
|
|
- list(APPEND _cppcheck_args "--xml")
|
|
|
- list(APPEND _cppcheck_args "--xml-version=2")
|
|
|
+ #list(APPEND _cppcheck_args "--xml")
|
|
|
+ #list(APPEND _cppcheck_args "--xml-version=2")
|
|
|
foreach(_cppcheck_opt ${CPPCHECK_PROJECT_OPTIONS})
|
|
|
list(APPEND _cppcheck_args ${_cppcheck_opt})
|
|
|
endforeach()
|
|
@@ -203,17 +203,28 @@ function(add_cppcheck _target_name)
|
|
|
get_target_property(_cppcheck_sources "${_target_name}" SOURCES)
|
|
|
|
|
|
list(APPEND _cppcheck_includes ${CPPCHECK_INCLUDES})
|
|
|
+ message(STATUS "[CppCheck] _cppcheck_includes:${_cppcheck_includes}")
|
|
|
|
|
|
set(_files)
|
|
|
foreach(_source ${_cppcheck_sources})
|
|
|
get_source_file_property(_cppcheck_lang "${_source}" LANGUAGE)
|
|
|
get_source_file_property(_cppcheck_loc "${_source}" LOCATION)
|
|
|
- if("${_cppcheck_lang}" MATCHES "^CXX$" OR "${_cppcheck_lang}" MATCHES "^C$" OR "${_cppcheck_lang}" MATCHES "^CPP$")
|
|
|
+ if("${_cppcheck_lang}" MATCHES "^CXX$" OR "${_cppcheck_lang}" MATCHES "^C$")
|
|
|
list(APPEND _files "${_cppcheck_loc}")
|
|
|
message(STATUS "[CppCheck] append file: ${_cppcheck_lang}|${_cppcheck_loc}")
|
|
|
endif()
|
|
|
endforeach()
|
|
|
|
|
|
+ set(cppcheck_includes_arg)
|
|
|
+ foreach(dir ${_cppcheck_includes})
|
|
|
+ if(NOT cppcheck_includes_arg)
|
|
|
+ set(cppcheck_includes_arg "-I ${dir}")
|
|
|
+ else()
|
|
|
+ set(cppcheck_includes_arg "${cppcheck_includes_arg} -I ${dir}")
|
|
|
+ endif()
|
|
|
+ endforeach()
|
|
|
+ message(STATUS "[CppCheck] cppcheck_includes_arg:${cppcheck_includes_arg}")
|
|
|
+
|
|
|
if (CPPCHECK_MODULE_DIRECTORY_STRUCTURE)
|
|
|
set(cppcheck_target ${_module_cppcheck_tgt}-${_target_name})
|
|
|
set(cppcheck_report_file ${CPPCHECK_REPORT_DIR}/${_module_name}-${_target_name})
|
|
@@ -229,9 +240,9 @@ function(add_cppcheck _target_name)
|
|
|
endif()
|
|
|
|
|
|
if(MSVC)
|
|
|
- set(COMMAND_SCRPIT ${CMAKE_SOURCE_DIR}/cmake/scripts/cppcheck-wrapper/win.bat)
|
|
|
+ set(COMMAND_SCRPIT ${CMAKE_SOURCE_DIR}/addin/cmake/scripts/cppcheck-wrapper/win.bat)
|
|
|
else()
|
|
|
- set(COMMAND_SCRPIT ${CMAKE_SOURCE_DIR}/cmake/scripts/cppcheck-wrapper/uos.sh)
|
|
|
+ set(COMMAND_SCRPIT ${CMAKE_SOURCE_DIR}/addin/cmake/scripts/cppcheck-wrapper/uos.sh)
|
|
|
endif(MSVC)
|
|
|
|
|
|
add_custom_target(
|
|
@@ -239,10 +250,7 @@ function(add_cppcheck _target_name)
|
|
|
COMMAND
|
|
|
${COMMAND_SCRPIT}
|
|
|
${CPPCHECK_EXECUTABLE}
|
|
|
- ${_cppcheck_check_config}
|
|
|
"${_cppcheck_includes}"
|
|
|
- "${CPPCHECK_EXCLUDED_HEADERS}"
|
|
|
- ${cppcheck_report_file}
|
|
|
${CPPCHECK_QUIET_ARG}
|
|
|
${CPPCHECK_TEMPLATE_ARG}
|
|
|
${_cppcheck_args}
|
|
@@ -250,13 +258,14 @@ function(add_cppcheck _target_name)
|
|
|
WORKING_DIRECTORY
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}"
|
|
|
COMMENT
|
|
|
- "${cppcheck_target}: Running cppcheck on target ${_target_name}..."
|
|
|
- VERBATIM)
|
|
|
+ "[CppCheck] ${cppcheck_target}: Running cppcheck on target ${_target_name}..."
|
|
|
+ VERBATIM
|
|
|
+ )
|
|
|
|
|
|
|
|
|
- set_target_properties(${cppcheck_target} PROPERTIES FOLDER "Code Analysis")
|
|
|
+ set_target_properties(${cppcheck_target} PROPERTIES FOLDER "CodeAnalysis")
|
|
|
|
|
|
- add_dependencies(analyse-all ${cppcheck_target})
|
|
|
+ add_dependencies(cppcheck_analyse_all ${cppcheck_target})
|
|
|
|
|
|
if (CPPCHECK_MODULE_DIRECTORY_STRUCTURE)
|
|
|
add_dependencies(${_module_cppcheck_tgt} ${cppcheck_target})
|