Commit Graph

31 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 efed6468ed fix a load of include-what-you-use violations 2016-09-03 08:04:56 -04:00
Tobias Hunger a354f60ce0 Refactor extra generator registration to use factories
This will allow additional information about the availability
and capabilities of extra generators to be queried without
actually creating them.

Instead of a static NewFactory() method like the main generator
factories have, use a static GetFactory() method to get a pointer to a
statically allocated extra generator factory.  This simplifies memory
management.
2016-08-03 09:43:00 -04:00
Daniel Pfeifer 1d6909a287 use CM_NULLPTR 2016-06-28 09:02:26 -04: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 0ac18d40c8 Remove `//------...` horizontal separator comments
Modern editors provide plenty of ways to visually separate functions.
Drop the explicit comments that previously served this purpose.
Use the following command to automate the change:

    $ git ls-files -z -- \
        "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" |
      egrep -z -v "^Source/cmCommandArgumentLexer\." |
      egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmDependsJavaLexer\." |
      egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmExprLexer\." |
      egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmFortranLexer\." |
      egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmListFileLexer\." |
      egrep -z -v "^Source/cm_sha2" |
      egrep -z -v "^Source/(kwsys|CursesDialog/form)/" |
      egrep -z -v "^Utilities/(KW|cm).*/" |
      xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}'

This avoids modifying third-party sources and generated sources.
2016-05-09 09:41:43 -04:00
Brad King 64b5520346 Isolate formatted streaming blocks with clang-format off/on
The clang-format tool can do a good job formatting most code, but
well-organized streaming blocks are best left manually formatted.

Find blocks of the form

    os <<
      "...\n"
      "...\n"
      ;

using the command

    $ git ls-files -z -- Source |
      egrep -v -z '^Source/kwsys/' |
      xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \
        '<<[^\n]*\n(^ *("[^\n]*("|<<|;)$|;)\n){2,}'

Find blocks of the form

    os << "...\n"
       << "...\n"
       << "...\n";

using the command

    $ git ls-files -z -- Source |
      egrep -v -z '^Source/kwsys/' |
      xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \
        '<<[^\n]*\n(^ *<<[^\n]*(\\n"|<<|;)$\n){2,}'

Surround such blocks with the pair

    /* clang-format off */
    ...
    /* clang-format on */

in order to protect them from update by clang-format.  Use the C-style
`/*...*/` comments instead of C++-style `//...` comments in order to
prevent them from ever being swallowed by re-formatting of surrounding
comments.
2016-05-06 14:25:55 -04:00
Brad King e1c7747253 Format include directive blocks and ordering with clang-format
Sort include directives within each block (separated by a blank line) in
lexicographic order (except to prioritize `sys/types.h` first).  First
run `clang-format` with the config file:

    ---
    SortIncludes: false
    ...

Commit the result temporarily.  Then run `clang-format` again with:

    ---
    SortIncludes: true
    IncludeCategories:
      - Regex:    'sys/types.h'
        Priority: -1
    ...

Commit the result temporarily.  Start a new branch and cherry-pick the
second commit.  Manually resolve conflicts to preserve indentation of
re-ordered includes.  This cleans up the include ordering without
changing any other style.

Use the following command to run `clang-format`:

    $ git ls-files -z -- \
        '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' |
      egrep -z -v '(Lexer|Parser|ParserHelper)\.' |
      egrep -z -v '^Source/cm_sha2' |
      egrep -z -v '^Source/(kwsys|CursesDialog/form)/' |
      egrep -z -v '^Utilities/(KW|cm).*/' |
      egrep -z -v '^Tests/Module/GenerateExportHeader' |
      egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' |
      xargs -0 clang-format -i

This selects source files that do not come from a third-party.

Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
2016-04-29 13:58:54 -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
Stephen Kelly b22e5d0ab7 Remove some obsolete declarations
Ensure that cmStandardIncludes.h is included before any platform header
in cmGeneratorExpressionEvaluator.h.  That file needs to change as
a result of removal of the cmMakefile.h header from
cmGeneratorExpressionNode.h, affecting the compilation of
cmGeneratorExpressionNode.cxx.

