Commit Graph

28 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
Daniel Pfeifer 3838a0d5fb make sure to include cmConfigure.h before cmStandardIncludes.h 2016-09-03 08:04:22 -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
Ben Boeckel a08292059e genex: remove the need for backtraces
Rather than making dummy backtraces and passing them around, just make
backtraces optional.
2014-06-05 12:44:18 -04:00
Stephen Kelly 5412deded1 cmTarget: Transitively evaluate compiler features.
Extend the interface of the target_compile_features command with
PUBLIC and INTERFACE keywords. Populate the INTERFACE_COMPILER_FEATURES
target property if they are set. Consume the INTERFACE_COMPILER_FEATURES
target property from linked dependent targets to determine the final
required compiler features and the compile flag, if needed.

Use the same pattern of origin-debugging which is used for other
build properties.
2014-04-07 18:11:18 +02:00
Stephen Kelly 3676fb4963 cmTarget: Allow transitive evaluation of SOURCES property.
Extend the cmGeneratorExpressionDAGChecker with an interface
returning the name of the top target.  Use that to determine
when there is a DAG violation, as required by the RunCMake.Languages
tests.
2014-04-02 23:14:02 +02:00
Ben Boeckel 270eb96df0 strings: Remove cmStdString references
Casts from std::string -> cmStdString were high on the list of things
taking up time. Avoid such implicit casts across function calls by just
using std::string everywhere.

The comment that the symbol name is too long is no longer relevant since
modern debuggers alias the templates anyways and the size is a
non-issue since the underlying methods are generated since it's
inherited.
2014-03-08 13:05:35 -05:00
Stephen Kelly 6eb3218105 Genex: Fix case of methods in the dag checker. 2014-01-06 18:46:45 +01:00
Stephen Kelly 646c6ec2f9 Genex: Use a preprocessor loop to implement transitive DAG check.
The other infrastructure for transitive property handling is
already using a preprocessor loop.

Implement special backward-compatibility handling of
COMPILE_DEFINITIONS_<CONFIG> using a template switch for the
extra check.
2014-01-06 18:46:45 +01:00
Stephen Kelly 711fb38f72 Genex: List transitive properties and methods as a table, not two lists.
Introduce a new set of macros to select the column.
2014-01-06 18:46:44 +01:00
Stephen Kelly 0f3e8e957f Undefine local preprocessor loop variables.
Most occurances of this pattern already contain the undef, so add it to
the rest too.
2014-01-06 17:25:10 +01:00
Stephen Kelly 98093c45db QtAutoUic: Add INTERFACE_AUTOUIC_OPTIONS target property.
Transitively consume the property from linked dependents.

Implement configuration-specific support by following the pattern
set out for compile definitions and includes in cmQtAutoGenerators.

Implement support for origin-tracking with CMAKE_DEBUG_TARGET_PROPERTIES.

This is motivated by the needs of KDE, which provides a separate
translation system based on gettext instead of the Qt linguist
translation system. The Qt uic tool provides command line options
for configuring the method used to translate text, and to add an
include directive to the generated file to provide the method.

 http://thread.gmane.org/gmane.comp.kde.devel.frameworks/7930/focus=7992

