Commit Graph

54 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
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 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
Stephen Kelly a67231ac11 cmTarget: Implement ALIAS in terms of name mapping
Remove mapping to cmTarget.
2015-10-27 07:44:24 +01: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 de21168612 Port to static cmPolicies API. 2015-05-04 22:32:20 +02:00
Stephen Kelly 931e055d8c Port all cmOStringStream to std::ostringstream.
All compilers hosting CMake support the std class.
2015-01-11 17:06:03 +01:00
Brad King f70b2253f6 Merge topic 'fix_policy_diagnostics'
77b581c2 Policies: omit warnings about unset policies when they are actually set to NEW
2014-04-01 11:06:17 -04:00
Nils Gladitz 77b581c2f0 Policies: omit warnings about unset policies when they are actually set to NEW 2014-03-31 09:45:10 -04:00
Stephen Kelly 21c573f682 Remove some c_str() calls.
Use the clang RemoveCStrCalls tool to automatically migrate the
code. This was only run on linux, so does not have any positive or
negative effect on other platforms.
2014-03-11 15:03:50 +01:00
Rolf Eike Beer c768e398f9 cmMakefile: make some methods take const std::string& instead of const char*
Most callers already have a std::string, on which they called c_str() to pass it
into these methods, which internally converted it back to std::string. Pass a
std::string directly to these methods now, avoiding all these conversions.
Those methods that only pass in a const char* will get the conversion to
std::string now only once.
2014-01-16 09:28:29 -05:00
Nils Gladitz 3900fcf4a8 CMP0037: Extend policy to reserved names and custom targets
Teach add_custom_target to check the policy too.  Extend the policy to
disallow reserved target names that we use for builtin targets like
"all".

