Commit Graph

209 Commits

Author SHA1 Message Date
Kitware Robot
1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05:00
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
Aditya Vidyadhar Kamath
d27fe9dfba AIX: Add option to archive shared libraries
Add option `CMAKE_AIX_SHARED_LIBRARY_ARCHIVE`.

There will no versions for the shared objects when this option is used.

Closes: #26033
2024-07-17 11:52:09 -04:00
Brad King
241ee252ce IWYU: Update for Debian 12 CI job
`include-what-you-use` diagnostics, in practice, are specific to
the environment's compiler and standard library.  Update includes
to satisfy IWYU for our CI job under Debian 12.
2023-07-28 09:14:08 -04:00
Brad King
2159906731 Merge topic 'strip-macos'
689616785f macOS: Do not pass Apple-specific flags to llvm-strip

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8374
2023-03-31 08:02:20 -04:00
Brad King
689616785f macOS: Do not pass Apple-specific flags to llvm-strip
Since commit cf82300a63 (BinUtils: Clarify search logic and make it more
consistent, 2021-05-27, v3.21.0-rc1~119^2~2) we prefer `llvm-strip` over
`strip` when using Clang.  However, since commit 20291e8e72 (install:
Fix stripping on macOS, 2019-01-30, v3.14.0-rc1~31^2) on macOS we add
flags `-u -r`, needed by Apple's `strip` for executables, but that
`llvm-strip` does not need or support.  Improve the condition to add
Apple-specific flags only when the selected `strip` tool is Apple's.

Note that Apple dylibs must be stripped with `-x` with either Apple's
`strip` or `llvm-strip`.

Fixes: #24601
2023-03-29 15:19:47 -04:00
Brad King
9c14f14848 install(TARGETS): Do not apply installation tweaks to NAMELINK files
These files are symlinks to the real binaries, and we already apply
tweaks to those.  Previously we generated installation tweak code
guarded by a `NOT IS_SYMLINK` condition that is never true.  Drop the
code altogether.

Add a test covering the motivating use case, in which a `POST_BUILD`
step modifies the namelink file to not actually be a symlink.

Fixes: #24647
2023-03-28 12:06:24 -04:00
Marc Chevrier
ede33f30cf Apple: Handle generation and comsuption of text-based stubs (.tbd files)
Fixes: #24123
2023-03-01 12:23:28 +01:00
Marc Chevrier
fcbd723a50 Enhance support functions
* Avoid duplicate definiitions for IsExecutableWithExports, etc...
* Add helper IsApple()
2023-02-28 14:24:03 +01:00
Ben Boeckel
a5f8cbe8b1 clang-tidy: address modernize-use-default-member-init lints 2022-05-24 09:09:43 -04:00
Seth R Johnson
8f7e98ef09 cmInstallTargetGenerator: optimize rpath adjustments
With builds that have many internal library directories or many
external libraries, rpaths can be quite large. The cost of calling
install_name_tool thousands of times can add up to minutes on a build,
especially if virus scanning software is there to help you out. With
this change, instead of deleting and then re-adding an rpath, we ignore
it.  Likewise we batch all the rpath adjustment calls into a single command.

Before, installing SCALE (some libraries have 70+ build-time RPATHs that
get deleted, plus up to a dozen external RPATHs from upstream
dependencies that should remain in the binary) would take almost 9
minutes on my laptop, and after this change the installation takes only
30 second.
2021-09-30 15:36:35 -04:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Kyle Edwards
60e752ced8 Refactor: Move common methods into cmInstallGenerator 2021-05-31 08:41:44 -04:00
Nils Gladitz
99ff75455e install: Implement new install(CODE|SCRIPT) option ALL_COMPONENTS
In a per-component installation the generated installation scripts
are invoked once for each component.

Per default custom installation script code added by install(CODE|SCRIPT)
only runs for one specific component in this context.

