Commit Graph

179 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
Sebastian Holtermann 4e9b97d739 QtAutogen: Allow multiple qrc files with the same name
Use cmFilePathUuid for qrc files.
2016-08-10 13:21:33 -04:00
Sebastian Holtermann 41c9e14afb QtAutogen: Allow multiple moc files with the same name
Use cmFilePathUuid for moc files.

Closes: #12873
2016-08-10 13:21:33 -04:00
Sebastian Holtermann 3c3b37b0bb QtAutogen: Use std:: instead of ::std:: 2016-08-10 13:21:33 -04:00
Brad King 19ccd35473 Merge topic 'revert-autogen-subdirs'
5e55d87b Autogen: Revert changes to generate moc/rcc in subdirectories
2016-07-22 09:17:28 -04:00
Brad King 5e55d87bdc Autogen: Revert changes to generate moc/rcc in subdirectories
Revert these commits:

* v3.6.0-rc1~134^2
  Tests: QtAutogen: Same source name in different directories test, 2016-04-13
* v3.6.0-rc1~134^2~1
  Autogen: Generate qrc_NAME.cpp files in subdirectories, 2016-04-19
* v3.6.0-rc1~134^2~2
  Autogen: Generate not included moc files in subdirectories, 2016-04-19

They regress existing builds that depend on the paths/symbols generated
previously.  Another approach will be needed to solve the name collision
problem they were intended to solve.  Leave the error diagnostics for
the colliding cases that were added in the same topic as the above
commits because they provide a useful early failure in relevant cases.

Fixes #16209.
2016-07-21 09:27:19 -04:00
Dāvis Mosāns b1f87a50b3 Use better KWSys SystemTools::GetEnv and HasEnv signatures 2016-07-18 09:51:01 -04: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 24ab29b882 Prefer istringstream and ostringstream over stringstream.
Use istringsream for parsing, ostringstream for generation.
2016-06-14 22:37:36 +02:00
Daniel Pfeifer 7f6b8d3399 Simplify boolean expressions
Use clang-tidy's readability-simplify-boolean-expr checker.
After applying the fix-its, revise all changes *very* carefully.
Be aware of false positives and invalid changes.
2016-06-02 08:24:04 -04:00
Daniel Pfeifer 5cec953e6a Use std::replace for replacing chars in strings.
Find uses of `cmSystemTools::ReplaceString` where both `replace` and
`with` are string literals with a size of one.

Automate with:

