[CMake] Programmatically-generated dependencies

ax487 ax487 at gmx.de
Tue Dec 9 04:38:42 EST 2014


Hello all,

I am mainly asking having glib-compile-resources in mind. This little
program translates files into C source code to be used with the
gresource system. It works in the following way: You have a file.xml
describing the resources:

<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/some/prefix">

<file>some_file.txt</file>
</gresource>
</gresources>

To generate the source you use `glib-compile-resources --generate-source
--target=output.c file.xml`. Clearly the generated output.c depends on
file.xml. But it also depends on some_file.txt. It is possible to get a
list of dependencies using `glib-compile-resources
--generate-dependencies file.xml` which will output

some_file.txt

The situation is similar to the case of auto-generated header
dependencies for C/C++ source code using the "-MM" option of gcc.
I saw the following version on github:

https://github.com/bgK/vba-ttb/blob/master/cmake/GResource.cmake

which does not correctly detect dependencies, but nothing apart from
that. But since the process works with C/C++ source code I figured there
is no reason why it shouldn't also work in this case. Could anyone give
me some pointers on how to get this to work?

ax487


More information about the CMake mailing list