diff options
author | Fulup Ar Foll <fulup@iot.bzh> | 2017-07-19 21:52:53 +0200 |
---|---|---|
committer | Fulup Ar Foll <fulup@iot.bzh> | 2017-07-19 21:52:53 +0200 |
commit | 359083b3a1852e0993dd657d74354955ef25ee44 (patch) | |
tree | e25f192eab53150e8e91bd2177cf19c9c70f2bb2 | |
parent | 07b52f2a1a51a0715e03346229d72bb3c7154b2b (diff) |
Added XML schema check at build time
-rw-r--r-- | data/CMakeLists.txt | 12 |
1 files changed, 8 insertions, 4 deletions
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 |