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

40 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
Vito Gamberini
20e9b59d5e
Linking: Add CMAKE_LANG_STANDARD_LINK_DIRECTORIES
Closes: #18222
2024-08-28 15:54:43 -04:00
Marc Chevrier
3bdf95f942 macOS: GNU toolchain: ensure framework, marked as SYSTEM, can be linked
Fixes: #25263
2023-09-21 16:29:40 +02:00
Ben Boeckel
e166bbef7b cmComputeLinkInformation: prepare Item consumers for OBJECT libraries
After b665966933 (cmComputeLinkInformation: track `OBJECT` library
dependencies, 2023-07-22), introduced in !8645 as a fix for #25112,
`OBJECT` libraries were tracked in a separate member to reduce the risk
of further regressions. This commit prepares consumers to handle
`OBJECT` libraries once they start appearing as link items.
2023-08-01 10:06:02 -04:00
Marc Chevrier
ad9020a899 Apple Frameworks: honor SYSTEM target property
Fixes: #24109
2023-05-11 10:24:18 +02:00
Jiri Malak
a1d065e5c7 Watcom: Replace WATCOMQUOTE format by UseWatcomQuote attribute
Replace WATCOMQUOTE output format by UseWatcomQuote attribute to properly handle single quote
This attribute is used globaly only for Watcom linker to handle single-quote separator instead of double-quote
it doesn't mean different output format only change of quoting separator
It is now applied to any output form SHELL/RESPONSE/NINJAMULTI if Watcom linker is used otherwise double-quote is used
2023-01-24 22:12:28 +01:00
Ben Boeckel
a5f8cbe8b1 clang-tidy: address modernize-use-default-member-init lints 2022-05-24 09:09:43 -04:00
Marc Chevrier
42965799b4 Genex: Add $<LINK_LIBRARY:...>
This generator expression offers the capability, for the link step, to
decorate libraries with prefix/suffix flags and/or adding any specific flag for each
library.

Fixes: #22812, #18751, #20078, #22703
2022-02-08 00:02:32 +01:00
Brad King
f530b3a267 OpenWatcom: Add infrastructure to link to object files 2021-05-29 09:28:36 -04:00
Brad King
8a4ca110e4 cmComputeLinkInformation: Improve type safety of item IsPath member
Use an enum to avoid implicit conversions to bool.
2021-05-29 09:28:35 -04:00
Brad King
8526756b61 cmOutputConverter: Adopt relative path conversion helpers
Move them up from cmLocalGenerator and out of cmStateDirectory.
2021-05-17 10:04:01 -04:00
Brad King
1e3af78f63 Merge topic 'swift-link-line-spaces'
af39d1b993 Swift: Fix quoting of library search paths with spaces

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4469
2020-03-12 09:32:01 -04:00
Saleem Abdulrasool
af39d1b993 Swift: Fix quoting of library search paths with spaces
The library search paths added by commit 2746c61e6d (Swift: Add library
search paths for dependencies, 2019-06-09, v3.16.0-rc1~561^2) need to be
quoted properly on command lines to handle spaces and such.  This was
already done by `cmLinkLineComputer::ComputeLinkPath` for
non-Swift-specific link directories.
2020-03-12 08:46:11 -04:00
Brad King
8752c1bd64 Merge branch 'backport-3.16-link-line-backtrace' 2020-02-10 16:17:03 -05:00
Brad King
e756328434 Propagate backtraces from LINK_LIBRARIES through to link line items
Since commit d4d0dd0f6a (cmLinkLineComputer: Add ComputeLinkLibs
overload with backtraces, 2019-09-13, v3.16.0-rc1~87^2~4), backtraces
have been collected by `ComputeLinkLibs` by looking back through the
link implementation libraries for one matching the text of the link line
item.  This is slow in projects with long link lines.

Instead, teach `cmComputeLinkDepends` and `cmComputeLinkInformation` to
carry backtrace information explicitly along with the text of each item.

Fixes: #20322
2020-02-10 16:11:38 -05:00
Kyle Edwards
5a8a9f7229 Ninja: Add multi-config variant
Co-Authored-by: vector-of-bool <vectorofbool@gmail.com>
2019-12-13 10:51:46 -05:00
Justin Goshi
7da17ef797 cmLinkLineComputer: Add ComputeLinkLibraries overload with backtraces 2019-09-18 14:00:37 -04:00
Justin Goshi
d4d0dd0f6a cmLinkLineComputer: Add ComputeLinkLibs overload with backtraces 2019-09-18 13:59:36 -04:00
Justin Goshi
0ac9dcb807 cmLinkLineComputer: Add ComputeLinkPath overload with backtraces 2019-09-18 13:59:07 -04:00
Regina Pfeifer
62e5f72289 clang-tidy: Replace typedef with using 2019-09-03 13:21:26 -04: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
Brad King
f6d6dbc293 Make CMAKE_LINK_LIBRARY_FILE_FLAG work like CMAKE_LINK_LIBRARY_FLAG
The `CMAKE_LINK_LIBRARY_FILE_FLAG` variable is meant for linkers that
want library file paths to be preceded by a flag.  This is used only
for OpenWatcom to add the `library` argument before library file paths.
Refactor the approach to treat `CMAKE_LINK_LIBRARY_FILE_FLAG` as a
command-line string fragment to add just before the library file path.
This has two advantages:

