Using XSD with CMake

From Code Synthesis Wiki

Jump to: navigation, search

FindXSD.cmake by Brad Howes

Brad Howes has posted the FindXSD.cmake file that "follows the conventions of other CMake packages to properly setup some CMake variables when working with XSD". Follow the comments in the file to integrate the schema compilation into your CMake-based project.

FindXSD.cmake by Benjamin Schindler

Benjamin Schindler has posted another variant of FindXSD.cmake. From his email:

The usage is similar to the Qt module. So basically what you do is this:

${XSD_OUTPUT_DIR}/schema/core/server ${SERVER_XSDS} OPTIONS

What this does is it copies the schema file over to the build directory and compiles it from there. This might seem unintuitive but I wanted to have a self-contained build directory so I can support validation. Also I wanted to more easily support install targets (which I do not really yet). This means that if you include a schema which includes some other schema you wrote, the include path needs to match the way the files are laid out in the build directory and not the source directory.

This has been test in the Linux environment and under the Visual Studio.

Personal tools