1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-22 20:34:08 +08:00

818 Commits

Author SHA1 Message Date
Pierre Testart
a525f5f1bf cmGeneratorTarget: Cache full name components
Cache the result of cmGeneratorTarget::GetFullNameInternalComponents
to improve performance.
2023-01-18 09:12:17 -05:00
Brad King
3b4337adc7 Merge topic 'clang-tidy-export-fixes-dir'
232467eb1c clang-tidy: add <LANG>_CLANG_TIDY_EXPORT_FIXES_DIR property

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7982
2022-12-07 08:19:53 -05:00
Kyle Edwards
232467eb1c clang-tidy: add <LANG>_CLANG_TIDY_EXPORT_FIXES_DIR property
Fixes: #21362
2022-12-06 10:39:29 -05:00
Brad King
5b1150e0e7 Merge topic 'link-options-cache'
7c63372c22 cmGeneratorTarget: Fix regression in CUDA device link options

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7981
2022-12-05 12:55:50 -05:00
Brad King
7c63372c22 cmGeneratorTarget: Fix regression in CUDA device link options
Since commit f69d1872db (cmGeneratorTarget: Add caches to some
functions, 2022-11-23) we cache the computed link options for a target.
Cache the host and device link options separately.
2022-12-02 11:04:16 -05:00
Brad King
3b19541518 Merge topic 'add-generator-target-caches'
f69d1872db cmGeneratorTarget: Add caches to some functions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7952
2022-11-30 07:28:12 -05:00
Pierre Testart
f69d1872db cmGeneratorTarget: Add caches to some functions
Add caches to the following cmGeneratorTarget functions in order to
improve performance:
- GetIncludeDirectories
- GetCompileOptions
- GetCompileDefinitions
- GetPrecompileHeaders
- GetLinkOptions
- GetLinkDirectories
2022-11-28 08:40:11 -08:00
Ben Boeckel
e37ff5694c cmGeneratorTarget: factor out fileset info and scanning detection 2022-11-23 18:52:36 -05:00
Ben Boeckel
9e61fc3d6d cmGeneratorTarget: factor out dyndep support detection 2022-11-23 17:35:41 -05:00
Kyle Edwards
830eed374d CMake: fix sizeof string literal violations 2022-11-18 09:37:58 -05:00
Kyle Edwards
09d7f947d6 cmGeneratorExpression: Require cmake instance 2022-11-11 12:29:41 -05:00
Brad King
7338a69881 Merge topic 'fix-cxx20-detection'
5e7c8f44ac Ninja: Restore support for compilers not defining a C++ standard level

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Jaeden Amero <kitware@patater.com>
Acked-by: Martin Kojtal <martin.kojtal@arm.com>
Merge-request: !7896
2022-11-11 08:19:51 -05:00
Lingkai Dong
5e7c8f44ac Ninja: Restore support for compilers not defining a C++ standard level
Since commit 386465bf83 (cmTarget: add support for C++ module fileset
types, 2022-04-08, v3.25.0-rc1~624^2~7), the Ninja generator checks for
C++20 support using logic that requires `CMAKE_<LANG>_STANDARD_DEFAULT`
to be non-empty.  On some compilers, such as ARMClang, CMake does not
automatically detect and set default language standards, thus causing
`HaveStandardAvailable` to raise an internal error.

To fix this issue, if `CMAKE_CXX_STANDARD_DEFAULT` is empty, assume all
standards to be supported instead of calling `HaveStandardAvailable`.
This is consistent with how `CompileFeaturesNode::Evaluate` handles this
case.

Fixes: #24146
2022-11-10 11:01:40 -05:00
ζeh Matt
eef13a4b33 VS: Add COMMON_LANGUAGE_RUNTIME support for "netcore"
Generate `CLRSupport` for Visual Studio projects.

Fixes: #22054
2022-10-28 11:55:58 -04:00
Kyle Edwards
b4e8ddbc2f clang-tidy: enable cmStrLen() check and fix violations 2022-10-19 14:51:21 -04:00
Daniel Hannon
6942234bf5 VERIFY_INTERFACE_HEADER_SETS: Add IWYU pragma: associated to verification file 2022-10-07 19:00:28 +01:00
Brad King
dc5fc898f6 Xcode: Set object file locations using TARGET_TEMP_DIR
This avoids relying on `SYMROOT` to locate the object files.