* `CMAKE_LINK_LIBRARY_FILE_FLAG` now works like `CMAKE_LINK_LIBRARY_FLAG`.
* `CMAKE_LINK_LIBRARY_FILE_FLAG` can now be an attached flag whose value
  is the library file path.

Technically this is a change in behavior, but this setting was created
for internal use and should be rarely used outside of CMake itself.

Fixes: #19541
2019-08-02 13:37:39 -04:00
Brad King
22d3eb5d5e Refactor checks for whether a target has an import library
Use `HasImportLibrary` for such checks.
2019-07-12 17:29:40 -04:00
Saleem Abdulrasool
2746c61e6d Swift: Add library search paths for dependencies
When building Swift executables and libraries which import a module, an
implicit link will be added by the driver.  Because this links by name
rather than path, the library search path needs to be provided to
indicate where to find the library.  For all local dependencies, add the
library paths for the targets when linking.  This ensures that you can
link against local libraries without explicitly setting a library path.

Fixes: #19304
2019-06-17 14:09:15 -04: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
Bruno Manganelli
33f08eec18 cmOutputConverter: Moved ContainedInDirectory to cmStateDirectory 2018-12-08 11:24:06 +00:00
Bruno Manganelli
87e810f223 cmOutputConverter: Moved ForceToRelativePath to cmSystem 2018-12-07 19:29:30 +00:00
Pavel Solodovnikov
7d5095796a Meta: modernize old-fashioned loops to range-based for.
Changes done via `clang-tidy` with some manual fine-tuning
for the variable naming and `auto` type deduction
where appropriate.
2017-09-12 16:22:47 +03:00
Daniel Pfeifer
b1ec5deaf1 Pass large types by const&, small types by value 2017-06-04 00:48:21 +02:00
Robert Maynard
8d1f9e5b85 CUDA: Now pass correct FLAGS when device link cuda executables.
Previously we had a two issues when building cuda executables
that required separable compilation. The first was that we didn't
propagate FLAGS causing any -arch / -gencode flags to be dropped, and
secondly generators such as ninja would use the CXX language flags
instead of CUDA when the executable was mixed language.
2017-01-12 15:13:36 -05:00
Daniel Pfeifer
2e620f0b38 Fix several include-what-you-use findings 2016-11-08 09:42:04 -05:00
Stephen Kelly
e0a84904eb cmState: Split auxiliary classes into separate files
Port dependents to the new locations as needed.

Leave behind a cmState.h include in cmListFileCache to reduce noise. It
is removed in a following commit.
2016-10-19 15:40:59 +02:00
Stephen Kelly
17d27893e6 cmState: Port dependent code to new cmStateDirectory name 2016-10-19 15:40:58 +02:00
Stephen Kelly
a49751fb2e cmState: Move TargetType enum to separate namespace 2016-10-19 15:40:58 +02:00
Stephen Kelly
4134030434 cmLinkLineComputer: Extract link libraries computation from cmLocalGenerator
Hide some methods which no longer need to be public.
2016-10-10 20:38:59 +02:00
Stephen Kelly
f03d446e96 cmLinkLineComputer: Move FrameworkPath computation from cmLocalGenerator
Add UseWatcomQuote state, and remove corresponding method parameters.
2016-10-10 20:38:59 +02:00
Stephen Kelly
77c4202edc cmLinkLineComputer: Move RPath computation from cmLocalGenerator
Add state for Relink and populate it at the point of cmLinkLineComputer
initialization.  This allows removal of the parameter in go-between
methods.
2016-10-10 20:38:59 +02:00
Stephen Kelly
09b6cc66b0 cmLinkLineComputer: Move LinkPath computation from cmLocalGenerator
Add a ConvertToOutputForExisting method which can be made virtual later
to satisfy different generator needs.

Pass additional strings as parameters for now.  They can be turned into
class state later.
2016-10-10 20:38:58 +02:00
Stephen Kelly
0c97806325 cmLinkLineComputer: Move ComputeLinkLibs from cmLocalGenerator
Add a cmOutputConverter to the cmLinkLineComputer and factory methods to
facilitate shell escapes.

Add state to the cmLinkLineComputer to record whether outputting for
response files or for watcom, to satisfy the cmOutputConverter API.
These are constant for the lifetime of the cmLinkLineComputer, even when
its functionality is extended in the future.  This also keeps the
signatures of cmLinkLineComputer relatively simple.

Pass the cmComputeLinkInformation as a method parameter so that
cmLinkLineComputer is free from target-specific state.  An instance
should be usable for all targets in a directory.
2016-10-10 20:38:58 +02:00
Stephen Kelly
5b361fdda0 cmLinkLineComputer: Extract from cmLocalGenerator
CMake has several classes which have too many responsibilities.
cmLocalGenerator is one of them.  Start to extract the link line
computation.  Create generator-specific implementations of the interface
to account for generator-specific behavior.

Unfortunately MSVC60 has different behavior to everything else and CMake
still generates makefiles for it.  Isolate it with MSVC60-specific
names.
2016-10-10 20:38:53 +02:00