added make targets `checkCWEEntries`, `validateXML` and `validateRules` to CMake (#4010)
This commit is contained in:
parent
16e90ed3e2
commit
0e1a0b97ed
|
@ -23,7 +23,6 @@ file(GLOB addons "addons/*.py")
|
|||
file(GLOB cfgs "cfg/*.cfg")
|
||||
file(GLOB platforms "platforms/*.xml")
|
||||
|
||||
find_program(LIBXML2_XMLLINT_EXECUTABLE xmllint)
|
||||
if (LIBXML2_XMLLINT_EXECUTABLE)
|
||||
add_custom_target(validateCFG ${LIBXML2_XMLLINT_EXECUTABLE} --noout ${CMAKE_SOURCE_DIR}/cfg/cppcheck-cfg.rng)
|
||||
foreach(cfg ${cfgs})
|
||||
|
@ -31,6 +30,27 @@ if (LIBXML2_XMLLINT_EXECUTABLE)
|
|||
add_custom_target(validateCFG-${cfgname} ${LIBXML2_XMLLINT_EXECUTABLE} --noout --relaxng ${CMAKE_SOURCE_DIR}/cfg/cppcheck-cfg.rng ${cfg})
|
||||
add_dependencies(validateCFG validateCFG-${cfgname})
|
||||
endforeach()
|
||||
|
||||
add_custom_target(errorlist-xml $<TARGET_FILE:cppcheck> --errorlist > ${CMAKE_BINARY_DIR}/errorlist.xml
|
||||
DEPENDS cppcheck)
|
||||
|
||||
add_custom_target(example-xml $<TARGET_FILE:cppcheck> --xml --enable=all --inconclusive --max-configs=1 ${CMAKE_SOURCE_DIR}/samples 2> ${CMAKE_BINARY_DIR}/example.xml
|
||||
DEPENDS cppcheck)
|
||||
|
||||
add_custom_target(createXMLExamples DEPENDS errorlist-xml example-xml)
|
||||
|
||||
if (PYTHON_EXECUTABLE)
|
||||
add_custom_target(checkCWEEntries ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/listErrorsWithoutCWE.py -F ${CMAKE_BINARY_DIR}/errorlist.xml
|
||||
DEPENDS errorlist-xml)
|
||||
endif()
|
||||
|
||||
add_custom_target(validateXML ${LIBXML2_XMLLINT_EXECUTABLE} --noout ${CMAKE_SOURCE_DIR}/cppcheck-errors.rng
|
||||
COMMAND ${LIBXML2_XMLLINT_EXECUTABLE} --noout --relaxng ${CMAKE_SOURCE_DIR}/cppcheck-errors.rng ${CMAKE_BINARY_DIR}/errorlist.xml
|
||||
COMMAND ${LIBXML2_XMLLINT_EXECUTABLE} --noout --relaxng ${CMAKE_SOURCE_DIR}/cppcheck-errors.rng ${CMAKE_BINARY_DIR}/example.xml
|
||||
DEPENDS createXMLExamples
|
||||
)
|
||||
|
||||
add_custom_target(validateRules ${LIBXML2_XMLLINT_EXECUTABLE} --noout ${CMAKE_SOURCE_DIR}/rules/*.xml)
|
||||
endif()
|
||||
|
||||
if (BUILD_TESTS)
|
||||
|
|
|
@ -19,15 +19,13 @@ endif()
|
|||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
if (NOT USE_MATCHCOMPILER_OPT MATCHES "Off")
|
||||
find_package(PythonInterp 3 QUIET)
|
||||
find_package(PythonInterp 3 QUIET)
|
||||
if (NOT PYTHONINTERP_FOUND)
|
||||
set(PYTHONINTERP_FOUND "")
|
||||
find_package(PythonInterp 2.7 QUIET)
|
||||
if (NOT PYTHONINTERP_FOUND)
|
||||
set(PYTHONINTERP_FOUND "")
|
||||
find_package(PythonInterp 2.7 QUIET)
|
||||
if (NOT PYTHONINTERP_FOUND)
|
||||
message(WARNING "No python interpreter found. Therefore, the match compiler is switched off.")
|
||||
set(USE_MATCHCOMPILER_OPT "Off")
|
||||
endif()
|
||||
message(WARNING "No python interpreter found. Therefore, the match compiler is switched off.")
|
||||
set(USE_MATCHCOMPILER_OPT "Off")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -52,3 +50,5 @@ endif()
|
|||
if (USE_BOOST)
|
||||
find_package(Boost COMPONENTS container QUIET)
|
||||
endif()
|
||||
|
||||
find_program(LIBXML2_XMLLINT_EXECUTABLE xmllint)
|
||||
|
|
Loading…
Reference in New Issue