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

1213 Commits

Author SHA1 Message Date
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
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
Brad King
d6fe1bdb6d cmLocalGenerator: Localize logic mapping source path to object file name
We select an object file name based on the path to its source file.
Localize the logic for shortening this via relative paths.  It does not
need to use the generator-wide relative path conversion rules because we
are not actually generating a relative path that needs to be consistent
with anything else.
2021-05-17 10:03:43 -04:00
Marc Chevrier
929c8a7860 INTERFACE_POSITION_INDEPENDENT_CODE must be transitive for OBJECT library
Fixes: #22174
2021-05-14 16:40:53 +02:00
Brad King
15fa320071 cmLocalGenerator: Factor out relative path conversion helpers
Most calls to `MaybeConvertToRelativePath` use one of our common work
directories (e.g. top of the build tree) as the local path.  Add helpers
for each of the common cases to simplify and clarify call sites.
2021-05-13 12:47:25 -04:00
Brad King
ba7b939831 cmStateDirectory: Rename ConvertToRelPathIf{Not => }Contained
The "Not" in the method name is backward from its logic.
2021-05-12 15:53:37 -04:00
Vitaly Stakhovsky
5e8fa0b7bc Source: Minor code improvements 2021-05-11 11:20:04 -04:00
Vitaly Stakhovsky
ce97b7909b Source: Remove unnecessary comparisons to nullptr 2021-05-10 11:44:53 -04:00
Josef Angstenberger
5950e54325
Source: Fix typos and spelling in comments 2021-05-07 17:00:18 +02:00
Brad King
50225fb306 Merge topic 'objc-osx-architectures'
5972094708 ObjectiveC: Respect OSX_ARCHITECTURES for OBJC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6090
2021-05-06 10:10:18 -04:00