1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-23 04:44:05 +08:00

1221 Commits

Author SHA1 Message Date
Brad King
1e1b31ac25 Merge topic 'xcode-pch'
476c6a8910 PCH: Fix Xcode non-pch language exclusion
fcf1fcfd0c Tests: Ignore all classes in Xcode internal objc warnings

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7166
2022-04-12 08:10:48 -04:00
Cristian Adam
476c6a8910 PCH: Fix Xcode non-pch language exclusion
Fix a regression caused by commit bbcdac4e5d (PCH: Fix all-language
precompile header support in Xcode, 2021-08-07, v3.22.0-rc1~140^2).

Fixes: #23138
2022-04-11 14:16:33 -04:00
Semyon Kolton
884d9de8b7 color: Introduce CMAKE_COLOR_DIAGNOSTICS variable
Add a variable to control both makefile color messages and compiler
color diagnostics.

Fixes: #15502
2022-03-08 16:37:08 -05:00
Marc Chevrier
4b55828a9f cmExpandListWithBacktrace: add handling of empty elements. 2022-02-06 14:32:24 +01: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
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
Nick Little
5f8c5657a9 Shorten object name even if still longer than CMAKE_OBJECT_PATH_MAX
In some cases the shortened path may end up working in practice, even if
it is over CMAKE_OBJECT_PATH_MAX, where the original path does not.
If the original path is too long, do the MD5 substitution whenever it
makes the path shorter.  Retain the warning if it is still too long.
2022-01-28 11:12:59 -05:00
NAKAMURA Takumi
780341f360 cmCustomCommand: Track main dependency explicitly
Store the main dependency as the first entry in the dependency list plus
a boolean member indicating its existence.  Note that this slightly
changes existing behavior: the main dependency was previously the last
entry of the dependency list.
2021-12-14 10:48:43 -05:00
Brad King
94a58e502b cmLocalGenerator: Remove unused IncludePathStyle infrastructure
It is unused since commit c564a3e3ff (Ninja: Always compile sources
using absolute paths, 2021-05-19, v3.21.0-rc1~129^2), which left
behind a FIXME comment to eventually remove it.
2021-12-01 11:33:30 -05:00
NAKAMURA Takumi
c46b041a3b cmLocalGenerator: Simplify Add{Custom,Utility}Command 2021-11-18 12:02:38 -05:00
NAKAMURA Takumi
e37511ae7e cmMakefile: Simplify detail:::Add{Custom,Utility}Command
Note 1: `detail::AddCustomCommandToTarget()` resets cc,
since cc is not moved away.

Note 2: In `detail::AddUtilityCommand()`, a few vars are preserved
before using. Their refs will be alive in most cases, but cc might
be destroyed in the future.
2021-11-18 12:02:37 -05:00
NAKAMURA Takumi
9b31a97748 cmCustomCommand: Move constructor arguments to individual setters
Make `cmCustomCommand` have just only default constructor.
Use each setter instead.  This follows the builder pattern.

Introduce `cc::SetOutputs(std::string output)`.
This will be used later, as substitution for `cc::SetOutputs({output})`.
2021-11-18 12:02:37 -05:00
Brad King
129e3c6540 Unity Build: Fix per-config sources in multi-config generators
Single-config generators already support unity builds with per-config
sources because they compute sources using `CMAKE_BUILD_TYPE` as the
configuration.  Each original source is either included in the unity
build source, or not.

Teach multi-config generators to compute the list of sources for
inclusion in unity builds using all configurations.  Previously they
only used the empty string as the configuration.  Each original source
may be included in some configurations, but not others.  Use
preprocessor conditions to guard their inclusion when necessary.

Fixes: #22892
2021-11-11 07:16:11 -05:00
Brad King
53990059da cmLocalGenerator: Add dedicated types to hold unity source info 2021-11-11 06:43:07 -05:00
Brad King
de6e362a88 cmLocalGenerator: Clarify name of method to write unity source include lines 2021-11-10 13:56:05 -05:00
Brad King
3017b3e7d4 cmLocalGenerator: Simplify unity source copy-if-different logic 2021-11-10 13:54:01 -05:00
Brad King
0b56f92576 cmLocalGenerator: De-duplicate unity source file generation 2021-11-10 13:53:57 -05:00
Brad King
4fd2d62613 Merge topic 'cuda_clang_cmp0105'
4707ecbe6f CUDA: Support CMP0105 on Clang
15fde4c420 CUDA: Use local shorthands for variables in Clang device link code
cf7e68087d CUDA: Avoid unnecessary allocation and GetLinkLanguage()
5b0693411e CUDA: Ignore USE_WATCOM_QUOTE for device link rules

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6709
2021-11-09 07:56:21 -05:00
Brad King
9fbbe29138 Merge topic 'nmc-reuse-from'
244550997f PCH: Fixed Ninja Multi-Config and REUSE_FROM for MSVC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6713
2021-11-09 07:53:19 -05:00
Brad King
95ea17dfd3 Merge topic 'nmc-reuse-from' into release-3.22
244550997f PCH: Fixed Ninja Multi-Config and REUSE_FROM for MSVC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6713
2021-11-09 07:53:18 -05:00
Brad King
79c21dc9bd Merge topic 'msvc-pch-reuse-config'
95fa27d94d PCH: Fix REUSE_FROM when Debug and RelWithDebInfo configs differ

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6712
2021-11-09 07:52:30 -05:00
Cristian Adam
244550997f PCH: Fixed Ninja Multi-Config and REUSE_FROM for MSVC
The copy_idb_pdb.cmake script would be executed for every configuration
for all configurations.