Issue: #22550
2022-09-29 15:04:07 -04:00
Brad King
06404a1979 Merge topic 'check-library-properties-fix-performances-regression'
985b4c82a6 Check link libraries properties: fix performances regression
a47eef32a3 renames method FinalizeTargetCompileInfo() in FinalizeTargetConfiguration().

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7651
2022-09-09 09:48:56 -04:00
Marc Chevrier
a47eef32a3 renames method FinalizeTargetCompileInfo() in FinalizeTargetConfiguration(). 2022-09-07 14:23:21 +02:00
Kyle Edwards
2ef64745c8 Merge topic 'file-set-source-group'
970052fedd FILE_SET: Fix source group detection
bcc3965813 Tests: Fix VS10Project SourceGroupTreeCMakeLists check

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7609
2022-08-25 09:14:21 -04:00
Kyle Edwards
970052fedd FILE_SET: Fix source group detection
Call MatchChildrenFiles() instead of MatchesFiles() in order to
account for files being in subgroups of source groups.

Fixes: #23880
2022-08-24 16:07:24 -04:00
Kyle Edwards
e7bfd0ac7a Merge topic 'all-verify-interface-header-sets'
83e44002ae VERIFY_INTERFACE_HEADER_SETS: Add verification target for all

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7536
2022-08-03 09:58:43 -04:00
Brad King
f6917a2f1f Merge topic 'cuda_add_lto_support'
96bc59b1ca CUDA: Add Device LTO support for nvcc
1527d48cd0 CheckIPO: Refactor logic selecting test source files
4a552ab4ad remove unused variables
6eda92d037 remove unused variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7389
2022-08-03 09:42:17 -04:00
Kyle Edwards
83e44002ae VERIFY_INTERFACE_HEADER_SETS: Add verification target for all
Fixes: #23802
2022-08-03 08:19:08 -04:00
Brad King
b6ffca53f8 Merge topic 'verify-interface-header-sets-interface-library-source-language'
41f15193e5 VERIFY_INTERFACE_HEADER_SETS: Fall back to global languages

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7517
2022-07-28 08:12:10 -04:00
Brad King
12830cc2a9 Merge topic 'verify-interface-header-sets-interface-library-source-language' into release-3.24
41f15193e5 VERIFY_INTERFACE_HEADER_SETS: Fall back to global languages

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7517
2022-07-28 08:12:09 -04:00
Brad King
d9cca8e83d Merge topic 'verify-interface-header-sets-add-compile-definitions'
27fd172d8d VERIFY_INTERFACE_HEADER_SETS: Finalize compile info for verify targets
626e641a19 cmTarget: Factor out FinalizeTargetCompileInfo()

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7516
2022-07-28 08:11:19 -04:00
Kyle Edwards
41f15193e5 VERIFY_INTERFACE_HEADER_SETS: Fall back to global languages
If a target doesn't have any source files, fall back to the global
list of enabled languages to determine the language of the header
file to verify.

Fixes: #23774
2022-07-27 13:29:09 -04:00
Kyle Edwards
27fd172d8d VERIFY_INTERFACE_HEADER_SETS: Finalize compile info for verify targets
Fixes: #23732
2022-07-27 12:25:15 -04:00
Robert Maynard
96bc59b1ca CUDA: Add Device LTO support for nvcc
Fixes #22200
2022-07-22 10:34:45 -04:00
Brad King
d94e09ec88 Merge topic 'cpp-named-module-file-sets'
07bc3b07ec gitlab-ci: test C++ modules using GCC
1b2270aa4e ci: add a Docker image to test out C++ modules with GCC
8c5a53096a Tests/RunCMake/CXXModules: add module-using examples
4151547e2f cmGlobalNinjaGenerator: use `cmModuleMapper` implementation
b43bdaff3c cmCxxModuleMapper: implement support for GCC's module map format
02d0f0e752 cmCxxModuleMapper: add source to handle module mapper contents
a046a45aad cmGlobalNinjaGenerator: add a TODO for header units
386465bf83 cmTarget: add support for C++ module fileset types
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7369
2022-06-17 11:35:12 -04:00
Ben Boeckel
386465bf83 cmTarget: add support for C++ module fileset types
C++ modules have two variants which are of importance to CMake:

  - `CXX_MODULES`: interface modules (those using `export module M;`,
    `export module M:part;`, or `module M:internal_part;`)
  - `CXX_MODULE_HEADER_UNITS`: importable header units

