[CMake] Where to put generated files.

William McKenzie wsmckenz at cartewright.com
Thu Jun 13 08:41:44 EDT 2013


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<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<http://www.cmake.org/Wiki/CMake_FAQ>
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/**listinfo/cmake<http://www.cmake.org/mailman/listinfo/cmake>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130613/ff048ec2/attachment.htm>


More information about the CMake mailing list