Extend the RunCMake.CMP0037 test to cover these cases.
2013-11-19 09:44:22 -05:00
Stephen Kelly 05f5fde0eb Disallow invalid target names (#13140)
Exclude Borland and NMake from the CMP0037 test. They do not accept
the colon in a target name.
2013-11-07 11:06:39 +01:00
Stephen Kelly 370bf55415 Add the ALIAS target concept for libraries and executables.
* The ALIAS name must match a validity regex.
* Executables and libraries may be aliased.
* An ALIAS acts immutable. It can not be used as the lhs
  of target_link_libraries or other commands.
* An ALIAS can be used with add_custom_command, add_custom_target,
  and add_test in the same way regular targets can.
* The target of an ALIAS can be retrieved with the ALIASED_TARGET
  target property.
* An ALIAS does not appear in the generated buildsystem. It
  is kept separate from cmMakefile::Targets for that reason.
* A target may have multiple aliases.
* An ALIAS target may not itself have an alias.
* An IMPORTED target may not have an alias.
* An ALIAS may not be exported or imported.
2013-08-02 15:21:00 +02:00
Brad King ca39c5cdd1 Optionally allow IMPORTED targets to be globally visible
Consider the case motivating commit e01cce28 (Allow add_dependencies()
on imported targets, 2010-11-19).  An imported target references a file
generated at build time by a custom target on which it depends.  Had the
file been built directly using add_library or add_executable its target
name would have been visible globally.  Therefore the imported target
representing the file should be globally visible also.

Teach the IMPORTED signature of add_(executable|library) to accept a new
"GLOBAL" option to make the imported target visible globally.
2012-01-25 14:42:31 -05:00
Alex Neundorf 50cd6cef92 Move automoc processing from add_executable/library to cmGlobalGenerator
Now automoc is enabled by setting the AUTOMOC target property to true,
instead of using the AUTOMOC keyword in add_executable() or add_library()

Alex
2011-08-16 01:45:05 +02:00
Alex Neundorf c27607baf8 Refactor SetupAutomocTarget() so it can be run after creating the target
This makes it easier to move it from InitialPass() to some other
location, e.g. FinalPass() or something else.

Alex
2011-08-16 01:27:30 +02:00
Alex Neundorf 126c6ead77 Add the cmake module required currently for automoc
Alex
2011-08-14 15:58:00 +02: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
Brad King a0715048da COMP: Fix shadowed local variable warning. 2008-02-11 17:33:46 -05:00
Brad King ac0e58dcfb ENH: Enforce global target name uniqueness.
- Error if imported target is involved in conflict
  - Error for non-imported target conflict unless
    CMAKE_BACKWARDS_COMPATIBILITY <= 2.4
  - Include OUTPUT_NAME property in error message
  - Update add_executable and add_library command documentation
2008-02-11 13:35:39 -05:00
Brad King 5594ad4885 ENH: Updated exporting and importing of targets to support libraries and configurations.
- Created cmExportFileGenerator hierarchy to implement export file generation
  - Installed exports use per-config import files loaded by a central one.
  - Include soname of shared libraries in import information
  - Renamed PREFIX to NAMESPACE in INSTALL(EXPORT) and EXPORT() commands
  - Move addition of CMAKE_INSTALL_PREFIX to destinations to install generators
  - Import files compute the installation prefix relative to their location when loaded
  - Add mapping of importer configurations to importee configurations
  - Rename IMPORT targets to IMPORTED targets to distinguish from windows import libraries
  - Scope IMPORTED targets within directories to isolate them
  - Place all properties created by import files in the IMPORTED namespace
  - Document INSTALL(EXPORT) and EXPORT() commands.
  - Document IMPORTED signature of add_executable and add_library
  - Enable finding of imported targets in cmComputeLinkDepends
2008-01-28 08:38:36 -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
Alexander Neundorf b37cc6072f COMP: compile fix and remove warning
Alex
2007-05-22 10:42:37 -04:00
Alexander Neundorf 4878c00905 ENH: add the IMPORT keyword to ADD_EXECUTABLE(), which generates an
"imported" executable target. This can then be used e.g. with
ADD_CUSTOM_COMMAND() to generate stuff. It adds a second container for
"imported" targets, and FindTarget() now takes an additional argument bool
useImportedTargets to specify whether you also want to search in the
imported targets or only in the "normal" targets.

Alex
2007-05-22 10:24:59 -04:00
Ken Martin b99129d2d8 ENH: some code cleanup 2007-03-12 10:26:59 -04:00
Brad King fcd500289b ENH: Renamed NOT_IN_ALL to EXCLUDE_FROM_ALL. 2006-10-02 12:01:20 -04:00
Brad King 1d9f287af7 ENH: Added NOT_IN_ALL option for ADD_LIBRARY and ADD_EXECUTABLE to avoid building the targets by default. 2006-10-02 11:14:00 -04:00
Ken Martin aae0bcdacf STYLE: fix line length 2006-05-10 13:50:44 -04:00
Ken Martin 3d96e52261 STYLE: some m_ to this-> cleanup 2006-03-15 11:02:08 -05:00
Bill Hoffman 7b1440ab9f ENH: fix bundles for Mac and Xcode 2006-01-05 09:13:06 -05:00
Ken Martin cc6170c494 ENH: better error checking for add library or executable with no source files 2005-06-08 16:39:29 -04:00
Andy Cedilnik 81487bdb79 BUG: If macdir does not end with '/' then add it always, not just when adding current directory 2004-08-24 11:17:25 -04:00
Bill Hoffman b41d447935 ENH: use GetRequiredDefinition instead of GetDefinition and crash 2004-08-11 16:58:09 -04:00
Brad King 3371038283 ERR: Replacing hack call to CONFIGURE_FILE command with direct call to m_Makefile->ConfigureFile. 2004-08-05 11:51:49 -04:00
Andy Cedilnik eae3d4cf06 ENH: Unify with other variables 2004-04-23 10:03:01 -04:00
Andy Cedilnik 1dbcfd2a98 ENH: Improve Mac OSX bundle support 2004-04-08 17:13:42 -04:00
Andy Cedilnik b1a7421840 ENH: Styart working on bundles support and abstract WIN32_EXECUTABLE 2004-02-28 18:59:19 -05:00
Brad King 4888c088ae ENH: Moved ExpandListVariables out of individual commands. Argument evaluation rules are now very consistent. Double quotes can always be used to create exactly one argument, regardless of contents inside. 2002-12-11 18:13:33 -05:00
Brad King 1f6a3c67b1 ENH: Added reference to Copyright.txt. Removed old reference to ITK copyright. Changed program name to CMake instead of Insight in source file header. Also removed tabs. 2002-10-23 18:03:27 -04:00
Ken Martin 7ddb408621 removed some includes 2002-09-27 16:24:10 -04:00
Bill Hoffman fc6b8e8bf7 fix const problem 2002-03-29 11:11:03 -05:00
Bill Hoffman dbdb0adce8 ENH: add ability to use ; separated lists in SET and expand them for addexecutable and addlibrary 2002-03-29 11:04:19 -05:00
Bill Hoffman 4651dbcfc6 ENH: expand variables in arguments before the commands get them 2002-03-05 18:41:24 -05:00
Sebastien Barre b253a0644d FIX: command now expands *all* args (found through FOREACH example) 2002-02-25 16:57:09 -05:00
Will Schroeder a6a43d5320 ENH:Updated copyright 2002-01-21 15:30:43 -05:00
Sebastien Barre 63cb6c7407 Expand vars in exe and lib name 2001-11-01 13:09:08 -05:00
Bill Hoffman baa28efd10 ENH: change InitialPass to take a const reference to the argument string, to avoid changes to the file cache 2001-09-20 15:08:30 -04:00
Bill Hoffman 9922155423 ENH: rename Invoke to InitialPass 2001-06-06 13:19:15 -04:00
Ken Martin 639f1fa239 added registry entry support and windows app support 2001-05-11 10:53:17 -04:00