Commit Graph

492 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
Brad King 9353d991a4 cmTarget: Remove unused support for partial construction
We no longer need to support partial construction for cmTarget instances
of type GLOBAL_TARGET.  Require all constructor arguments up front.
2016-09-15 16:02:27 -04:00
Brad King 7a2e114dd8 cmTarget: Inline SetType method at only remaining call site 2016-09-14 14:50:40 -04:00
Brad King 00e78c1990 cmTarget: Construct with basic information up front
Avoid having partially constructed cmTarget instances around,
except for the special case of GLOBAL_TARGET construction.
2016-09-14 14:50:39 -04:00
Brad King d97513d842 cmTarget: Add method to get a copy adapted for a directory
The "global" targets are built once for the top directory and then
copied into all directories.  Add a helper method to make the copy.
2016-09-14 14:50:39 -04:00
Daniel Pfeifer a2af850ba6 fix a batch of include-what-you-use violations 2016-08-17 01:08:13 +02:00
Brad King b5ec5b0901 Avoid using KWSys auto_ptr by adopting it ourselves
Replace use of cmsys::auto_ptr with a CM_AUTO_PTR macro that maps to
our own implementation adopted from the KWSys auto_ptr implementation.
Later we may be able to map CM_AUTO_PTR to std::auto_ptr on compilers
that do not warn about it.

Automate the client site conversions:

    git grep -l auto_ptr -- Source/ | grep -v Source/kwsys/ | xargs sed -i \
      's|cmsys::auto_ptr|CM_AUTO_PTR|;s|cmsys/auto_ptr.hxx|cm_auto_ptr.hxx|'
