1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-05-11 23:57:42 +08:00

59 Commits

Author SHA1 Message Date
Kitware Robot
0b96ae1f6a Revise C++ coding style using clang-format with "east const"
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.

* 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.

Issue: #26123
2025-01-23 13:09:50 -05:00
Ben Boeckel
f5056d28c5 clang-tidy: fix modernize-use-auto lints 2023-07-27 18:35:52 -04:00
NAKAMURA Takumi
67c75064d1 Source: Fix IWYU warnings in Xcode generators 2021-11-16 21:06:13 +09:00
Brad King
38335f275f Merge topic 'xcode-object-ids'
b8b6573db8 Xcode: Use deterministic object ids for script build phases
2892228dc9 cmGlobalXCodeGenerator: Add infrastructure for deterministic object ids
d250b67722 cmGlobalXCodeGenerator: Adopt pbxproj object id generation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5671
2021-01-08 09:07:18 -05:00
Brad King
d250b67722 cmGlobalXCodeGenerator: Adopt pbxproj object id generation 2021-01-06 16:21:53 -05:00
Gusts Kaksis
5651901c54 Xcode: add support for embedding frameworks
This commit also prepares for embedding things other than
frameworks. In the future, we may want to embed resources and
other types supported by Xcode, so the target properties have
been documented in a way that clearly signals the future intent.
2020-11-28 15:36:24 +11:00
Kitware Robot
bdca8b01d2 Modernize: Use #pragma once in all header files
#pragma once is a widely supported compiler pragma, even though it is
not part of the C++ standard. Many of the issues keeping #pragma once
from being standardized (distributed filesystems, build farms, hard
links, etc.) do not apply to CMake - it is easy to build CMake on a
single machine. CMake also does not install any header files which can
be consumed by other projects (though cmCPluginAPI.h has been
deliberately omitted from this conversion in case anyone is still using
it.) Finally, #pragma once has been required to build CMake since at
least August 2017 (7f29bbe6 enabled server mode unconditionally, which
had been using #pragma once since September 2016 (b13d3e0d)). The fact
that we now require C++11 filters out old compilers, and it is unlikely
that there is a compiler which supports C++11 but does not support
#pragma once.
2020-09-03 09:30:21 -04:00
Gusts Kaksis
7b3d8411a2 Xcode: Refactor build setting append code and attribute getter naming
Support both STRING and OBJECT_LIST types in build setting attributes and make it possible to mix them
2020-08-28 21:20:38 +03:00
Marc Chevrier
aacd4e4a90 Refactoring: add cm::contains to <cmext/algorithm> 2020-04-17 10:00:03 +02:00
Regina Pfeifer
d25a5a7ec9 clang-tidy: modernize-use-auto
Set the MinTypeNameLength option to an impossibly high value in order
to limit the diagnostics to iterators.  Leave new expressions and cast
expressions for later.
2019-09-10 22:21:41 +02:00
Regina Pfeifer
2dfc52675c cmAlgorithms: Add cmContains
Also, use the new function where applicable.
2019-08-19 20:01:39 +02:00
Craig Scott
98cbcedd74 Xcode: use ranged for loops, cleanup existing for loops
The changes are mostly converting old-style explicit iterator for loops
into ranged for statements. A number of for loops had already been
changed over, but local variables had been left behind instead of being
absorbed into the ranged for statement, so these have been cleaned up
too. A couple of minor improvements were made in areas already being
updated by the for loop changes to slightly simplify the code or to
avoid unnecessary conversions between `const char*` and `std::string`.
2017-11-10 13:12:57 +08:00
Matthias Maennich
f0bab294dc Convert some leftover loops to C++11 range-based loop
Fix issues diagnosed by clang-tidy [modern-loop-convert]

Signed-off-by: Matthias Maennich <matthias@maennich.net>
2017-09-28 07:23:43 -04:00
Matthias Maennich
9a2da33950 Fix some occurrences of readability-avoid-const-params-in-decls
Fix issues diagnosed by clang-tidy [readability-avoid-const-params-in-decls]

Signed-off-by: Matthias Maennich <matthias@maennich.net>
2017-09-28 07:23:42 -04:00
Matthias Maennich
bb0ad1bea8 Fix some occurrences using string by value rather than by const&
Fix issues diagnosed by clang-tidy
 - performance-unnecessary-value-param
 - performance-unnecessary-copy-initialization

Signed-off-by: Matthias Maennich <matthias@maennich.net>
2017-09-28 07:23:40 -04:00
Matthias Maennich
a5279ae553 Use C++11 nullptr (cont.)
Fix remaining occurrences of the issue addressed in commit 5962db4389
(Use C++11 nullptr, 2017-08-22) that are only showing up on macOS.

Signed-off-by: Matthias Maennich <matthias@maennich.net>
2017-09-19 11:44:21 -04:00
Daniel Pfeifer
1d829c862c Use quotes for non-system includes
Automate with:

git grep -l '#include <cm_' -- Source \
  | xargs sed -i 's/#include <\(cm_.*\)>/#include "\1"/g'

git grep -l '#include <cmsys/' -- Source \
  | xargs sed -i 's/#include <\(cmsys\/.*\)>/#include "\1"/g'

git grep -l '#include <cm[A-Z]' -- Source \
  | xargs sed -i 's/#include <\(cm[A-Z].*\)>/#include "\1"/g'
2017-04-11 22:35:21 +02:00
Daniel Pfeifer
aeff60e44c iwyu: Fix OSX specific issues 2016-11-23 00:41:44 +01:00
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
3838a0d5fb make sure to include cmConfigure.h before cmStandardIncludes.h 2016-09-03 08:04:22 -04:00
Gregor Jasny
82ebbf683e Xcode: Add function to conditionally add Xcode Attributes 2016-06-17 10:49:05 -04:00
James Touton
025edea019 Xcode: Add const qualifiers 2016-06-17 10:49:05 -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
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
Robert Goulet
b860a92582 Xcode: Refactor block writes to allow any level of nesting
Reviewed-by: Gregor Jasny <gjasny@googlemail.com>
2016-02-24 09:36:54 -05:00
Stephen Kelly
d50c4220e2 Xcode: Fix typo in comment 2015-10-26 22:30:13 +01:00
Stephen Kelly
803f190178 Xcode: Remove trailing semicolon 2015-10-26 22:30:11 +01:00
Stephen Kelly
05982b26e6 Xcode: Port API to cmGeneratorTarget. 2015-10-24 09:19:54 +02:00
Ben Boeckel
b3bf31a548 stringapi: Miscellaneous char* parameters 2014-03-08 13:05:37 -05:00
Ben Boeckel
84fdc9921c stringapi: Pass configuration names as strings 2014-03-08 13:05:36 -05: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
Ben Boeckel
fabf1fbabb stringapi: Use strings in target name 2014-03-08 13:05:31 -05:00
Ben Boeckel
ce5114354c stringapi: Use strings for the languages 2014-03-08 13:05:30 -05:00
Ben Boeckel
b26c70cc9a stringapi: Use strings for AddString methods
It gets turned into a string anyways, so pass them in.
2014-03-08 13:05:30 -05:00
Brad King
b005140451 Xcode: Each target dependency edge needs a unique object (#13935)
Generate a unique PBXTargetDependency and PBXContainerItemProxy for
every edge in the dependency graph as required by the Xcode format.
Xcode only accidentally loads project files that re-use the same
PBXTargetDependency for every edge leading to a single target.  If one
is removed by hand in the IDE then Xcode may crash due to dangling
references from the others.

Since cmGlobalXCodeGenerator::AddDependTarget is called exactly once for
every edge in the target dependency graph we do not need to keep track
of which edges have been visited to avoid generating duplicates.
2013-02-19 16:45:58 -05:00
Kitware Robot
7bbaa4283d Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with
trailing whitespace.  Wipe out all remnants of trailing whitespace
everywhere except third-party code.

Run the following shell code:

git ls-files -z -- \
 bootstrap doxygen.config '*.readme' \
 '*.c' '*.cmake' '*.cpp' '*.cxx' \
 '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \
 '*.mm' '*.pike' '*.py' '*.txt' '*.vim' |
egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' |
egrep -z -v '^(Modules/CPack\..*\.in)' |
xargs -0 sed -i 's/ \+$//'
2012-08-13 14:18:39 -04:00
David Cole
1834f232a7 Xcode: Save object id values in CMakeCache.txt (#11690)
For project and target objects, save their ids in CMakeCache.txt.

Hopefully, that will be enough to allow user settings to be saved
across multiple CMake generate operations. Other object types may
also need their ids saved: if so, more code than this commit
will be necessary...
2011-08-24 18:11:32 -04:00
Brad King
44cdae921d Xcode: Fix parallel build depends with universal binaries (#11844)
A post-build phase of each target invokes the XCODE_DEPEND_HELPER.make
file to erase any targets that link to it.  Narrow the set of targets
tested by each post-build phase to those that depend on the newly
completed target.  This avoids removing files from partially built
unrelated targets that happen to be building in parallel.
2011-06-06 17:44:11 -04:00
Johan Björk
c519bb2bb6 XCode: Also qoute [] as needed to set build-configurations. 2011-04-07 13:17:03 -04: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
698b8044a6 ENH: Simplify string attributes in Xcode generator
This change cleans up the implementation of cmXCodeObject to avoid
un-escaping and re-escaping string values.  There is no need to store
the string in escaped form.  It can be escaped once when it is printed
out to the generated project file.
2008-09-02 10:27:15 -04:00
Bill Hoffman
2745742e09 STYLE: fix some kwstyle errors 2007-07-27 10:55:24 -04:00
Ken Martin
bf5ed9b27b STYLE: fix line length 2006-05-12 14:36:39 -04:00
Andy Cedilnik
32ec28ad00 ENH: Add copy stages for bundle files 2006-03-29 15:02:35 -05:00
Ken Martin
da279f0041 BUG: some UNIX fixes for my m_ commit 2006-03-15 11:38:47 -05:00
Ken Martin
3d96e52261 STYLE: some m_ to this-> cleanup 2006-03-15 11:02:08 -05:00
Brad King
22c62c9e65 BUG: Sweeping changes to cleanup computation of target names. This should
fix many bugs related to target names being computed inconsistently.

- Centralized computation of a target's file name to a method in
  cmTarget.  Now that global knowledge is always available the
  *_CMAKE_PATH cache variables are no longer needed.

- Centralized computation of link library command lines and link
  directory search order.

- Moved computation of link directories needed to link CMake targets
  to be after evaluation of linking dependencies.

This also removed alot of duplicate code in which each version had its
own bugs.

This commit is surrounded by the tags

  CMake-TargetNameCentralization1-pre

and

  CMake-TargetNameCentralization1-post

so make the large set of changes easy to identify.
2006-01-13 18:18:32 -05:00
Bill Hoffman
8b7091a0a6 ENH: fixes for xcode21 and build styles and comments in the generated project 2005-11-16 13:13:39 -05:00
Bill Hoffman
4bc584419e ENH: fix warnings 2005-09-05 09:17:59 -04:00
Bill Hoffman
6b4c142c7d ENH: add real support for Xcode21 2005-09-02 16:29:32 -04:00