Using XSD with CMake
From Code Synthesis Wiki
Revision as of 13:02, 3 February 2010 Boris (Talk | contribs) (Start a page on using XSD with CMake) ← Previous diff |
Revision as of 13:15, 11 May 2010 Boris (Talk | contribs) (Add CMake module by Benjamin Schindler) Next diff → |
||
Line 1: | Line 1: | ||
+ | == FindXSD.cmake by Brad Howes == | ||
+ | |||
Brad Howes has [http://www.codesynthesis.com/pipermail/xsd-users/2010-February/002668.html posted] the [[Media:FindXSD.cmake.gz|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. | Brad Howes has [http://www.codesynthesis.com/pipermail/xsd-users/2010-February/002668.html posted] the [[Media:FindXSD.cmake.gz|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 [http://www.codesynthesis.com/pipermail/xsd-users/2010-May/002826.html posted] another variant of [[Media:FindXSD-2.cmake.gz|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. |
Revision as of 13:15, 11 May 2010
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.