added make target `validatePlatforms` to CMake (#4343)

* added missing `platforms/cppcheck-platforms.rng` validation

* added make target `validatePlatforms` to CMake
This commit is contained in:
Oliver Stöneberg 2022-08-06 19:56:32 +02:00 committed by GitHub
parent d5a0dfda00
commit 271213cbbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -35,6 +35,13 @@ if (LIBXML2_XMLLINT_EXECUTABLE)
# this is a symbolic name for a build rule and not an output file
set_source_files_properties(validateCFG-cmd PROPERTIES SYMBOLIC "true")
add_custom_target(validatePlatforms ${LIBXML2_XMLLINT_EXECUTABLE} --noout ${CMAKE_SOURCE_DIR}/platforms/cppcheck-platforms.rng)
foreach(platform ${platforms})
get_filename_component(platformname ${platform} NAME_WE)
add_custom_target(validatePlatforms-${platformname} ${LIBXML2_XMLLINT_EXECUTABLE} --noout --relaxng ${CMAKE_SOURCE_DIR}/platforms/cppcheck-platforms.rng ${platform})
add_dependencies(validatePlatforms validatePlatforms-${platformname})
endforeach()
add_custom_target(errorlist-xml $<TARGET_FILE:cppcheck> --errorlist > ${CMAKE_BINARY_DIR}/errorlist.xml
DEPENDS cppcheck)

View File

@ -375,6 +375,7 @@ PlatformFilesCHECKED := $(patsubst %.xml,%.checked,$(PlatformFiles))
%.checked:%.xml
xmllint --noout --relaxng platforms/cppcheck-platforms.rng $<
validatePlatforms: ${PlatformFilesCHECKED}
xmllint --noout platforms/cppcheck-platforms.rng
# Validate XML output (to detect regressions)
/tmp/errorlist.xml: cppcheck

View File

@ -485,7 +485,9 @@ int main(int argc, char **argv)
fout << ".PHONY: validatePlatforms\n";
fout << "%.checked:%.xml\n";
fout << "\txmllint --noout --relaxng platforms/cppcheck-platforms.rng $<\n";
fout << "validatePlatforms: ${PlatformFilesCHECKED}\n\n";
fout << "validatePlatforms: ${PlatformFilesCHECKED}\n";
fout << "\txmllint --noout platforms/cppcheck-platforms.rng\n";
fout << "\n";
fout << "# Validate XML output (to detect regressions)\n";
fout << "/tmp/errorlist.xml: cppcheck\n";
fout << "\t./cppcheck --errorlist >$@\n";