1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-24 05:03:26 +08:00

766 Commits

Author SHA1 Message Date
Aron Yu
feebc8394f Windows: Allow manifest files to be bundled as content 2022-02-04 10:16:55 +01:00
Raul Tambre
8f64df0a7c CUDA: Generic all and all-major support
Commit 14d8a276 (CUDA: Support nvcc 11.5 new -arch=all|all-major flags,
2021-08-17) added all and all-major options to CUDA_ARCHITECTURES. These are
fairly generic and likely to see real-world use by distributors. Thus it's
desirable to support these also for Clang and older NVCC versions.

The supported architectures are dependent on the toolkit version. We determine
the toolkit version prior to compiler detection. For NVCC we get the version
from the vendor identification output, but for Clang we need to invoke NVCC
separately.

The architecture information is mostly based on the Wikipedia list with the
earliest supported version being CUDA 7.0. This could be documented and
expanded in the future to allow projects to query CUDA toolkit version and
architecture information.
For Clang we additionally constrain based on its support.

Additionally the architecture mismatch detection logic is fixed, improved and
updated for generic support:
* Commit 01428c55 (CUDA: Fail fast if CMAKE_CUDA_ARCHITECTURES doesn't work
  during detection, 2020-08-29) enabled CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS
  if CMAKE_CUDA_ARCHITECTURES is specified. This results in
  CMakeDetermineCompilerID.cmake printing the compiler error and our code for
  presenting the mismatch in a user-friendly way being useless. The custom
  logic seems preferable so go back to not enabling it.
* Commit 14d8a276 (CUDA: Support nvcc 11.5 new -arch=all|all-major flags,
  2021-08-17) tried to support CMP0054 but forgot to add x to the interpolated
  result. Thus the conditions would always evaluate to false. This is fixed as
  a byproduct of removing NVIDIA specific checks, improving the error message
  and replacing architectures_mode with a simpler architectures_explicit.

Visual Studio support omits testing the flags during detection due to
complexities in determining the toolkit version when using it.
A long-term proper implementation would be #23161.

Implements #22860.
2022-02-01 18:25:20 +02:00
Brad King
5305d5aa1a Merge topic 'link-interface-direct'
f3ad061858 Add usage requirements to update direct link dependencies
193a999cd5 cmTarget: Add INTERFACE_LINK_LIBRARIES_DIRECT{,_EXCLUDE} backtrace storage
22d5427aa6 cmGeneratorTarget: Add LookupLinkItem option to consider own target name
f3d2eab36a cmGeneratorTarget: Fix link interface caching of partial results
d75ab9d066 cmGeneratorTarget: Clarify CMP0022 logic in ComputeLinkInterfaceLibraries
f3e9e03fe0 cmGeneratorTarget: Simplify CMP0022 warning check
216aa14997 cmGeneratorTarget: Return early from ExpandLinkItems with no items
1bc98371d1 Tests: Remove unnecessary policy setting from ObjectLibrary test
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6886
2022-01-31 10:36:55 -05:00
Brad King
f3ad061858 Add usage requirements to update direct link dependencies
Link line construction starts with `LINK_LIBRARIES` and appends
dependencies from the transitive closure of `INTERFACE_LINK_LIBRARIES`.
Only the entries of `LINK_LIBRARIES` are considered direct link
dependencies.  In some advanced use cases, particularly involving static
libraries and static plugins, usage requirements need to update the list
of direct link dependencies.  This may mean adding new items, removing
existing items, or both.

Add target properties to encode these usage requirements:

* INTERFACE_LINK_LIBRARIES_DIRECT
* INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE

Fixes: #22496
2022-01-29 06:48:13 -05:00
Brad King
22d5427aa6 cmGeneratorTarget: Add LookupLinkItem option to consider own target name 2022-01-29 06:48:12 -05:00
Brad King
f3d2eab36a cmGeneratorTarget: Fix link interface caching of partial results
`GetLinkInterface` and `GetLinkInterfaceLibraries` cache their results
to avoid repeating work.  In the case that the result does not depend on
the "head" target, they re-use results computed from the first call with
any "head" target.  However, if `GetLinkInterfaceLibraries` is called
first, then not all of the link interface is populated.  If
`GetLinkInterface` is later called, it needs to finish populating the
link interface even if a partially completed interface was cached.
2022-01-29 06:48:12 -05:00
Brad King
d75ab9d066 cmGeneratorTarget: Clarify CMP0022 logic in ComputeLinkInterfaceLibraries
Follow up commit 1d709ea2f5 (cmGeneratorTarget: Propagate backtraces
from INTERFACE_LINK_LIBRARIES, 2021-12-15), which made the logic a bit
more complicated due to having backtraces for CMP0022 NEW behavior.
2022-01-29 06:48:12 -05:00
Brad King
f3e9e03fe0 cmGeneratorTarget: Simplify CMP0022 warning check
Since commit 1d709ea2f5 (cmGeneratorTarget: Propagate backtraces from
INTERFACE_LINK_LIBRARIES, 2021-12-15) we can use the special storage of
the property directly.
2022-01-29 06:48:12 -05:00
Brad King
216aa14997 cmGeneratorTarget: Return early from ExpandLinkItems with no items 2022-01-29 06:48:12 -05:00
Brad King
4e8f24e977 PCH: Clear link interface cache when adding PCH object to it
On platforms using `CMAKE_LINK_PCH`, the implementation of
`PRECOMPILE_HEADERS_REUSE_FROM`, when re-using the PCH from one object
library in another, adds a PCH object file to the link interface.
Clear any cached link interface to ensure it is used.
2022-01-29 06:48:11 -05:00
Brad King
854e67985e cmLinkItem: Clarify name of CMP0027 check member
The only purpose of `cmLinkImplItem`'s `FromGenex` member is to decide
whether to check CMP0027.  That won't be needed for link items added by
new interfaces in the future.  Clarify the name to indicate that we do
not always need to know if the item came from a generator expression.
2022-01-29 06:48:11 -05:00
Carsten Rudolph
b2f8f0bb87 cmGlobalVisualStudio10Generator: Auto restore NuGet packages. 2022-01-22 06:35:41 -05:00
Brad King
138aabfa9d Merge topic 'vs-csharp-dotnet-sdk'
0eea32a376 VS: Add DOTNET_SDK property to generate SDK-style C# projects
a450cc9533 VS: Set ResolveNugetPackages to false for ALL_BUILD and ZERO_CHECK
fa76e5d194 cmVisualStudio10TargetGenerator: Factor out helper for classic MSBuild project

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6634
2021-12-22 08:56:22 -05:00
Sumit Bhardwaj
0eea32a376 VS: Add DOTNET_SDK property to generate SDK-style C# projects
Changes in cmVisualStudio10TargetGenerator::Generate to write .Net
SDK-style project for VS generators VS 19 and above. Also adds
documentation and tests.

Issue: #20227
2021-12-21 09:35:49 -08:00
Brad King
37af6c3311 target_link_libraries: Optionally require only target names
Optionally verify that items in `LINK_LIBRARIES` and
`INTERFACE_LINK_LIBRARIES` that can be target names are actually target
names.  Add a `LINK_LIBRARIES_ONLY_TARGETS` target property and
corresponding `CMAKE_LINK_LIBRARIES_ONLY_TARGETS` variable to enable
this new check.

Fixes: #22858
2021-12-20 12:14:07 -05:00
Brad King
5134f099a3 cmGeneratorTarget: Factor out message about reasons for a missing target 2021-12-20 09:56:52 -05:00
Brad King
ea050286e7 CMP0028: Report the target whose link interface has an offending item
Previously items linked via the link interface of a dependency were
reported in CMP0028 messages as if directly linked by a target.
Clarify the messages to indicate that an offending item is actually
in the link interface of a given target, regardless of its consumer.

