Using XSD with CMake
From Code Synthesis Wiki
Revision as of 13:15, 11 May 2010 Boris (Talk | contribs) (Add CMake module by Benjamin Schindler) ← Previous diff |
Current revision Boris (Talk | contribs) |
||
Line 16: | Line 16: | ||
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. | 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. |
Current revision
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:
WRAP_XSD(SERVER_XSDS_SRCS SERVER_XSDS_INCLUDE ${XSD_OUTPUT_DIR}/schema/core/server ${SERVER_XSDS} OPTIONS ${SERVER_XSD_ARGS}) INCLUDE_DIRECTORIES(${SERVER_XSDS_INCLUDE}) ADD_LIBRARY(server SHARED ${SERVER_SRCS} ${SERVER_XSDS_SRCS})
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.