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.
...comparison operator in the IF command. In the event of
a tie, we intentionally return "true" so that dependent
build operations are guaranteed to occur until one file
is definitively newer than the other file.
A tie means we're not sure, so return true to be on the
safe side.
A common mistake is to write
macro(foo arg)
if(arg)
endif()
endmacro()
and expect if() to treat "arg" as a variable. The documentation of the
macro() command already states that arguments are not variables, but
users writing the if() command may not look at the macro() docs.
Add a note to the if() documentation.
Show "<variable|string>" explicitly in if() case documentation whenever
auto-dereferencing occurs. Reference its presence from the explanation
at the bottom.
Remove the example explained by the misleading phrase "CMake will treat
it as if you wrote". This was originally added by commit a73071ca
(modified the if command to address bug 9123 some, 2009-06-12). Later
related information elsewhere in the documentation was corrected and
made precise by commit cb185d93 (Fix if() command and CMP0012 OLD/NEW
behavior, 2009-10-27) but the misleading example was not corrected.
Replace the example with a correct one that more directly covers the
case that typically surprises newcomers. Avoid recommending a "correct"
way to write code because this behavior is always specific to each case.
Also update the main documentation of the behavior to be more explicit.
The commit "modified the if command to address bug 9123 some" changed
the if() command behavior with respect to named boolean constants. It
introduced policy CMP0012 to provide compatibility. However, it also
changed behavior with respect to numbers (like '2') but did not cover
the change with the policy. Also, the behavior it created for numbers
is confusing ('2' is false).
This commit teaches if() to recognize numbers again, and treats them
like the C language does in terms of boolean conversion. We also fix
the CMP0012 check to trigger in all cases where the result of boolean
coersion differs from that produced by CMake 2.6.4.
This converts the CMake license to a pure 3-clause OSI-approved BSD
License. We drop the previous license clause requiring modified
versions to be plainly marked. We also update the CMake copyright to
cover the full development time range.
This centralizes construction of the error message for an unclosed
logical block (if, foreach, etc.). We record the line at which each
block is opened so it can be reported in the error message.
When a function blocker decides to remove itself we previously removed
it at every return point from the C++ scope in which its removal is
needed. This teaches function blockers to transfer ownership of
themselves from cmMakefile to an automatic variable for deletion on
return. Since this removes blockers before they replay their commands,
we no longer need to avoid running blockers on their own commands.
Provide VERSION_LESS, VERSION_EQUAL, and VERSION_GREATER operators in
the if() command. This simplifies component-wise comparison of version
numbers in the form "major[.minor[.patch[.tweak]]]".
It is useful to be able to test if a target has been created. Often
targets are created only inside conditions. Rather than storing the
result of the condition manually for testing by other parts of the
project, it is much easier for the other parts to just test for the
target's existence. This will also be useful when find-modules start
reporting results with IMPORTED targets and projects want to test if a
certain target is available.
- This will help projects support multiple CMake versions.
- In order to set a policy when using a newer CMake but still
working with an older CMake one may write
if(POLICY CMP1234)
cmake_policy(SET CMP1234 NEW)
endif(POLICY CMP1234)
- Note that since CMake 2.4 does not have if(POLICY) supporting
it will also require using "if(COMMAND cmake_policy)"