[CMake] Updating files in the source tree.

Bill Hoffman bill.hoffman at kitware.com
Tue Jul 1 15:22:43 EDT 2014


On 6/28/2014 1:52 PM, Rick McGuire wrote:
>
> 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.
So, yeah it is a bad idea to put files in the source tree from the 
build.  This will preclude multiple out of source build trees from one 
source checkout.  I like to think that the source tree is on a read only 
file system.

However, it is perfectly fine to generate sources in the build tree. 
One way you could do this is to copy the files from the source tree into 
the build tree if they are newer than the source xml files.  If not you 
could generate them.  I am not sure of the details, but with custom 
commands and maybe configure_file I am sure you could get your generated 
sources moved into the build tree.

-Bill



More information about the CMake mailing list