[CMake] Updating files in the source tree.

Rick McGuire object.rexx at gmail.com
Sat Jun 28 13:52:23 EDT 2014


Sort of a long explanation/question here, so bear with me :-)

With our project, we have a number of source files that are generated from
.xml files.  These generate a number of header files, message files, etc
using xslt.  For a number of reasons, the generated files are also checked
into to SVN.  Our old makefiles had the appropriate dependencies set up so
that so that when the source xml files were changed, these files would be
generated directly into the source tree and then checked in on the next svn
commit.

When we made the switch to CMake we ran into a lot of issues with trying to
output files into the source directorys, so we abandoned the automatic
generation and replace it with a small script we could run whenever we need
to update those files (doesn't happen very often and to date, I'm the only
developer who has ever updated this).  This works for what I need.

However, the more I learn about CMake, the more I really like having CMake
to perform all of the build type steps.  This separate build script sort of
bugs me, and I'm thinking that I could probably create some custom commands
that generate the files into the build directory and then copy them back
into the source tree.

The big question comes down to "should I?".  Is doing this somehow a
violation of CMake rules/conventions?  Are there any issues I need to
consider?  And, the ultimate question is whether it is somehow possible to
set up dependencies where I could get back to the original build behavior?
 Although I would be perfectly fine just having a target that allowed
updating those files on demand.

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140628/666b197c/attachment-0001.html>


More information about the CMake mailing list