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:[email protected]] On Behalf Of Rick McGuire
Sent: Saturday, June 28, 2014 7:52 AM
To: [email protected]
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
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to