Implement the interface to provide the uic options as a usage-requirement
on the KI18n target, as designed for KDE.
2013-11-27 19:06:12 +01:00
Stephen Kelly 146493363e Genex: Simplify the preprocessor looper for interface properties.
By removing the INTERFACE_ prefix, we can use this in more contexts.
2013-11-09 20:31:35 +01:00
Brad King 41a2fb5ba0 Merge topic 'tid-system-argument'
9cf3547 Add the INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property.
1925cff Add a SYSTEM parameter to target_include_directories (#14180)
286f227 Extend the cmTargetPropCommandBase interface property handling.
83498d4 Store system include directories in the cmTarget.
f1fcbe3 Add Target API to determine if an include is a system include.
2679a34 Remove unused variable.
2013-07-16 13:59:07 -04:00
Stephen Kelly 9cf3547e1c Add the INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property.
Unlike other target properties, this does not have a corresponding
non-INTERFACE variant.

This allows propagation of system attribute on include directories
from link dependents.
2013-07-16 13:44:57 -04:00
Stephen Kelly ddde61c0b2 Introduce the LINK_ONLY generator expression.
This is an internal expression for use by target_link_libraries
for static libraries.
2013-07-08 00:00:18 +02:00
Stephen Kelly b58aff90c5 Genex: Extend EvaluatingLinkLibraries to also check the top target name.
This will allow testing whether we are evaluating the link libraries
of a particular target.
2013-06-24 16:22:15 +02:00
Stephen Kelly 0d8db250ce Use a preprocessor loop to manage the valid transitive properties.
Hopefully this will prevent regressions when adding further transitive
properties in the future.
2013-06-10 16:13:21 +02:00
Stephen Kelly 80ca9c4b41 Add COMPILE_OPTIONS target property.
This method reads generator expressions from the COMPILE_OPTIONS
target property, as well as INTERFACE_COMPILE_OPTIONS from linked
dependents.
2013-06-02 11:56:37 +02:00
Stephen Kelly 98a672528d Fix constness of accessors. 2013-02-23 09:42:24 +01:00
Stephen Kelly 089fe1c13d Optimize genex evaluation for includes and defines.
While porting boost to use these features, the generation step took
too long (several minutes before I stopped it). The reason was that
the boost libraries form a large interdependent mesh. The libraries
list their dependencies in their INTERFACE such as:

 $<LINKED:boost::core>;$<LINKED:boost::config>;$<LINKED:boost::mpl>

As boost::core already depends on the boost::config libraries, that
expression has no impact on the end-content, as it is removed after
the generation step. There is no DAG issue though, so the generator
expression evaluation would fully evaluate them. In the case of the
config library, it also depends on the core library, so all depends
are followed through that again, despite the fact that they've just
been evaluated. After this patch, the evaluation skips libraries if
they have already been seen via depends or directly in the content.

This patch keeps track of targets whose INTERFACE has been consumed
already. The INCLUDE_DIRECTORIES and COMPILE_DEFINITIONS properties
are whitelisted because repeated content will be stripped out later
during generation. For other properties now and in the future, that
may not be the case.
2013-02-02 15:06:53 +01:00
Stephen Kelly 0fa7f69c0e Add API to check if we're reading a includes or defines property.
This will allow the implementation of the LINKED generator expression.
2013-01-31 17:30:49 +01:00
Stephen Kelly e98799105b Make INTERFACE determined properties readable in generator expressions.
The properties are evaluated as link-dependent interface properties when
evaluating the generator expressions.
2013-01-20 17:06:47 +01:00
Stephen Kelly c67b8124f7 Make cycles in target properties ignored, not an error.
Constructs such as these are an error as they are direct self-references:

 set_property(TARGET foo APPEND PROPERTY
   INCLUDE_DIRECTORIES $<TARGET_PROPERTY:foo,INCLUDE_DIRECTORIES>)
 set_property(TARGET foo APPEND PROPERTY
   INCLUDE_DIRECTORIES $<TARGET_PROPERTY:INCLUDE_DIRECTORIES>)

However, this is an indirect self-reference in a cycle, and not an error:

 set_property(TARGET foo APPEND PROPERTY
   INCLUDE_DIRECTORIES $<TARGET_PROPERTY:bar,INCLUDE_DIRECTORIES>)
 set_property(TARGET bar APPEND PROPERTY
   INCLUDE_DIRECTORIES $<TARGET_PROPERTY:foo,INCLUDE_DIRECTORIES>)
2013-01-05 01:18:36 +01:00
Stephen Kelly 7e807472d2 Add API to check that dependent target properties form a DAG.
Initially this will only be used to check for self-references, but
can be extended to check for cycles when chaining properties of other
targets.
2012-09-28 08:49:21 -04:00