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

1186 Commits

Author SHA1 Message Date
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
Brad King
5972094708 ObjectiveC: Respect OSX_ARCHITECTURES for OBJC
Fix a typo from commit 940fc62962 (macOS: Respect OSX_ARCHITECTURES for
ASM, 2020-08-21, v3.19.0-rc1~270^2).

Fixes: #22152
2021-05-05 10:45:01 -04:00
Raul Tambre
56c759b000 Per-language Win32/Console flags
Allows using different compilers with different flags for different languages.
For example Clang with GNU-like commandline for CXX and MSVC as host compiler
for CUDA.

Should help with #21914.
2021-03-17 17:51:56 +02:00
Brad King
a133a583d4 cmLocalGenerator: Clarify GetIncludeFlags signature
Make the `config` argument non-optional so all callers must be explicit.
Convert the path style argument to an enumeration to make its role clear
at call sites.

The path style argument is implemented by `ConvertToIncludeReference`,
which was introduced with the Ninja generator by commit 5b114c9bee
(Introduce a cmLocalGenerator::ConvertToIncludeReference function,
2011-09-07, v2.8.7~187^2~4).  Its only purpose is to allow the Ninja
generator to use relative paths in `-I` flags.  Add a comment explaining
this role.
2021-02-25 13:24:45 -05:00
Brad King
ab3485d15b Merge topic 'autogen-cmp0116-fix'
339dbc901f Help: Note that CMP0116 is recorded at the time of CC creation
e3740e020e Tests: Test Qt autogen target with CMP0116 set to WARN
cf34011ce7 Tests: Test per-CC behavior of CMP0116
3a95503512 Ninja: Use CMP0116 status recorded at time of custom command's creation
f01f10e8fb cmCustomCommand: Record value of CMP0116 at time of creation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5848
2021-02-24 09:44:59 -05:00
Kyle Edwards
f01f10e8fb cmCustomCommand: Record value of CMP0116 at time of creation 2021-02-23 09:14:31 -05:00
Craig Scott
28501fca94 PCH PDB: Fix misuse of IS_NEWER_THAN in timestamp check
When using a file system which only has second resolution timestamps,
there is a reasonably high likelihood of timestamps being the same.
The IS_NEWER_THAN test returns true when timestamps are the same,
so don't retry copying the PCH PDB file when they match exactly.
2021-02-22 11:02:38 -05:00
Brad King
cab99f7dba Merge topic 'xcode12-ios_install_combined'
0110aa018d IOS_INSTALL_COMBINED: Support Xcode 12 (command line only)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5785
2021-02-09 08:23:30 -05:00
Craig Scott
0110aa018d IOS_INSTALL_COMBINED: Support Xcode 12 (command line only)
Xcode 12 doesn't allow nested builds within the same build directory.
That means we can no longer do an install by building the install target
when IOS_INSTALL_COMBINED is true. We can, however, still do an install
by running the cmake_install.cmake script or executing cmake --install,
since there is no outer build and therefore the associated SDK can be
built as a sub-build.

The non-build methods previously didn't work when
IOS_INSTALL_COMBINED was true because the generated install script
and the CMakeIOSInstallCombined script both made certain assumptions
that relied on being part of a build. Those assumptions are now
removed. A side-effect of this work is that cpack now also works from the
command line when IOS_INSTALL_COMBINED is true.