The new ALL_COMPONENTS option allows custom script code to be run once
for each component being installed.
2021-05-19 19:17:58 +02:00
Brad King
f73b6879e9 cmInstallTargetGenerator: Report namelink mode with list of files 2021-03-16 11:06:46 -04:00
Brad King
e32818dd76 cmInstallGenerator: Add backtrace to all install generators 2021-01-28 12:47:58 -05:00
Brad King
5990276226 cmInstallTargetGenerator: Factor out method to get list of target files 2021-01-28 12:46:32 -05:00
Brad King
c9e87e3447 cmInstallTargetGenerator: Avoid duplicating install destination in memory 2021-01-28 12:46:32 -05:00
Brad King
6282a8e190 cmInstallTargetGenerator: Move internal helper to anonymous namespace 2021-01-28 12:46:32 -05:00
Vitaly Stakhovsky
11425041f0 cmMakefile::GetDefinition: return cmProp 2020-09-02 07:27:32 -04:00
Vitaly Stakhovsky
b36d1bdd9d Single location for cmProp typedef 2020-06-01 08:54:20 -04:00
Vitaly Stakhovsky
36aba01223 cmGeneratorTarget::GetProperty: return cmProp 2020-04-29 10:59:39 -04:00
Vitaly Stakhovsky
5e54b0cf2f cmInstallGenerator: std::string params
Several construction parameters converted to std::string
Also made a few class members const
2020-01-21 11:09:35 -05:00
Vitaly Stakhovsky
9db532f44d cmInstall*Generator: std::string params
Several construction parameters converted to std::string
Also made a few class members const
2020-01-21 09:19:13 -05:00
Brad King
ce7408514c Merge topic 'install-name-dir-genex'
a0e2e0ca97 Help: Add documentation and release notes for INSTALL_NAME_DIR genex
deeab72aae Tests: Add tests for INSTALL_NAME_DIR
3c85f11fed INSTALL_NAME_DIR: Add support for generator expressions
2ec1156b80 Refactor: Generalize cmExportInstallFileGenerator::ReplaceInstallPrefix()

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3989
2019-11-06 09:32:22 -05:00
Kyle Edwards
3c85f11fed INSTALL_NAME_DIR: Add support for generator expressions 2019-11-04 12:01:05 -05:00
Craig Scott
ac8de0dbcf RPATH: Remove stray indent in generated file(RPATH_CHANGE) command 2019-11-04 16:26:42 +11:00
Daniel Eiband
7dcf9cb83c cmGeneratorExpression: Add cmGeneratorExpression::Evaluate utility
cmGeneratorExpression::Evaluate is a shortcut when only the evaluated string is
needed or an instance of cmCompiledGeneratorExpression cannot be cached.

Fixes: #19686
2019-09-23 21:19:15 +02:00
Regina Pfeifer
f30523d090 clang-tidy: modernize-deprecated-headers 2019-09-16 10:11:13 -04:00
Sebastian Holtermann
9b334397f5 Source sweep: Use cmStrCat for string concatenation
This patch is generated by a python script that uses regular expressions to
search for string concatenation patterns of the kind

```
std::string str = <ARG0>;
str += <ARG1>;
str += <ARG2>;
...
```

and replaces them with a single `cmStrCat` call

```
std::string str = cmStrCat(<ARG0>, <ARG1>, <ARG2>, ...);
```

If any `<ARGX>` is itself a concatenated string of the kind

```
a + b + c + ...;
```

then `<ARGX>` is split into multiple arguments for the `cmStrCat` call.

If there's a sequence of literals in the `<ARGX>`, then all literals in the
sequence are concatenated and merged into a single literal argument for
the `cmStrCat` call.

Single character strings are converted to single char arguments for
the `cmStrCat` call.

`std::to_string(...)` wrappings are removed from `cmStrCat` arguments,
because it supports numeric types as well as string types.

`arg.substr(x)` arguments to `cmStrCat` are replaced with
`cm::string_view(arg).substr(x)`
2019-08-22 16:38:10 +02:00
Regina Pfeifer
d331021255 clang-tidy: isolate declarations for readability 2019-08-21 00:20:49 +02:00
Rolf Eike Beer
da26b3be89 avoid adding multiple consecutive string literals to std::string
While at it change some single character additions to be of type char.
2019-08-18 14:22:11 +02:00
Sebastian Holtermann
18b0330b86 clang-tidy: Enable performance-inefficient-string-concatenation
Enables the clang-tidy test performance-inefficient-string-concatenation
and replaces all inefficient string concatenations with `cmStrCat`.

Closes: #19555
2019-08-05 17:21:00 +02:00
Jiang Yue
f08dcbffec Property: Add INSTALL_REMOVE_ENVIROMENT_RPATH property 2019-07-25 12:30:23 -04:00
Brad King
71fbebd1dc IWYU: Fix handling of <memory> standard header
An old workaround for `std::allocator_traits<>::value_type` lints from
IWYU on `std::vector<>` usage breaks IWYU's handling of `<memory>`.
Convert the workaround to use the same approach we already use for a
workaround of `std::__decay_and_strip<>::::__type` lints.  Then update
the `<memory>` inclusions to follow the now-correct IWYU lints.
2019-07-10 11:48:56 -04:00
Dennis Klein
749ce48eb5
cmInstallTargetGenerator: Escape generated OLD_RPATH argument
On some platforms, e.g. most ELF-based ones, RPATHs may contain keywords
that match CMake's variable syntax. To prevent them from being falsely
substituted when running the cmake_install.cmake script CMake syntax
needs to be escaped.
2019-06-13 16:41:11 +02:00
Dennis Klein
9e84c7c5e8
cmInstallTargetGenerator: Introduce CMP0095
Escape coincidental CMake syntax in RPATH entries when generating the
intermediary cmake_install.cmake script.

