Commit Graph

79 Commits

Author SHA1 Message Date
Brad King 86578eccf2 Simplify CMake per-source license notices
Per-source copyright/license notice headers that spell out copyright holder
names and years are hard to maintain and often out-of-date or plain wrong.
Precise contributor information is already maintained automatically by the
version control tool.  Ultimately it is the receiver of a file who is
responsible for determining its licensing status, and per-source notices are
merely a convenience.  Therefore it is simpler and more accurate for
each source to have a generic notice of the license name and references to
more detailed information on copyright holders and full license terms.

Our `Copyright.txt` file now contains a list of Contributors whose names
appeared source-level copyright notices.  It also references version control
history for more precise information.  Therefore we no longer need to spell
out the list of Contributors in each source file notice.

Replace CMake per-source copyright/license notice headers with a short
description of the license and links to `Copyright.txt` and online information
available from "https://cmake.org/licensing".  The online URL also handles
cases of modules being copied out of our source into other projects, so we
can drop our notices about replacing links with full license text.

Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority
of the replacements mechanically.  Manually fix up shebang lines and trailing
newlines in a few files.  Manually update the notices in a few files that the
script does not handle.
2016-09-27 15:14:44 -04:00
Daniel Pfeifer a7a9239096 mark functions with CM_OVERRIDE 2016-06-27 23:24:38 +02:00
Kitware Robot d9fd2f5402 Revise C++ coding style using clang-format
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.
2016-05-16 16:05:19 -04:00
Brad King 180538c706 Source: Stabilize include order
Each source file has a logical first include file.  Include it in an
isolated block so that tools that sort includes do not move them.
2016-04-29 13:58:31 -04:00
Nils Gladitz 188a1f236e If: Introduce policy CMP0054 - don't dereference quoted variables in if() 2014-09-11 21:23:17 +02:00
Nils Gladitz b900c1ccaa If: Extract cmConditionEvaluator from if() implementation 2014-09-11 21:17:09 +02:00
Stephen Kelly 6c19024570 Remove extra semicolons from C++ code.
Clang based tools running over the code complain about these,
but clang has a fixit for removing them.
2014-04-03 21:53:14 +02:00
Ben Boeckel 85fc9f26a7 stringapi: Command names 2014-03-08 13:05:39 -05:00
Ben Boeckel 3742bb0d32 stringapi: Use strings for variable names
Variable names are always generated by CMake and should never be NULL.
2014-03-08 13:05:28 -05:00
Brad King e33d8d2d77 Drop builtin command documentation
Drop all GetTerseDocumentation and GetFullDocumentation methods from
commands.  The command documentation is now in Help/command/*.rst files.
2013-10-16 09:22:36 -04:00
Brad King f63304d982 if: Document that plain 'NOTFOUND' is a false constant
Previously we only mentioned the '-NOTFOUND' suffix.

Reported-by: Nils Gladitz <gladitz@sci-vis.de>
2012-10-05 15:14:29 -04:00
David Cole 0eaaa863ed CMake: Clarify the documentation for if(f1 IS_NEWER_THAN f2)
...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.
2012-08-15 19:52:21 -04:00
Kitware Robot 7bbaa4283d Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with
trailing whitespace.  Wipe out all remnants of trailing whitespace
everywhere except third-party code.

Run the following shell code:

git ls-files -z -- \
 bootstrap doxygen.config '*.readme' \
 '*.c' '*.cmake' '*.cpp' '*.cxx' \
 '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \
 '*.mm' '*.pike' '*.py' '*.txt' '*.vim' |
egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' |
egrep -z -v '^(Modules/CPack\..*\.in)' |
xargs -0 sed -i 's/ \+$//'
2012-08-13 14:18:39 -04:00
Brad King 674c56c3fc if: Document that macro arguments are not variables (#13393)
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.
2012-07-11 10:40:04 -04:00
Brad King 09ff226e4c Merge branch 'add-const-qualifiers' into doxygen-fixes
Conflicts:
	Source/cmPropertyDefinition.h
2012-03-01 10:40:21 -05:00
Yury G. Kudryashov 937bb4bebf doxygen: remove a few comments
These comments were either wrong or non-informative.
Replace some of them by brief comments
2012-03-01 02:33:13 +04:00
Yury G. Kudryashov 737c49a357 Add 'const' qualifier to some cmCommand members
Use const_cast for the special case in cmFindBase where
GetFullDocumentation calls GenerateDocumentation.
2012-02-29 13:27:04 -05:00
Brad King 7d9b903756 Clarify auto-dereference cases in if() command (#11701)
Show "<variable|string>" explicitly in if() case documentation whenever
auto-dereferencing occurs.  Reference its presence from the explanation
at the bottom.
2011-01-17 09:43:41 -05:00
Brad King e4e14e8568 Replace misleading example in the if() documentation (#10773)
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.
2011-01-14 18:28:56 -05:00
Brad King cb185d93d2 Fix if() command and CMP0012 OLD/NEW behavior
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.
2009-10-27 09:07:39 -04:00
Brad King 7a9f75c1a8 Add IS_SYMLINK test to if command 2009-10-21 13:11:16 -04:00
Brad King 96afb12087 Convert CMake to OSI-approved BSD License
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.
2009-09-28 11:43:28 -04:00
Bill Hoffman 14715ce813 Clarify documentation for if. 2009-09-14 13:42:04 -04:00
Ken Martin 133a778e2d ENH: clean up some help text 2009-06-12 13:25:50 -04:00
Ken Martin a73071ca17 ENH: modified the if command to address bug 9123 some 2009-06-12 10:07:05 -04:00
Ken Martin ad25cf8d17 ENH: fix style 2009-02-16 13:56:04 -05:00
Ken Martin 4f369610f5 ENH: fix documentation and add docs on parenthetical expressions 2009-02-12 12:50:12 -05:00
Brad King bca1026250 ENH: Better error message for unclosed blocks
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.
2009-01-21 09:48:20 -05:00
Brad King 2c81e5fb5c ENH: Refactor function blocker deletion
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.
2009-01-20 14:36:18 -05:00
Brad King 4fa96dbf95 ENH: Add version comparison to if() command
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]]]".
2008-09-10 11:58:40 -04:00
Brad King fff812db95 ENH: Add if(TARGET) command
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.
2008-08-20 11:45:16 -04:00
Ken Martin 52d8b1b5d9 BUG: fix memory leak and cleanup error string code 2008-06-28 11:16:36 -04:00
Brad King a6a673979d ENH: Add "if(POLICY policy-id)" option for IF command.
- 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)"
2008-03-20 18:25:59 -04:00
Alexander Neundorf 52a0538719 STYLE: document that if(COMMAND) works also for macros and functions
Alex
2008-02-10 17:19:10 -05:00
Ken Martin 0e69d38004 ENH: add return and break support to cmake, also change basic command invocation signature to be able to return extra informaiton via the cmExecutionStatus class 2008-01-23 10:28:26 -05:00
Ken Martin 8d32d229a3 ENH: make commands lower case by default 2007-10-10 11:47:43 -04:00
Alexander Neundorf e80acd971c ENH: also store the group matches from IF( MATCHES) in CMAKE_MATCH_(0..9)
Alex
2007-08-29 11:58:38 -04:00
Alexander Neundorf c9f1af3913 ENH: add IF(IS_ABSOLUTE path), so no regex matching is required in the cmake scripts
Alex
2007-06-06 08:49:18 -04:00
Ken Martin 2888b13ef9 STYLE: improve IF documentation to cover elseif 2007-01-26 15:06:07 -05:00
Ken Martin 372ce05a07 ENH: fix a warning and a nice fix to the IF command 2006-12-12 10:07:20 -05:00
Brad King b25629efc4 ENH: Remove old IF(FILE_IS_NEWER) syntax. It was never in a release anyway. 2006-10-23 17:14:20 -04:00
Brad King d1a9c93119 ENH: Patch from Alex to provide nicer syntax for FILE_IS_NEWER. Using name IS_NEWER_THAN so old syntax will continue to work. 2006-10-23 13:37:24 -04:00
Ken Martin 5e46232ad8 ENH: added elseif 2006-09-22 11:23:51 -04:00
Brad King 6449089436 ENH: Patch from Alex for adding IF(FILE_IS_NEWER). I also added a test. 2006-08-25 16:31:07 -04:00
Brad King 1307dfbd32 ENH: Clarified documentation of EXISTS and IS_DIRECTORY modes. 2006-06-26 10:57:35 -04:00
Brad King 54a7e0036b BUG: Patch from Miguel A. Figueroa-Villanueva for fixing documentation. 2006-06-12 13:05:53 -04:00
Ken Martin ba2b99bb9f STYLE: fix line length 2006-05-11 15:50:11 -04:00
Brad King 016e689f57 BUG: Fixed missing false values in documentation of IF command. 2006-04-18 10:27:24 -04:00
Ken Martin 10efe3b079 ENH: added some new functionality 2006-03-22 14:06:52 -05:00
Ken Martin 3d96e52261 STYLE: some m_ to this-> cleanup 2006-03-15 11:02:08 -05:00