Relates: #21282
Fixes: #20023
2021-02-08 18:02:46 +11:00
Cristian Adam
c450d66daa PCH: Remove restrictions for REUSE_FROM signature for MSVC
Fixes: #20201
2021-02-02 15:03:55 -05:00
Brad King
8d379e7406 Revert "PCH: Remove restrictions for REUSE_FROM signature for MSVC"
This reverts commit 9f060971411aca979807f70307d8b9fe1b43ff24.
It was merged accidentally.
2021-02-02 15:02:08 -05:00
Cristian Adam
9f06097141 PCH: Remove restrictions for REUSE_FROM signature for MSVC
Fixes: #20201
2021-02-02 19:11:44 +01:00
Ben Boeckel
ef935b17ab clang-tidy: fix readability-use-anyofallof warnings 2021-01-27 08:54:18 -05:00
Ben Boeckel
cdfc4e3195 clang-tidy: fix readability-qualified-auto warnings 2021-01-27 08:45:45 -05:00
Ben Boeckel
808b17b120 clang-tidy: fix readability-make-member-function-const warnings 2021-01-27 08:45:45 -05:00
Craig Scott
ee9da76972 Unity: Generate reproducible unity IDs for anonymous namespaces
Fixes: #21564
2021-01-23 07:14:05 +11:00
Oleksandr Koval
209daa20b2 Code style: add missed explicit 'this->'
CMake uses explicit 'this->' style. Using custom clang-tidy check we can
detect and fix places where 'this->' was missed.
2021-01-05 14:32:36 +02:00
Craig Scott
d2456b29f4 Merge topic 'unity-anon-ns'
0fe9c40494 Unity Build: Add option for generating per-file unique id

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4784
2020-12-16 07:40:41 -05:00
Brad King
34469a4f71 Merge topic 'custom-command-output-genex-nmc'
1526ae3aba Tests: Add cases for Ninja Multi-Config cross-config custom commands
dcf9f4d2f7 Ninja Multi-Config: Add support for cross-config custom commands
15467f12f7 cmLocalGenerator: Adopt custom target 'force' output name generation
7b64b0cd5a cmLocalGenerator: Refactor custom command generator construction
d29da8ed3e cmMakefile: Simplify custom target 'force' output name generation
2b1cc175ee Help: Clarify version adding add_custom_{command,target} OUTPUT genex support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5612
2020-12-16 06:20:39 -05:00
Brad King
7932e0a46e Merge topic 'ispc_control_header_suffixes' into release-3.19
c9a50f3556 ISPC: Generated Headers suffix configurable with a better default

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5597
2020-12-15 07:40:34 -05:00
Brad King
67f12dd1d6 Merge topic 'ispc_control_header_suffixes'
c9a50f3556 ISPC: Generated Headers suffix configurable with a better default

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5597
2020-12-15 07:40:34 -05:00
Brad King
3fb889a0e6 Merge topic 'support_CMAKE_VFS_OVERLAY_for_rc_compilation'
18ee6d7e32 llvm-rc: Add CMAKE_VFS_OVERLAY to the preprocessing flags

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5604
2020-12-15 07:38:20 -05:00
Kyle Edwards
dcf9f4d2f7 Ninja Multi-Config: Add support for cross-config custom commands
Co-Author: Brad King <brad.king@kitware.com>
2020-12-15 07:01:21 -05:00
Brad King
15467f12f7 cmLocalGenerator: Adopt custom target 'force' output name generation 2020-12-15 07:00:53 -05:00
Brad King
7b64b0cd5a cmLocalGenerator: Refactor custom command generator construction
Add support for constructing and using multiple generators for one
custom command.  cmGeneratorTarget contains a code path that needs this
behavior when used with Ninja but not other generators, so use virtual
dispatch through cmLocalGenerator.
2020-12-15 07:00:52 -05:00
Brad King
d29da8ed3e cmMakefile: Simplify custom target 'force' output name generation
Remove unnecessary check of policy CMP0049.  The policy can never
trigger on our internally-generated name because it has no variable
references.

The rename in commit 0ed5ce4cd8 (cmTarget: Rename AddSource method for
backward compatibility., 2014-03-17, v3.1.0-rc1~688^2~17) made it look
like this code path depended on CMP0049.  Then commit 0e1faa28cb
(cmMakefile: Separate custom command setup from actual creation,
2019-09-14, v3.16.0-rc1~85^2) and commit ea1bed34b2 (cmMakefile: Extract
utilities used for creation of custom commands, 2019-09-21,
v3.16.0-rc1~52^2~1) built additional infrastructure to thread that
dependence through the call stack.  Remove it all.
2020-12-15 07:00:52 -05:00
Stephen Kelly
0fe9c40494 Unity Build: Add option for generating per-file unique id
Fixes: #21477
2020-12-15 22:26:09 +11:00
Robert Maynard
c9a50f3556 ISPC: Generated Headers suffix configurable with a better default
The target property `ISPC_HEADER_SUFFIX` and associated global
variable now can control the suffix used when generating the
C/C++ interoperability ISPC headers.

In addition the default suffix is now "_ispc.h" which matches the
common convention that the ISPC compiler team uses and recommends.
2020-12-14 13:13:09 -05:00