Skip to content

Commit

Permalink
Have to have absolute path. Refs #4368.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterfpeterson committed Dec 29, 2011
1 parent 0ba8c4a commit 36f9f86
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Code/Mantid/Build/CMake/FindCppcheck.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,12 @@ function(add_cppcheck _name) # additional arguments are files to ignore
if(CPPCHECK_EXECUTABLE)
get_target_property(_cppcheck_sources "${_name}" SOURCES)
set(_files)
set(_files_absolute)
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")
list(FIND _cppcheck_ignores "${_cppcheck_loc}" _cppcheck_ignore_index)
if (_cppcheck_ignore_index LESS 0)
list(APPEND _files_absolute "${_cppcheck_loc}")
string ( REGEX REPLACE "^${CMAKE_SOURCE_DIR}/?" "" _cppcheck_loc "${_cppcheck_loc}" )
list(APPEND _files "${_cppcheck_loc}")
endif (_cppcheck_ignore_index LESS 0)
endif()
Expand All @@ -106,14 +103,14 @@ function(add_cppcheck _name) # additional arguments are files to ignore
add_custom_target( cppcheck_${_name}
COMMAND ${CPPCHECK_EXECUTABLE} ${_cppcheck_args} --xml --xml-version=2 ${_files} 2> ${CMAKE_BINARY_DIR}/cppcheck-${_name}.xml
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS ${_files_absolute}
DEPENDS ${_files}
COMMENT "cppcheck_${_name}: Running cppcheck to generate cppcheck-${_name}.xml"
)
else (CPPCHECK_GENERATE_XML )
add_custom_target( cppcheck_${_name}
COMMAND ${CPPCHECK_EXECUTABLE} ${_cppcheck_args} ${_files}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS ${_files_absolute}
DEPENDS ${_files}
COMMENT "cppcheck_${_name}: Running cppcheck on ${_name} source files"
)
endif (CPPCHECK_GENERATE_XML )
Expand Down

0 comments on commit 36f9f86

Please sign in to comment.