In my CMake-based project I have some XML files used to generate code (using the typical add_custom_command
& add_custom_target
pattern).
This XML file includes other files as follows:
<?xml version="1.0" encoding="utf-8"?>
<definition
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../MyComponent/schema.xsd">
<include href="../../../MyComponent/another.xml" />
</definition>
Now I want to make ../../../MyComponent
dependent on a CMake variable. What would definitely would work is to write a generator that takes an XML template and replaces the paths with the content of a CMake variable using, here also, the add_custom_command
& add_custom_target
pattern.
Is there a solution that would make use of simple CMake and/or XML mechanisms to patch or generate the correct path?