git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\2', '\3');|g"
git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\\\\\\\\\");|std::replace(\1.begin(), \1.end(), '\2', '\\\\\\\\');|g"
git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\\\\\\\\\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\\\\\\\\', '\2');|g"
2016-05-24 23:22:20 +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
Sebastian Holtermann 9647af3f4c Autogen: Message tweaks: Compiler type (moc/qrc/ui) added to progress messages 2016-04-25 10:38:58 -04:00
Sebastian Holtermann 9b58190c8f Autogen: Message cleanups: Compose messages in std::stringstream
To avoid Race conditions with other processes writing to stdout/stderr compose
the whole message in a std::stringstream then submit the single complete message.
2016-04-25 10:38:58 -04:00
Sebastian Holtermann 9c6fa684e7 Autogen: Generate qrc_NAME.cpp files in subdirectories
A qrc_NAME.cpp file generated from NAME.qrc in the directory
CMAKE_CURRENT_SOURCE_DIR/SUBDIR
will be generated in the directory
CMAKE_CURRENT_BINARY_DIR/TARGETNAME_automoc.dir/SUBDIR
2016-04-22 08:54:25 -04:00
Sebastian Holtermann 488ea8c709 Autogen: Generate not included moc files in subdirectories (#12873)
Not included moc files generated from a source file in
CMAKE_CURRENT_SOURCE_DIR/SUBDIR
will be generated in the directory
CMAKE_CURRENT_BINARY_DIR/TARGETNAME_automoc.dir/SUBDIR/
2016-04-22 08:49:22 -04:00
Sebastian Holtermann 66caae45f6 Autogen: Check added for name collisions of generated qrc_NAME.cpp files 2016-04-22 08:49:22 -04:00
Sebastian Holtermann 663d093d45 Autogen: Check added for name collisions of generated ui_NAME.h files 2016-04-22 08:49:21 -04:00
Sebastian Holtermann 8295d43713 Autogen: Check added for name collisions of generated moc files
The test exits with an error if two or more source files
would generate the same moc file.
2016-04-22 08:49:21 -04:00
Sebastian Holtermann 840b830bc6 Autogen: Qrc processing: Generate single map with final input / output names 2016-04-19 12:59:13 -04:00
Sebastian Holtermann bc4c7751ab Autogen: Ui processing: Generate single map with final input / output names
The single map allows name collision testing (in a later commit)
2016-04-19 12:59:06 -04:00
Sebastian Holtermann 47e60bc5a0 Autogen: Split out UI file generation code to dedicated method 2016-04-19 12:52:36 -04:00
Sebastian Holtermann cf679ea8dc Autogen: Split out moc file generation code to dedicated method 2016-04-19 12:51:26 -04:00
Sebastian Holtermann 3ea1d09082 Autogen: Rename method GenerateQrc{ => Files} 2016-04-19 12:49:47 -04:00
Sebastian Holtermann 8ced8bb95a Autogen: New logCommand method. It prints commands using std::cout. 2016-04-19 12:49:22 -04:00
Sebastian Holtermann 95064a6d35 Autogen: Rename header extension Join method to JoinExts
While at it, simplify the signature and avoid a trailing separator.
2016-04-19 12:48:05 -04:00
Sebastian Holtermann 7a73c404dd Autogen: Use SystemTools string functions instead of rolling out own 2016-04-19 12:44:08 -04:00
Felix Geyer 49e82c15d5 Fix spelling typos in comments and documentation (#16037)
The Debian package checker tool (lintian) detected several typos in
CMake.
2016-03-29 14:31:02 -04:00
Brad King 091b649e19 Revert "Automoc: Fix support of files with the same name (#12873)"
This reverts commit 9beb2744d7.
Our AUTOMOC documentation states that it should be possible to
`#include "moc_foo.cpp"` in `foo.cpp`, and this will not work if
the file is placed in a different directory.  Another solution
will need to be found to the original problem.

Reported-by: Stephen Kelly <steveire@gmail.com>
2016-02-19 08:59:17 -05:00
Mariusz Pluciński 9beb2744d7 Automoc: Fix support of files with the same name (#12873) 2016-02-16 10:45:19 -05:00
Stephen Kelly 780bff5279 cmake: Store hardcoded lists of sources and headers
Don't duplicate this in each cmMakefile.
2015-10-27 07:44:22 +01:00
Stephen Kelly 20b95ef8c8 cmState: Initialize default definitions immediately.
Don't leave this as cmMakefile responsibility.
2015-10-14 00:16:20 +02:00
Stephen Kelly 360e4e1db0 Set the current dirs on the snapshot before creating the cmMakefile.
The cmMakefile should get a fully prepared snapshot and not clobber its
definitions.  It should eventually be able to process list files from any
starting-point snapshot, though that is some refactoring away still.
2015-10-07 20:19:41 +02:00
Stephen Kelly 1fe390201d QtAutogen: Port away from cmLocalGenerator. 2015-09-29 09:56:23 -04:00
Stephen Kelly 59a729b2be QtAutogen: Split initializer class into separate file. 2015-09-29 09:56:23 -04:00
Stephen Kelly 1e83a963d8 QtAutogen: Split initializer methods into separate class. 2015-09-26 19:32:54 +02:00
Stephen Kelly c3c20d3ce3 QtAutogen: Add _automoc.cpp sources before initializing. 2015-09-26 19:32:53 +02:00
Stephen Kelly 8b6ec29d40 QtAutogen: Move initialization condition to caller. 2015-09-26 19:32:53 +02:00
Stephen Kelly e791c85419 QtAutogen: Make some methods static. 2015-09-26 19:32:52 +02:00
Stephen Kelly a3ceb998d7 QtAutogen: Don't use members to initialize automoc targets. 2015-09-26 19:32:50 +02:00
Stephen Kelly dced2fe10f QtAutogen: Rename variable. 2015-09-26 19:21:49 +02:00
Stephen Kelly f9a77e76e4 QtAutogen: Don't use a member to store skipped uic files. 2015-09-26 18:48:23 +02:00
Stephen Kelly ff8ac8ee6a cmLocalGenerator: Create from already-constructed cmMakefile.
Don't manage the lifetime of the cmMakefile with cmLocalGenerator.
2015-08-28 18:44:39 +02:00
Stephen Kelly 7fdc9a8b5f QtAutogen: Use a smart pointer. 2015-08-28 18:44:38 +02:00
Stephen Kelly 92041eec49 cmGlobalGenerator: Remove MakeLocalGenerator method.
Inline implementation to callers.
2015-08-28 18:44:38 +02:00
Stephen Kelly acb006229d cmGlobalGenerator: Require a snapshot to create a local generator. 2015-08-28 18:44:38 +02:00