[CMake] Updating files in the source tree.

Scott Aron Bloom scott.bloom at onshorecs.com
Sat Jun 28 15:53:38 EDT 2014


I have a couple of similar files to this.

Some are XML based source files, others are “SVN” sourced file.  Others are .y/.l based files.

Some are checked in, some are not.  The reason, not every developer has or needs the “full” development environment.  Ie, not every developer has flex/bison installed, and wouldn’t be “debugging” the grammar, so havng the ability to checkout the library with full c++ source and headers is invaluable.

What we wound up doing, is customizing the modules found in the distributed cmake tool, starting with the yacc/lexx ones but when we needed to check them back in to the source area, we simply set the target to CMAKE_CURRENT_SOURCE_DIR

Scott

From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Rick McGuire
Sent: Saturday, June 28, 2014 7:52 AM
To: cmake at cmake.org
Subject: [CMake] Updating files in the source tree.

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/f2d01eb7/attachment.html>


More information about the CMake mailing list