Commit Graph

262 Commits

Author SHA1 Message Date
Marc Chevrier
0bd3efffbc Genex LINK_LIBRARY: Add support for framework with postfix 2022-09-21 16:14:36 +02:00
Marc Chevrier
fc06450ff4 Apple: Fix regression when linking a framework with postfix
Fix a regression caused by commit 40178f3c90 (cmGlobalGenerator: Add
helper to split framework path, 2022-02-10, v3.24.0-rc1~661^2~1).

Fixes: #23961
2022-09-14 14:55:27 -04:00
Marc Chevrier
e8792da04b genex-LINK_LIBRARY: ensure correct generation inside LINK_GROUP genex
This fix ensures the following pattern is correctly handled:
$<LINK_GROUP:group_feat,$<LINK_LIBRARY:lib_feat,mylib>>

With:
CMAKE_LINK_GROUP_USING_group_feat = "—START_GROUP" "—END_GROUP"
CMAKE_LINK_LIBRARY_USING_lib_feat = "—PREFIX" "—LINK <LIBRARY>" "—SUFFIX"

Before the fix, we get the following generation:
—START_GROUP —PREFIX —LINK /path/to/mylib —END_GROUP —SUFFIX
—END_GROUP and —SUFFIX are in the wrong order

After the fix, we get the correct order:
—START_GROUP —PREFIX —LINK /path/to/mylib —SUFFIX —END_GROUP
2022-07-05 10:00:04 +02:00
Marc Chevrier
45ac71d8bc Ensure targets which are frameworks can be used freely
Ensure flag -F/path/to/framework is specified during compilation step
of consumers of the framework.

Fixes: #23336
2022-03-29 13:57:11 +02:00
Marc Chevrier
1777883f8b genex-LINK_(LIBRARY|GROUP) features: update variables behavior
Variable CMAKE_LINK_(LIBRARY|GROUP)_USING_<FEATURE>_SUPPORTED is evaluated
only if CMAKE_<LANG>_LINK_(LIBRARY|GROUP)_USING_<FEATURE>_SUPPORTED is not defined.

This new behavior enable to activate a feature globally on a platform and to disable
it for some compilers and languages.
2022-03-25 12:29:28 +01:00
Marc Chevrier
0a81ea1f12 Genex-LINK_GROUP: Add possibility to group libraries at link step
Fixes: #23121
2022-02-28 10:26:26 +01:00
Marc Chevrier
01ff75b2ff cmComputeDepends::LinkEntry: introduce enum to specify item type 2022-02-25 11:08:17 +01:00
Marc Chevrier
397ee55cd6 genex-LINK_LIBRARY: rename configuration variables
To be more consistent between genex and variables as well as
the forecomming LINK_GROUP genex, rename variable *_LINK_USING_<FEATURE>*
in *_LINK_LIBRARY_USING_<FEATURE>*
2022-02-16 18:34:28 +01:00
Marc Chevrier
a2cfa2da4f GenEx/LINK_LIBRARY: Add features for framework support on Apple 2022-02-15 10:53:33 +01:00
Marc Chevrier
40178f3c90 cmGlobalGenerator: Add helper to split framework path
cmComputeLinkInformation and cmGlobalXCodeGenerator now rely on
this method to handle framework paths.
2022-02-13 15:39:14 +01:00
Marc Chevrier
2a6b0415d7 $<LINK_LIBRARY>: Add LINK_LIBRARY_OVERRIDE target property
To enable the management of incompatible $<LINK_LIBRARY> declarations,
add LINK_LIBRARY_OVERRIDE and LINK_LIBRARY_OVERRIDE_<LIBRARY> target
properties.
2022-02-08 11:41:04 +01: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
Marc Chevrier
28d7432468 cmComputeLinkInformation: use cmComputeLinkDepends::LinkEntry
In preparation of support of genex $<LINK_LIBRARY:...>, propagate
cmComputeLinkDepends::LinkEntry instances to ensure to have, when needed,
all attributes attached to the link item.
2022-02-06 14:32:24 +01:00
Brad King
1a25f057da cmComputeLinkInformation: Add context to warning about linking a directory 2021-10-27 12:58:46 -04:00
Sean McBride
37859e3244 Source: Fix clang -Wimplicit-fallthrough warnings 2021-09-28 10:53:54 -04:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Marc Chevrier
5a2a275bb4 Refactor: reduce cmToCStr usage 2021-08-19 10:49:30 +02:00
Robert Maynard
b50bfc8913 HIP: Add language to CMake 2021-06-07 19:25:33 +00: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
Kyle Edwards
d34d28e688 Genex: Add TARGET_RUNTIME_DLLS genex
Co-Authored-by: Brad King <brad.king@kitware.com>
2021-02-24 14:55:17 -05:00
Brad King
e8ae5d1c32 Merge topic 'xcode-framework-path'
5389bb4274 Xcode: Don't hard-code SDK-provided implicit framework search paths
df08f8df30 cmComputeLinkInformation: Fix misspelt private variable name
375b307bae Apple: Fix linking to frameworks that do not exist until build time

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5760
2021-02-04 08:18:21 -05:00
Craig Scott
5389bb4274 Xcode: Don't hard-code SDK-provided implicit framework search paths
When a framework is linked to a target by its full path and that
framework is located in one of the implicit framework search directories,
CMake 3.18.5 and earlier discarded that path.
ce2dee9e5b (Xcode: Don't add framework as -framework argument in
linker info list, 2020-09-28) introduced a regression which resulted in
the framework path always being added to the search path even if it
matched one of the implicit search paths. This broke the ability to do
device and simulator builds from the same configured project.