Fixes #19225
2019-06-13 16:41:04 +02:00
Kyle Edwards
b133d14fb1 Refactor: Allow cmInstallGenerator::Compute() to return an error
This is preparation for an upcoming merge request, which will add
a new cmInstallGenerator that returns false if there are errors in
the Compute() step.
2019-05-13 10:45:36 -04:00
Brad King
90323ff051 Merge topic 'remove-exclude-from-all-warning'
d3b765d451 EXCLUDE_FROM_ALL: Don't warn if installing target excluded from all

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3002
2019-02-25 07:49:53 -05:00
Craig Scott
d3b765d451 EXCLUDE_FROM_ALL: Don't warn if installing target excluded from all
The original warning pre-dates support for install components.
There are now legitimate scenarios where an install(TARGETS)
command may list a target that is excluded from all, e.g.
hierarchical projects that will never install the component such a
target belongs to.

Fixes: #18938
2019-02-22 07:55:56 +11:00
Saleem Abdulrasool
fc8b90af2c Create and use cmGeneratorTarget::Names
Rather than taking a number of out parameters for the various names,
create a structure that is reused for both `GetLibraryNames` and
`GetExecutableNames`.  Replace uses according to the new interface.
2019-02-11 10:44:24 -08:00
Vitaly Stakhovsky
00ba28ffd0 cmMakefile::GetRequiredDefinition: return const std::string& 2019-02-07 07:35:16 -05:00
Brad King
29368abde7 Merge topic 'install-strip-macos'
20291e8e72 install: Fix stripping on macOS

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2892
2019-01-31 11:18:40 -05:00
Brad King
5107a84d46 Merge topic 'restore-install-late-framework'
f64099cf5e Merge branch 'backport-restore-install-late-framework'
95210d027a macOS: Restore compatibility for setting FRAMEWORK after install()
d9dd68cb60 macOS: Restore compatibility for setting FRAMEWORK after install()

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kyle Edwards <kyle.edwards@kitware.com>
Merge-request: !2878
2019-01-31 10:50:38 -05:00
Harry Mallon
20291e8e72 install: Fix stripping on macOS
On macOS the `strip` tool requires special arguments depending on the
type of binary to be stripped.

Fixes: #11367
Fixes: #16499
2019-01-30 22:00:16 +00:00
Brad King
95210d027a macOS: Restore compatibility for setting FRAMEWORK after install()
The `FRAMEWORK` target property affects the way the `install()` command
treats the target and so should be set first.  Our implementation
assumed that this was always the case and led to an assertion failure.
Prior to CMake 3.12 this was visible only when using an explicit
`LIBRARY ... NAMELINK_ONLY` option, but commit 0212d7c762 (install: add
NAMELINK_COMPONENT argument, 2018-04-18, v3.12.0-rc1~139^2~3) made
it possible with a simple `LIBRARY DESTINATION`.

Fully supporting out-of-order specification will require non-trivial
refactoring to defer install generator creation to generate time.
For now simply restore the old behavior of installing the framework
to the library destination and warn about the case.

Fixes: #18848
2019-01-30 08:00:06 -05:00
Brad King
d75fec5a88 Merge topic 'tidy-use-equals-default'
094f01d0f0 cleanup: Prefer compiler provided special member functions
55671b41d2 clang-tidy: Use `= default`

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Brad King <brad.king@kitware.com>
Merge-request: !2841
2019-01-29 14:07:24 -05:00
Vitaly Stakhovsky
186d9b083d cmSystemTools::Message: Add overload accepting std::string 2019-01-28 09:35:51 -05:00
Brad King
40745ad35a Merge topic 'cmake-files-directory'
3e867ed400 cmake: inlined files dir constant and removed it from cmake.h

Acked-by: Kitware Robot <kwrobot@kitware.com>
Rejected-by: vvs31415 <vstakhovsky@fastmail.com>
Merge-request: !2655
2019-01-25 08:01:26 -05:00
Regina Pfeifer
55671b41d2 clang-tidy: Use = default
Suppress some cases in `Source/cmGeneratorExpressionNode.cxx` and
`Source/cmUVHandlePtr.h` where a few older compilers require a
user-defined default constructor (with `{}`).
2019-01-25 06:44:32 -05:00