[CMake] Where to put generated files.

Daniel Russel drussel at gmail.com
Thu Jun 13 12:54:08 EDT 2013


Sorry, David Cole pointed out that I miswrote (and have very poor english to begin with). Sorry. What I meant to say was that we put the generated cmake files in the _source_ tree. Text in full:

As a counter example (which perhaps could be improved on), we are currently putting our generated cmake files in the _source_ tree. The reason for this to allow git post-checkout and post-rewrite hooks to update the cmake files if needed (and git only knows about the _source_ tree). We have  python script that rewrites the files if they are different, but otherwise doesn't touch them. It is run by cmake as well as by git. 

On Jun 13, 2013, at 7:06 AM, Daniel Russel <drussel at gmail.com> wrote:

> As a counter example (which perhaps could be improved on), we are currently putting our generated cmake files in the build tree. The reason for this to allow git post-checkout and post-rewrite hooks to updating the build files if needed. We have  python script that rewrites the files if they would be different, but otherwise doesn't touch them. It is run by cmake as well as by git. 
> 
> 
> On Jun 13, 2013, at 5:41 AM, William McKenzie <wsmckenz at cartewright.com> wrote:
> 
>> It's nice when everyone agrees.
>> 
>> thanks
>> 
>> 
>> On Wed, Jun 12, 2013 at 2:49 PM, Matthew Woehlke <matthew.woehlke at kitware.com> wrote:
>> On 2013-06-12 15:30, William McKenzie wrote:
>> Just wondering what the common convention is here. If I have some generated
>> c/c++ source files, say from gSoap or Lex/Yacc (and my build rules take
>> care of the generation), is the convention to generate these into the build
>> folder, or the original source folder? I understand I could use either, and
>> in some ways it makes more sense for them to go into the build folder. But
>> it also feels a little weird that all of my c files are not in the same
>> place if I do that.
>> 
>> Build directory. Configuring and building should never, ever alter the source directory in any way. (It should be possible, even, to configure and build successfully if the source directory is mounted read-only.)
>> 
>> Basically, generated artifacts of any kind should be kept separate from non-generated, for several reasons:
>> 
>> - Makes version control much easier.
>> 
>> - Can get back to 'pristine' state simply by removing the build directory.
>> 
>> - Can have multiple builds with different configurations (or even compilers) sharing a single source directory.
>> 
>> - Can ensure integrity of the source tree by making it immutable (see above ;-)... not that I tend to do this, but it's still good to have the ability if needed).
>> 
>> -- 
>> Matthew
>> 
>> --
>> 
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>> 
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>> 
>> --
>> 
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>> 
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130613/3c789055/attachment.htm>


More information about the CMake mailing list