Fixes: #21678
2021-02-03 23:11:21 +11:00
Craig Scott
df08f8df30 cmComputeLinkInformation: Fix misspelt private variable name 2021-02-03 23:10:08 +11:00
Brad King
375b307bae Apple: Fix linking to frameworks that do not exist until build time
Fixes: #21621
2021-02-03 10:08:48 +11:00
Ben Boeckel
808b17b120 clang-tidy: fix readability-make-member-function-const warnings 2021-01-27 08:45:45 -05:00
Brad King
9ab77201f7 Apple: Fix linking to frameworks that do not exist until build time
Fixes: #21621
2020-12-21 11:50:54 -05:00
Gusts Kaksis
ce2dee9e5b Xcode: Don't add framework as -framework argument in linker info list 2020-10-02 22:13:00 +10:00
Vitaly Stakhovsky
11425041f0 cmMakefile::GetDefinition: return cmProp 2020-09-02 07:27:32 -04:00
Vitaly Stakhovsky
f37c14e930 Source: use cmNonempty() 2020-07-28 08:31:31 -04:00
Vitaly Stakhovsky
7156911242 cmIsOn: add overload accepting const std::string* 2020-07-14 08:22:24 -04:00
Vitaly Stakhovsky
9b236b5451 cmComputeLinkInformation: members use std:string arguments 2020-07-10 10:22:50 -04:00
Brad King
a432b1075c Merge topic 'getdef-expand'
7ed8c9ebe3 cmMakefile: add GetDefExpandList() that splits value into std::vector

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4819
2020-06-02 08:02:24 -04:00
Vitaly Stakhovsky
b36d1bdd9d Single location for cmProp typedef 2020-06-01 08:54:20 -04:00
Vitaly Stakhovsky
7ed8c9ebe3 cmMakefile: add GetDefExpandList() that splits value into std::vector
Combines cmMakefile:GetDefinition() and cmExpandList()
2020-05-30 08:59:20 -04:00
Brad King
4468acb979 CUDA: Factor runtime library lookup into helper method 2020-05-22 08:15:32 -04:00
Vitaly Stakhovsky
36aba01223 cmGeneratorTarget::GetProperty: return cmProp 2020-04-29 10:59:39 -04:00
Marc Chevrier
aacd4e4a90 Refactoring: add cm::contains to <cmext/algorithm> 2020-04-17 10:00:03 +02:00
Ben Boeckel
609c3b7cdc cmComputeLinkInformation: reserve space in built-up string
This should avoid any reallocations that would occur in this function.
2020-04-13 11:26:03 -04:00
Ben Boeckel
59b7adddc4 nits: replace some "c" instances with 'c' 2020-04-13 11:26:03 -04:00
Ben Boeckel
f2a33107be clang-tidy: address bugprone-branch-clone lints
Arguably, many of these are bugs in `clang-tidy`. An if/else tree with
other conditionals between cloned blocks may be relying on the
intermediate logic to fall out of the case and inverting this logic may
be non-trivial.

See: https://bugs.llvm.org/show_bug.cgi?id=44165
2020-04-13 11:26:02 -04:00
Rolf Eike Beer
ef778d77e0 replace std::string::substr() with operations that do not allocate memory
Modify the original string instead of creating a new copy with substr() when it
is not used for anything else afterwards.
2020-03-23 22:41:44 +01:00
Rolf Eike Beer
48adc29721 replace "std::string::find(x) == 0" with cmHasPrefix() 2020-03-23 22:41:43 +01: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
Brad King
cb8bd146c9 Merge topic 'modernize-memory-management'
b50b2755da cmComputeLinkInformation: modernize memory management

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4285
2020-01-28 11:03:34 -05:00
Robert Maynard
0d0145138f CUDA: Add abstraction for cuda runtime selection
Fixes #17559
Replace our hard-coded default of cudart=static with a first-class abstraction to select the runtime library from an enumeration of logical names.
2020-01-27 16:02:26 -05:00
Marc Chevrier
b50b2755da cmComputeLinkInformation: modernize memory management 2020-01-26 14:01:45 +01:00
Kitware Robot
ed98209ddc Revise include order using clang-format-6.0
Run the `clang-format.bash` script to update our C and C++ code to a new
include order `.clang-format`.  Use `clang-format` version 6.0.
2019-10-01 12:26:36 -04:00
Brad King
4ade1b00c5 Merge topic 'fileapiLinkPathAndLinkDirBacktraces'
4d6334824d fileapi: add backtraces for LINK_PATH and LINK_DIRECTORIES
5bd65dff7a cmLocalGenerator: Add OutputLinkLibraries overload with backtraces
5d39e792ae cmGeneratorTarget: Store backtrace for target LINK_DIRECTORIES property
7da17ef797 cmLinkLineComputer: Add ComputeLinkLibraries overload with backtraces
d4d0dd0f6a cmLinkLineComputer: Add ComputeLinkLibs overload with backtraces
0ac9dcb807 cmLinkLineComputer: Add ComputeLinkPath overload with backtraces
0c6468178a cmComputeLinkInformation: Add GetDirectoriesWithBacktraces
a209b31d0d cmComputeLinkInformation: Add AppendValues with backtraces

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3805
2019-09-20 10:22:01 -04:00