aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2017-07-19 21:52:53 +0200
committerFulup Ar Foll <fulup@iot.bzh>2017-07-25 12:37:22 +0200
commit3f1eae7b3c3e727c55c3252d5f551b9bdd8f285d (patch)
treec4d73c63e51c7eb3ea819d7440b0172fb5281134
parent60efea2ece175966692970212260cb4a49a861ea (diff)
Added XML schema check at build time
-rw-r--r--data/CMakeLists.txt12
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