Move the check to the end of generation and look through the final set
of link implementations and link interfaces that were used for
generation.  This avoids repeating messages on link interfaces that
have multiple consumers.
2021-12-16 16:43:17 -05:00
Brad King
a97c92e46e CMP0028: Report backtrace to link item rather than target creation
Now that we have proper backtraces for both `LINK_LIBRARIES` and
`INTERFACE_LINK_LIBRARIES` entries, we can report them in error
messages.
2021-12-16 12:45:27 -05:00
Brad King
0dcbf4ab58 cmGeneratorTarget: Record when imported target link iface libs are done
`GetImportLinkInterface` populates the link interface from properties
of imported targets.  Make it more closely match the link interface
of in-project targets by recording the `LibrariesDone` field.
2021-12-16 10:39:41 -05:00
Brad King
1d709ea2f5 cmGeneratorTarget: Propagate backtraces from INTERFACE_LINK_LIBRARIES 2021-12-15 12:29:47 -05:00
Brad King
9f5e0629df Merge topic 'link-iface-usage-reqs-only'
1e49880472 cmGeneratorTarget: Avoid boolean trap in usage requirement lookup

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6796
2021-12-10 09:14:53 -05:00
Brad King
1e49880472 cmGeneratorTarget: Avoid boolean trap in usage requirement lookup
Replace `bool usage_requirements_only` arguments with a proper
enumeration to clarify meaning at call sites.
2021-12-09 11:00:23 -05:00
Brad King
c749982c13 cmTargetPropertyComputer: Simplify by restoring use of cmMakefile
Logically revert commit 390a7d8647 (cmTargetPropertyComputer: Implement
GetProperty without cmMakefile, 2016-10-13, v3.8.0-rc1~445^2~9).
It relied on using `cmListFileBacktrace` to get a scope in which to
look up policies.

This does remove a backtrace from `LOCATION` property errors at generate
time, but the backtrace we reported before was incorrect.  It pointed at
the addition of a target, not to the reference to the property.
2021-12-08 10:03:48 -05:00
Brad King
4e84a4763d Merge topic 'support_nvcc_native_flag'
14d8a2768d CUDA: Support nvcc 11.5 new -arch=all|all-major flags

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Raul Tambre <raul@tambre.ee>
Merge-request: !6652
2021-11-02 08:55:13 -04:00
Robert Maynard
14d8a2768d CUDA: Support nvcc 11.5 new -arch=all|all-major flags 2021-11-01 14:57:58 -04:00
Kyle Edwards
8a09723bff cmGeneratorTarget: Integrate file sets into calculated sources 2021-10-27 15:17:23 -04:00
Sean McBride
1cf14f8c03 Source: fix many -Wmissing-prototypes warnings by marking functions static 2021-10-25 12:27:09 -04:00
Brad King
7df0541055 Add property to mark IMPORTED targets as not SYSTEM
Add an `IMPORTED_NO_SYSTEM` target property to specify this.  When
enabled, do not treat the `INTERFACE_INCLUDE_DIRECTORIES` of an imported
target as `SYSTEM` include directories.

This is similar to the existing `NO_SYSTEM_FROM_IMPORTED` property, but
works from the consumed target rather than the consumer.

