From 3f1eae7b3c3e727c55c3252d5f551b9bdd8f285d Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Wed, 19 Jul 2017 21:52:53 +0200 Subject: Added XML schema check at build time --- data/CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'data') diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index d49221d..7963474 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -23,18 +23,22 @@ ################################################## PROJECT_TARGET_ADD(ucs2_config) - file(GLOB SOURCE_FILES "*.xml") + file(GLOB XML_FILES "*.xml") + set(XML_SCHEMA unicens.xsd) add_custom_target(${TARGET_NAME} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} ) + # check XML schema before pushing config add_custom_command( - DEPENDS ${SOURCE_FILES} + DEPENDS ${XML_FILES} OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND xmllint -schema ${XML_SCHEMA} ${XML_FILES} --noout COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - COMMAND cp -r ${SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} + COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} + COMMAND cp -r ${XML_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} ) SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES -- cgit 1.2.3-korg