[cmake-developers] [PATCH] cmFileCommand: sort list of files from glob command

Reiner Herrmann reiner at reiner-h.de
Mon May 16 17:23:47 EDT 2016


On Mon, May 16, 2016 at 09:27:57AM -0400, Brad King wrote:
> This has been proposed several times and never accepted because file(GLOB)
> is a primitive.  As Petr said our documentation explicitly discourages
> the use case in question.  Those projects that wish to ignore our advice
> can use list(SORT) themselves to get reproducible source file ordering
> after file(GLOB).

Thanks for the documentation hint, I didn't see this warning.

Unfortunately many projects still use this for finding source files [1],
without considering sorting.
Without sorting it in file(GLOB), most of those packages have to be
patched individually.  Would sorting by default really have such a
noticable performance impact?  I can't imagine there are many projects
where sorting time isn't negligible.
What about having another glob mode for the few cornercases that really
need this bit of extra-performance, but have the sorting enabled by
default for file(GLOB)?  This would automatically help many CMake
projects with reproducibility.

Regards,
  Reiner

[1] https://codesearch.debian.net/perpackage-results/path%3ACMakeLists.txt%20(file%7CFILE).*(glob%7CGLOB).*%5C*%5C.c/2/page_0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Digital signature
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160516/8c961870/attachment.sig>


More information about the cmake-developers mailing list