Even though the `file(GLOB)` documentation specifically warns against
using it to collect a list of source files, projects often do it anyway.
Since it uses `readdir()`, the list of files will be unsorted.
This list is often passed directly to add_executable / add_library.
Linking binaries with an unsorted list will make it unreproducible,
which means that the produced binary will differ depending on the
unpredictable `readdir()` order.
To solve those reproducibility issues in a lot of programs (which don't
explicitly `list(SORT)` the list manually), sort the resulting list of
the `file(GLOB)` command.
A more detailed rationale about reproducible builds is available
[here](https://reproducible-builds.org/).
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.
* If you reached this commit for a line in `git blame`, re-run the blame
operation starting at the parent of this commit to see older history
for the content.
* See the parent commit for instructions to rebase a change across this
style transition commit.
This is an empty commit that precedes an automatic application of
clang-format to update the C++ style of our entire source tree.
This may be helpful to rebase a topic branch that was originally
based on a commit preceding the transition. One may first rebase
the topic on this commit. Then use one of the following approaches.
* Rewrite the topic, including this commit, using `git filter-branch`
`--tree-filter` with `Utilities/Scripts/clang-format.bash` to update
the style in every commit. Rebase the revised topic, excluding the
rewrite of this commit, on the style transition commit.
OR
* Add a `.git/info/grafts` entry to change the parent of the first
commit in the topic from this commit to the style transition commit.
Rewrite the topic using `git filter-branch --tree-filter` with
`Utilities/Scripts/clang-format.bash` to update the style in every
commit. Then remove the graft, which was resolved by the filter.
See `git help filter-branch` and `git help repository-layout` for
details.
List all sources in version control and filter out those that we should
not format for various reasons. Then run the clang-format tool to do an
in-place update.
After discussion among developers we settled on the Mozilla style
with a few tweaks:
* Do not align operator arguments.
* Do not always break after a function return type.
* Limit to 79 columns instead of 80 to fit edge cases
better in 80-column terminals as CMake has always done.
* Format for C++98 instead of C++11 because CMake is written
in the former language.
Co-Author: Daniel Pfeifer <daniel@pfeifer-mail.de>
The `IMPLEMENT_VISIT_IMPL` macro must preserve a space before the `>`
character in case the `DATATYPE` is a template type ending in `>`.
Manually format the macro layout as clang-format would except for this
space. Then add markup to tell clang-format not to format this macro.
This supplements the existing library checks, to
cater for the possibility that the libraries are
present but the headers are not. This can happen
when the Boost collections is split up into
multiple packages and not all are installed,
and will avoid the checks silently passing when
the build would subsequently fail.
Packagers may now set their own rpm package
file names or request that rpmbuild tool
chooses one for them. It also supports handing
of situations where one spec file may produce
multiple rpm packages.
The empty string we add as a link item for an INTERFACE_LIBRARY target
is not a path, so do not mark it as such. The generators currently
tolerate it either way, but only by accident.
The fix in commit v3.1.0-rc1~544^2~5 (Windows: Avoid () in environment
variable references, 2014-05-02) introduced a set() command in the
middle of an argument list. Move it to before the find_path() call.
Set LC_NUMERIC = "C" at startup after Qt initializes the application
because Qt may have adopted the current locale from the environment.
CMake does not define behavior for non-C-locale numeric behavior.
PathScale uses a wrapper around the linker. The "ldfe" invocation in
the output is followed by a normal "ld" invocation. Exclude the former
so we can reach and parse the latter correctly.
Since CMake is written in C++98 any clang-format configuration must
set `Standard` to `Cpp03` so that `A<A<int> >` is not rewritten as
`A<A<int>>`. However, this will cause `U"foo"` to be rewritten as
`U "foo"`. Add markup to turn clang-format off in the one place
that the latter case occurs so that we do not need a separate
`.clang-format` config file for it.
Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>