On AIX we need to include our own headers first to get large file
support macros defined consistently within system headers.  The old
order in this header worked only because it was always included after
other headers.
2015-10-27 21:52:47 +01:00
Stephen Kelly 67b2f4312c Port to GetGeneratorTargets. 2015-10-24 09:19:53 +02:00
Stephen Kelly eac15298a8 cmState: Move TargetType enum from cmTarget.
Mostly automated:

 values=( "EXECUTABLE" "STATIC_LIBRARY" "SHARED_LIBRARY" "MODULE_LIBRARY" "OBJECT_LIBRARY" "UTILITY" "GLOBAL_TARGET" "INTERFACE_LIBRARY" "UNKNOWN_LIBRARY" "TargetType")
 for i in "${values[@]}"; do     git grep -l cmTarget::$i | xargs sed -i "s|cmTarget::$i|cmState::$i|g"; done
2015-10-15 00:41:39 +02:00
Stephen Kelly bbef3c2da8 cmLocalGenerator: Add current binary directory accessor. 2015-10-10 11:04:39 +02:00
Stephen Kelly 12cb3bdce4 cmLocalGenerator: Add Home directory accessors.
Reduce reasons for cmLocalGenerator to have a cmMakefile.
2015-10-09 00:00:19 +02:00
Stephen Kelly f2a641d68b Kate: Remove unused variables. 2015-10-09 00:00:19 +02:00
Stephen Kelly 10cf42f5ae Kate: Port API to cmLocalGenerator. 2015-10-09 00:00:19 +02:00
Stephen Kelly 4ab2750c54 cmLocalGenerator: Add GetProjectName method. 2015-10-09 00:00:18 +02:00
Daniel Pfeifer b3372db588 cmExtra{Kate,SublimeText}Generator: Remove unused cmXMLSafe includes 2015-08-28 10:11:08 -04:00
Brad King 6fbd4cae0d Use cmSystemTools::GetCMakeCommand() to get path to cmake internally
This is much simpler than finding a way to lookup "CMAKE_COMMAND"
everywhere.
2015-05-20 11:20:42 -04:00
Stephen Kelly 54d6a9187f cmMakefile: Rename GetCurrent{Output,Binary}Directory.
Match names used in CMake code.
2015-04-21 00:12:52 +02:00
Stephen Kelly d92887efab Replace 'foo.size() > 0' pattern with !foo.empty(). 2015-01-18 14:25:24 +01:00
Ben Boeckel 1a1b737c99 stringapi: Use strings for generator names 2014-03-08 13:05:38 -05:00
Alex Neundorf 22e5c6c26b Kate: handle spaces in build dir
They need to be escaped in the json file... I'm quite
sure I tested this before, obviously I didn't test it
correctly.

Alex
2014-02-17 09:54:03 -05:00
Alex Neundorf e02cdba054 Kate: use cmMakefile::GetSafeDefinition() for a not-required variable
...otherwise the generator failed in embedded projects via
externalproject(), since there CMAKE_KATE_MAKE_ARGUMENT is not set.
Using GetSafeDefinition() is good enough to protect against
NULL-pointers.

Alex
2014-01-17 14:04:33 +01:00
Alex Neundorf 37104d97b0 kate: put full path to cmake into comment
Alex
2013-12-29 21:17:32 +01:00
Alex Neundorf 424d5dc078 kate: support also the build plugin in kate <= 4.12
With this patch, simply also the information used
by the build plugin in kate <= 4.12 is put into the
generated json file. The new build plugin (coming
in 4.13) simply ignores this (and vice versa).

Alex
2013-12-29 21:17:25 +01:00
Alex Neundorf 8bd6cf0f33 kate: the prev_target is not used by kate
...this was a leftover from experimenting

Alex
2013-12-29 06:40:14 +01:00
Alex Neundorf c3d20c2ac9 kate: fix ninja support
ninja needs to be run from the toplevel build dir,
not from the target dir, as make

Alex
2013-12-19 10:04:00 -05:00
Alex Neundorf 1eaf2f263b kate: remove unused function
Alex
2013-12-19 10:03:34 -05:00
Alex Neundorf 9414217b3b kate: insert build targets
This can be used by the build plugin in kate.
Code is quite similar to the one for Eclipse.

Alex
2013-11-25 10:48:34 -05:00
Alex Neundorf 644e012863 kate: add project generator for the Kate project plugin
This patch adds an extra generator for KDE's kate text editor,
or better more specifically, the project plugin.

Alex
2013-11-25 10:48:33 -05:00