Fixes: #17364
2021-10-14 13:15:48 -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
Brad King
62834c0760 Merge topic 'macos-cache-rpath-install-namedir'
2266e223c5 macOS: Speed up rpath install name dir lookup with a cache

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6543
2021-09-21 11:06:25 -04:00
Lukas Böger
2266e223c5 macOS: Speed up rpath install name dir lookup with a cache
Fixes: #20602
2021-09-20 11:15:25 -04:00
Marc Chevrier
3a1e6f5f59 remove cmToCStr function 2021-09-19 19:11:07 +02:00
Brad King
69c0a5daf9 Merge topic 'pch-xcode-multiple-languages'
bbcdac4e5d PCH: Fix all-language precompile header support in Xcode

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6435
2021-09-14 09:48:00 -04:00
Cristian Adam
bbcdac4e5d PCH: Fix all-language precompile header support in Xcode
Fixes: #22384
2021-09-13 08:12:11 -07:00
Kyle Edwards
ab94c369c9 Refactor: Convert parallel string/backtrace vectors to BT vectors 2021-09-03 09:52:14 -04:00
Marc Chevrier
5a2a275bb4 Refactor: reduce cmToCStr usage 2021-08-19 10:49:30 +02:00
Marc Chevrier
e542116814 Refactor: cmGeneratorTarget::GetSourcesProperty returns cmProp 2021-08-09 16:56:41 +02:00
Marc Chevrier
e5cd39ca80 cmProp: refactoring: transform alias in class
To handle safely the values used by CMake variables and properties,
introduce the class cmProp as a replacement from the simple pointer
to std::string instance.
2021-08-08 16:19:08 +02:00
Brad King
d9e4b47432 cmGeneratorTarget: Clarify logic recognizing explicit link interface 2021-07-13 11:53:00 -04:00
Brad King
ff97944806 cmGeneratorTarget: Clarify cmLinkImplItem constructor call 2021-07-13 11:52:59 -04:00
Brad King
8112480921 cmGeneratorTarget: Clarify ExpandLinkItems local variable role 2021-07-13 11:52:58 -04:00
Brad King
33f0505f01 cmGeneratorTarget: Simplify ExpandLinkItems signature 2021-07-13 11:31:16 -04:00
Marc Chevrier
8a93de080c cmGeneratorTarget: Add method for LINKER: prefix translation 2021-07-08 13:48:42 +02:00
Brad King
85fe60ef03 Merge topic 'tll-out-of-dir'
e27a76f131 target_link_libraries: Restore transitive out-of-dir linking

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6285
2021-06-30 07:27:49 -04:00
Brad King
e27a76f131 target_link_libraries: Restore transitive out-of-dir linking
Refactoring in commit 7f506b95a7 (cmGeneratorTarget: Refactor link item
lookup, 2021-05-26, v3.21.0-rc1~103^2~4) accidentally dropped the
persistent lookup scope tracking across multiple items that was added by
commit f0e67da061 (target_link_libraries: Fix out-of-dir linking of a
list of targets, 2020-01-14, v3.17.0-rc1~149^2).  This broke a
transitive out-of-dir linking case not covered by our test suite.
Restore the scope tracking and add a test case.

Fixes: #22363
2021-06-29 16:52:12 -04:00
Brad King
a6b075c3f8 Merge topic 'import-elf'
115ff6a347 cmELF: Include the ELF parsing code unconditionally
5dfa3ddbe5 cmELF: Allow building without system ELF headers
0da1540aaa cmELF: Fix check for TagMipsRldMapRel
e21188df8b cmELF: Open file explicitly in binary mode
70cdb36d25 Merge branch 'upstream-elf' into import-elf
7a0a37ca41 elf 2021-06-23 (f13da247)
18038042ed cmelf: Add script to import the FreeBSD ELF headers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6240
2021-06-25 07:26:35 -04:00
Alex Richardson
115ff6a347 cmELF: Include the ELF parsing code unconditionally
Now that the ELF definitions are provided on all platforms there is no
need to keep the CMake_USE_ELF_PARSER option.
2021-06-24 10:57:51 -04:00
Isuru Fernando
fe3f846e1b Makefiles: Add support for building Fortran intrinsics
Fixes: #21463
2021-06-24 08:39:47 -04:00
Zack Galbreath
8514ee9b31 HIP: analyze output of hipcc to determine default GPU architecture 2021-06-07 19:25:34 +00:00