Debug would still want to get the RelWithDebInfo files, and the other
way around.
2021-11-08 18:16:36 +01:00
Cristian Adam
95fa27d94d PCH: Fix REUSE_FROM when Debug and RelWithDebInfo configs differ
If the Debug configuration contains `/ZI` but the RelWithDebInfo doesn't
then the copy_pdb_idb.cmake script will cause problems due to the fact
that it was common for both configurations but they are incompatible
with each other.
2021-11-08 16:51:18 +01:00
Raul Tambre
cf7e68087d CUDA: Avoid unnecessary allocation and GetLinkLanguage()
There's no reason to allocate the cmNinjaLinkLineDeviceComputer on the heap.
We can also assume the link language as CUDA in cmLocalGenerator::GetDeviceLinkFlags().
2021-11-07 21:28:08 +02:00
Brad King
efc6c23a47 bootstrap: Do not declare cmSystemTools functions that are not implemented
Convert runtime error messages into compile-time errors.
2021-10-27 12:58:02 -04:00
Sean McBride
5ba6e8ac59 Source: Replace most calls to sprintf with snprintf 2021-10-25 18:23:13 -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
3a1e6f5f59 remove cmToCStr function 2021-09-19 19:11:07 +02:00
Marc Chevrier
7e154ebd59 cmSystemTools::VersionCompare: use std::string for arguments 2021-09-17 11:58:46 +02:00
Cristian Adam
3b9e04accb PCH: MSVC: Restrict OBJECT library INTERFACE_LINK_LIBRARIES usage
The pch object file could cause problems when the reused pch is passed
through an OBJECT library, which would use INTERFACE_LINK_LIBRARIES to
link the pch object file.

Fixes: #22630
2021-09-15 10:39:46 -04: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
Marc Chevrier
dc3aa4024e Refactor: Use new SetProperty signatures 2021-08-25 10:09:10 +02:00
Marc Chevrier
5a2a275bb4 Refactor: reduce cmToCStr usage 2021-08-19 10:49:30 +02:00
Brad King
c9cd039e5f Merge topic 'LWYU-externalization'
14e57e9637 LINK_WHAT_YOU_USE feature: externalize configuration
9c5132a586 PGI: Fix "LINKER:" prefix generated separator
8a93de080c cmGeneratorTarget: Add method for LINKER: prefix translation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6306
2021-07-12 08:43:32 -04:00
Marc Chevrier
14e57e9637 LINK_WHAT_YOU_USE feature: externalize configuration
Currently, this feature is only supported on ELF platforms. So, the property
LINK_WHAT_YOU_USE will be ignored for other plateforms.
Moreover, flags and commands are now controled by CMake variables.

Fixes: #20174
2021-07-09 14:50:50 +02:00
Alexander Grund
c00f928ce1 Do not exclude include directory symlinks to entries of CPATH
Extend the fix from commit 2d0b0e2b9d (Do not exclude include
directories made implicit by CPATH, 2019-05-29, v3.14.5~2^2) to cover
include directories that are symlinks to paths listed in `CPATH`.

Compare resolved paths against resolved entries of `CPATH`.
Resolve the entries as late as possible in case symlinks change.

Fixes: #22383
2021-07-07 08:04:59 -04:00
Alexander Grund
5c02964aff cmLocalGenerator: Simplify CPATH lookup loop 2021-07-07 08:04:30 -04:00
Alexander Grund
86595b3002 cmLocalGenerator: Clarify check for membership in multiple sets 2021-07-07 08:04:30 -04:00
Alexander Grund
10969fd003 cmLocalGenerator: Remove unnecessary parentheses in a condition 2021-07-07 08:04:29 -04:00
Alexander Grund
3fd56472c6 cmLocalGenerator: Store realpath lookup result in a variable 2021-07-07 08:04:15 -04:00
Alexander Grund
429fb28f25 cmLocalGenerator: Factor out repeated condition into local variable 2021-07-06 19:19:46 -04:00
Ben Boeckel
f29e1874ad Compiler/MSVC: use the -external:I flag for system includes
See: #17904
2021-06-18 09:54:17 -04:00
Robert Maynard
b50bfc8913 HIP: Add language to CMake 2021-06-07 19:25:33 +00:00
Raul Tambre
1cb4f592a0 add_custom_command: Target-dependent generator expression support
OUTPUT variant with a TARGET given to allow resolving target-based generator
expressions wouldn't work because OUTPUT is resolved before generator targets
are created, i.e. FindGeneratorTargetToUse() returns nullptr.
This is a known limitation, see #21364.

Implements #21336.
2021-05-31 10:39:58 +03: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
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
013ec595c8 cmLocalGenerator: De-duplicate StateSnapshot member
We have the member from the cmOutputConverter parent.
2021-05-17 10:03:43 -04:00
Brad King
24bfdbcffb cmLocalGenerator: Remove unused MaybeRelativeToCurSrcDir method
With the recent update to `GetObjectFileNameWithoutTarget`, we no longer
have any call sites for `MaybeRelativeToCurSrcDir`.  It does not make
sense for the generator to produce paths relative to the source tree in
general, so remove the method.
2021-05-17 10:03:43 -04:00