Re: [PATCH] cmake: ignore generated files
From: Junio C Hamano <hidden>
Date: 2020-09-19 00:50:46
Đoàn Trần Công Danh [off-list ref] writes:
quoted
What can we do to make it easier for people to discover and follow the best current practice? Are there things in our build instruction document (e.g. the comment at the top of CMakeLists.txt) that needs updating?I think Sibi had done a lot of good work to write instruction at the top of CMakeLists.txt, I guess it's a bit too much instruction. The instruction for out of source build was written after the instruction to build in-tree. Should we change the order? I don't really know.
Oh, absolutely.
It begins with
cmake `relative-path-to-CMakeLists.txt` -DCMAKE_BUILD_TYPE=Release
Eg.
From the root of git source tree
`cmake contrib/buildsystems/ `
This will build the git binaries at the root
which tells exactly what Dscho did and got him writing the patch in
question. You'd need to keep reading to be merely _aware_ that it
is possible to do an out-of-tree build, without getting even told
that it is the norm in CMake land.
We should just remove the above and start the comment seciton with
something more like this:
When using CMake, building in place is highly discouraged.
Instead, create a new "git-build" directory and perform your
build there, like this (from the top of the working tree):
$ mkdir git-build
$ cd git-build
$ cmake ../contrib/buildsystems/ -DCMAKE_BUILD_TYPER=Release
This will build the git binaries in git-build directory
Doing so would reduce the number of choices the user has to make,
and reduce the confusion.
Thanks.