Creating C++ modules or partitions are *not* supported in any other
source listing. This is because the source files must be installed (so
their scope matters), but not part of usage requirements (what it means
for a module source to be injected into a consumer is not clear at this
moment). Due to the way `FILE_SET` works with scopes, they are a perfect
fit as long as `INTERFACE` is not allowed (which it is not).
2022-06-16 10:28:34 -04:00
Da Quexian
69beee5314 Add SYSTEM target property
If it is ON, treat INTERFACE_INCLUDE_DIRECTORIES as system include directories.

Issue: #18040

Signed-off-by: Da Quexian <daquexian566@gmail.com>
2022-06-16 00:25:27 +08:00
FeRD (Frank Dana)
98a10290a8 cmSystemTools: Fix 'ErrorOccurred' spelling
Rename the booleans 's_ErrorOccured' and 's_FatalErrorOccured' to
's_ErrorOccurred' and 's_FatalErrorOccurred', respectively.

Rename the getters and setters to 'Get[Fatal]ErrorOccurred' and
'Set[Fatal]ErrorOccurred', and fix all uses across the codebase.
2022-06-13 09:05:24 -04:00
Kyle Edwards
aadaac7f6d VERIFY_INTERFACE_HEADER_SETS: Add property for list of header sets
Add a new property, INTERFACE_HEADER_SETS_TO_VERIFY, which contains
a list of header sets that should be verified by
VERIFY_INTERFACE_HEADER_SETS.

Fixes: #23522
2022-05-25 14:37:27 -04:00
Ben Boeckel
a5f8cbe8b1 clang-tidy: address modernize-use-default-member-init lints 2022-05-24 09:09:43 -04:00
Kyle Edwards
259c265112 VERIFY_HEADER_SETS: Rename to VERIFY_INTERFACE_HEADER_SETS
Issue: #23448
2022-05-18 10:18:40 -04:00
Brad King
1cf59d5267 Merge topic 'file-set-generated-dependency'
d0d09aa29f FILE_SET: Make INTERFACE libraries with HEADER_SETS participate in buildsystem

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Ben Boeckel <ben.boeckel@kitware.com>
Acked-by: Gabriel Nützi <gnuetzi@gmail.com>
Merge-request: !7173
2022-04-15 08:23:57 -04:00
Kyle Edwards
d0d09aa29f FILE_SET: Make INTERFACE libraries with HEADER_SETS participate in buildsystem
If an INTERFACE library has HEADER_SETS, and its header sets contain
files generated by a custom command, the library needs to participate in
the buildsystem so that the files will be generated.

Fixes: #23422
2022-04-14 09:17:54 -04:00
Kyle Edwards
c798744f81 FILE_SET: Add VERIFY_HEADER_SETS target property
Fixes: #23338
2022-03-29 13:58:27 -04:00
Brad King
cf312a2e54 LINK_LIBRARIES: Add support for LINK_ONLY genex
Previously we always used content guarded by `$<LINK_ONLY:...>`
in `LINK_LIBRARIES`, even when evaluating for non-linking usage
requirements.  Add a policy to honor `LINK_ONLY` in `LINK_LIBRARIES`
the same way we already do in `INTERFACE_LINK_LIBRARIES`.
2022-03-24 08:23:55 -04:00
Brad King
41a6b4a53b INTERFACE_LINK_LIBRARIES_DIRECT: Honor link dependencies through LINK_ONLY
In commit f3ad061858 (Add usage requirements to update direct link
dependencies, 2022-01-12, v3.23.0-rc1~44^2), we evaluated the transitive
closure of `INTERFACE_LINK_LIBRARIES` as a non-linking usage requirement.
That left out `INTERFACE_LINK_LIBRARIES_DIRECT` link dependencies that
appear behind private dependencies of a static library, guarded by the
`$<LINK_ONLY:...>` generator expression.  At the time, that decision was
intentional, in order to prevent arbitrary usage requirements from
leaking out of `PRIVATE` dependencies.

Since then, we've revised evaluation of `LINK_LIBRARIES` to distinguish
between collecting link dependencies and other usage requirements.  Use
that information when following `INTERFACE_LINK_LIBRARIES` to collect
the matching kind of requirements from `INTERFACE_LINK_LIBRARIES_DIRECT`.