2016-06-29 09:47:58 -04:00
Daniel Pfeifer 1d6909a287 use CM_NULLPTR 2016-06-28 09:02:26 -04:00
Daniel Pfeifer ea5477e43d Make C++ feature checks extensible
Turn the feature check for cxx11_unordered_map into a function such that
we can use it for other features as well.  Drop the 11 suffix, as we may
want to check features from other standards.
2016-06-27 10:37:40 -04:00
Daniel Pfeifer 9f25fc4dbb Prefer std::ostream& over derivatives as parameters 2016-06-08 23:08:40 +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 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
Brad King b42866a34a Drop Visual Studio 6 generator
This generator has been deprecated since CMake 3.3.  Remove it.
Update documentation, modules, and tests to drop content specific
to this generator.
2016-03-09 09:42:18 -05:00
Brad King 2fd5fd1f4d Merge topic 'minor-cleanups'
13a37f5f cmMakefile: Fix typo in comment
958508bb cmMakefile: Fix style
91a829c1 Makefiles: Remove unused variable
e0213882 cmTarget: Remove obsolete member
0554c2c9 cmTarget: Fix style
b22e5d0a Remove some obsolete declarations
ce43ed2c Use LocalGenerator when possible
d90c9738 Makefiles: Remove some unneeded casts
331023ae Export: Remove unused variable
a03f3d0e cmFunctionBlocker: Constify method
d50c4220 Xcode: Fix typo in comment
803f1901 Xcode: Remove trailing semicolon
2015-10-28 08:48:08 -04:00
Stephen Kelly e021388222 cmTarget: Remove obsolete member 2015-10-27 21:54:11 +01: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 0c97d32f7a cmGlobalGenerator: Remove direct storage of targets
Find the target by looping when needed.
2015-10-27 07:44:23 +01:00
Stephen Kelly b397eae82e cmGeneratorTarget: Move LinkLanguagePropagatesToDependents from cmTarget 2015-10-27 07:44:21 +01:00
Stephen Kelly f210cb131e cmTarget: Make compatbility API explicit. 2015-10-27 07:44:20 +01:00
Stephen Kelly cf69630e51 cmGeneratorTarget: Move GetFrameworkVersion from cmTarget 2015-10-26 22:02:13 +01:00
Stephen Kelly c2c239e607 cmGlobalGenerator: Move GeneratorTargetsType to usage site. 2015-10-24 09:19:52 +02:00
Stephen Kelly d74bca5a8f cmGeneratorTarget: Copy the policy map from the cmTarget. 2015-10-21 00:52:23 +02:00
Stephen Kelly c6e8695508 cmTarget: Remove unused NameResolvesToFramework. 2015-10-21 00:52:23 +02:00
Stephen Kelly 91411641a7 Move ComputeLinkType out of cmTarget.
Keep it out of the way, so that it does not become part of cmGeneratorTarget,
but where it can be used to implement CMP0003.
2015-10-21 00:52:22 +02:00
Stephen Kelly 6d94078e62 cmGeneratorTarget: Move IsDLLPlatform from cmTarget. 2015-10-21 00:52:22 +02:00
Stephen Kelly 3ebc62850c cmGeneratorTarget: Move HaveWellDefinedOutputFiles from cmTarget. 2015-10-21 00:52:22 +02:00
Stephen Kelly 311018e5ad cmGeneratorTarget: Move GetExportMacro from cmTarget. 2015-10-21 00:52:22 +02:00
Stephen Kelly d8f8940bc6 cmGeneratorTarget: Move IsCFBundleOnApple from cmTarget. 2015-10-19 20:27:41 +02:00
Stephen Kelly 7550879f57 cmGeneratorTarget: Move IsXCTestOnApple from cmTarget. 2015-10-19 20:27:41 +02:00
Stephen Kelly 8e20ea6ef2 cmGeneratorTarget: Move IsLinkable from cmTarget. 2015-10-19 20:27:40 +02:00
Stephen Kelly eb3be7d688 cmGeneratorTarget: Move GetExportName from cmTarget. 2015-10-18 16:29:30 +02:00
Stephen Kelly beff29f0d4 cmGeneratorTarget: Move ComputeVersionedName from cmTarget. 2015-10-16 20:24:44 +02:00
Stephen Kelly 12e4790a0b cmGeneratorTarget: Move GetTargetVersion from cmTarget. 2015-10-16 20:24:44 +02:00
Stephen Kelly 1427227720 cmGeneratorTarget: Move CheckCMP0004 from cmTarget. 2015-10-16 20:24:44 +02:00
Stephen Kelly 8f363d6771 cmGeneratorTarget: Move ImportInfo from cmTarget. 2015-10-16 20:24:43 +02:00
Stephen Kelly a892b285f8 cmGeneratorTarget: Move ImportedGetLocation from cmTarget. 2015-10-16 20:24:43 +02:00
Stephen Kelly cb8c728f17 cmGeneratorTarget: Move GetFullNameImported from cmTarget. 2015-10-16 20:24:43 +02:00
Stephen Kelly 60bd9f9c92 cmGeneratorTarget: Move GetObjectLibrariesCMP0026 from cmTarget. 2015-10-16 20:17:22 +02:00
Stephen Kelly 55474e6182 cmState: Move GetTargetTypeName from cmTarget. 2015-10-15 00:41:40 +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 482b3811e4 cmTarget: Move link type enum out.
Remove a reason for generate time code to depend on the cmTarget header/type.
2015-10-15 00:41:22 +02:00
Stephen Kelly 2ee1cb85e8 cmTarget: Move ImportInfoMap out of internal class. 2015-10-15 00:41:22 +02:00
Stephen Kelly a48bcabd33 cmTarget: Move backtrace member out of internal class. 2015-10-15 00:41:21 +02:00
Stephen Kelly ce75c86ec3 cmGeneratorTarget: Move GetSupportDirectory from cmTarget. 2015-10-12 18:39:59 +02:00
Stephen Kelly 526cc7dc52 cmGeneratorTarget: Move HasImportLibrary from cmTarget. 2015-10-12 18:39:59 +02:00
Stephen Kelly 8d2e3e53b9 cmGeneratorTarget: Move HasImplibGNUtoMS from cmTarget. 2015-10-12 18:39:59 +02:00
Stephen Kelly bf2d061ad3 cmGeneratorTarget: Move FindTargetToLink from cmTarget. 2015-10-12 18:39:58 +02:00
Stephen Kelly 9ca4cae51e cmGeneratorTarget: Move GetUtilityItems from cmTarget. 2015-10-12 18:39:58 +02:00
Stephen Kelly 3e428fdcb4 cmGeneratorTarget: Move IsImportedSharedLibWithoutSOName from cmTarget. 2015-10-10 11:03:48 +02:00