Fixes: #22496
2022-03-22 11:57:48 -04:00
Brad King
73337cb383 LINK_LIBRARIES: Evaluate separately for linking and usage requirements
We evaluate `LINK_LIBRARIES` and `INTERFACE_LINK_LIBRARIES` for two purposes:

* Constructing the link line.
* Collecting usage requirements.

We evaluate `INTERFACE_LINK_LIBRARIES` separately for each purpose in
order to support the `$<LINK_ONLY:...>` generator expression used to
express private link dependencies of a static library.  Previously we
only evaluated `LINK_LIBRARIES` for linking, and used that result for
collecting usage requirements too.  Therefore `$<LINK_ONLY:...>` does
not work in `LINK_LIBRARIES`.

With the introduction of `INTERFACE_LINK_LIBRARIES_DIRECT`, evaluation
of `LINK_LIBRARIES` now needs to distinguish these two cases in order to
honor link dependencies encountered through `$<LINK_ONLY:...>` without
also exposing other usage requirements through private dependencies of a
static library.  Revise internal infrastructure to distinguish the two
cases when evaluating `LINK_LIBRARIES`.  Make the information available
in code paths for `INTERFACE_LINK_LIBRARIES_DIRECT` and `LINK_ONLY`.
Defer actually using the information to later commits.

Issue: #22496
2022-03-22 11:57:48 -04:00
Brad King
687a91967f Revert INTERFACE_LINK_LIBRARIES_DIRECT feature for 3.23 branch
Revert commit f3ad061858 (Add usage requirements to update direct link
dependencies, 2022-01-12, v3.23.0-rc1~44^2) and the property storage
updates in its predecessor commit 193a999cd5 (cmTarget: Add
INTERFACE_LINK_LIBRARIES_DIRECT{,_EXCLUDE} backtrace storage,
2022-01-06, v3.23.0-rc1~44^2~1) from the 3.23 release branch.

After initial experience using the feature in practice, additional
design considerations have been raised for discussion in the original
issue.  To avoid rushing this for the 3.23 series, we've decided to
revert the feature for now so it can be revised for a future release.

Issue: #22496
2022-03-21 13:17:32 -04:00
Brad King
d1b48bfabd CUDA: Add support for CUDA_ARCHITECTURES=native
CUDA 11.6 added the `nvcc -arch=native` flag to automatically compile
for the host GPUs' architectures.  Add support for specifying this
special `native` value in `CMAKE_CUDA_ARCHITECTURES` and
`CUDA_ARCHITECTURES`.  During the compiler ABI detection step,
detect the native architectures so we can pass them explicitly
when using Clang or older versions of nvcc.

Fixes: #22375
2022-03-10 09:27:29 -05:00
Brad King
cd6341b547 Merge topic 'cuda-arch-all'
2796d6eeca CUDA: Fix CMAKE_CUDA_ARCHITECTURES=all/all-major with NVCC 11.5+
e450d55552 Help: Update CUDA_ARCHITECTURES docs for generic all/all-major support
fe64c49e72 CUDA: Simplify CMAKE_CUDA_ARCHITECTURES special value logic

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7026
2022-03-02 07:52:18 -05:00
Brad King
fe64c49e72 CUDA: Simplify CMAKE_CUDA_ARCHITECTURES special value logic
Refactor the logic checking `CMAKE_CUDA_ARCHITECTURES` special values.
Switch on the value first, and then make other decisions for each case.
This makes room for other special values to be added later.
2022-02-28 21:30:23 -05: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
Brad King
8bbca4ecf9 Merge topic 'cuda-archs'
f75299b803 CUDA: Restore support for non-"all" CUDA_ARCHITECTURES with nvcc 11.5+

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7007
2022-02-22 12:56:51 -05:00
Brad King
f75299b803 CUDA: Restore support for non-"all" CUDA_ARCHITECTURES with nvcc 11.5+
Since commit 8f64df0a7c (CUDA: Generic all and all-major support,
2021-12-19, v3.23.0-rc1~23^2), setting `CUDA_ARCHITECTURES` to a value
other than `all` or `all-major` is ignored with NVCC 11.5+.  Fix the
logic to return early only when actually using an "all" value.

Fixes: #23243
2022-02-18 12:54:12 -05:00