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

1073 Commits

Author SHA1 Message Date
Ben Boeckel
2c8361f923 cxxmodules: link to std-providing targets when available 2024-04-11 10:19:44 -04:00
Ben Boeckel
15cd73d6c2 cmGlobalGenerator: compute target features before synthetic targets
For `import std;` support, CMake needs to know the standard library
involved in order to ensure that the right target is linked. Afterwards,
the created synthetic targets need their target compile features
computed.
2024-04-11 10:19:44 -04:00
Brad King
fbd1091d8b Merge topic 'compiler-path-normalization'
26e79ed299 Fix regression on reconfigure with unnormalized -DCMAKE_<LANG>_COMPILER=
1d485a8b45 Tests/RunCMake/CompilerChange: Simplify test cases

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Ashay Rane <ashay.r@gmail.com>
Merge-request: !9416
2024-04-11 08:35:35 -04:00
Brad King
26e79ed299 Fix regression on reconfigure with unnormalized -DCMAKE_<LANG>_COMPILER=
Since commit 3f2a5971c0 (Modules: CMAKE_*_COMPILER convert path to cmake
path, 2023-12-02, v3.29.0-rc1~292^2) we normalize the path to the
compiler.  Update our logic that checks whether the compiler has changed
to account for path normalization.

Fixes: #25883
Issue: #25456
2024-04-10 12:03:17 -04:00
Vitaly Stakhovsky
1a49b439a5 Source: Use cmValue::IsOn and IsOff
Speed up a bit by calling members directly.
2024-03-17 19:05:37 -04:00
Brad King
2ce2aebb6f Merge topic 'restore-link-interface-objlib-with-unity'
5b8e9e068f Restore support for TARGET_OBJECTS in link interfaces with unity builds
1313c78a9c Tests: Update RunCMake.TargetObjects cmake_minimum_required version

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9279
2024-02-22 08:26:12 -05:00
Brad King
312d0ccb6b Merge topic 'restore-link-interface-objlib-with-unity' into release-3.29
5b8e9e068f Restore support for TARGET_OBJECTS in link interfaces with unity builds
1313c78a9c Tests: Update RunCMake.TargetObjects cmake_minimum_required version

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9279
2024-02-22 08:26:11 -05:00
Brad King
5b8e9e068f Restore support for TARGET_OBJECTS in link interfaces with unity builds
This was broken by commit df08c37a42 (cmGlobalGenerator: Add unity/pch
sources after computing compile features, 2024-02-02, v3.28.3~1^2~1^2),
and 3.28.2's commit 76b5383123 (cmGlobalGenerator: add unity sources
after computing target compile features, 2024-01-01, v3.28.2~17^2~1).

The problem is very similar to that fixed by commit 4e8f24e977 (PCH:
Clear link interface cache when adding PCH object to it, 2022-01-24,
v3.23.0-rc1~44^2~9).  Generalize that fix.

Fixes: #25696
2024-02-21 17:08:57 -05:00
Brad King
666d2e6451 Merge topic 'restore-pch-with-unity'
30829da506 Unity: Clarify source comments on unity build transformation
87bf1c6c33 Merge branch 'unity-after-compile-features' into restore-pch-with-unity
df08c37a42 cmGlobalGenerator: Add unity/pch sources after computing compile features
004c3c3986 Tests: Add case covering PCH in a unity build

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !9215
2024-02-05 09:57:19 -05:00
Brad King
30829da506 Unity: Clarify source comments on unity build transformation 2024-02-02 09:43:27 -05:00
Brad King
df08c37a42 cmGlobalGenerator: Add unity/pch sources after computing compile features
Sources that will be scanned for C++ module dependencies need to be
excluded from unity builds.  We need to compute compile features in
order to know which sources will be scanned.  Unity build and PCH
sources can be added afterward without changing the compile features.

This re-implements commit 76b5383123 (cmGlobalGenerator: add unity
sources after computing target compile features, 2024-01-01,
v3.28.2~17^2~1) using a simpler approach that also preserves support for
PCH with Unity builds.

Issue: #25650
Co-authored-by: Ben Boeckel <ben.boeckel@kitware.com>
2024-02-02 09:39:13 -05:00
Brad King
446abdf324 Merge topic 'cxxmodules-no-unity'
63bbb3768d cmLocalGenerator: ignore scanned sources for unity builds
76b5383123 cmGlobalGenerator: add unity sources after computing target compile features
7fc2a83fe6 Tests/CXXModules: add a test with unity build support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9118
2024-01-10 10:15:46 -05:00
Ben Boeckel
76b5383123 cmGlobalGenerator: add unity sources after computing target compile features
We need to know which sources will be scanned for C++ module
dependencies in order to exclude them from unity builds.  The
addition of unity sources will not change the set of features.
2024-01-05 14:19:42 -05:00
Evan Wilde
64b3367845 cmGlobalGenerator: Allow passing language to GetLangaugeOutputExtension
The original GetLanguageOutputExtension took a sourcefile instead of the
name of the language itself. This implementation provided a convenient
handler for when the SourceFile doesn't know what language it is, but
there are times where we know the language, but don't necessarily have a
source file. Adding an overload that takes the name of the language and
returns the extension of that language, or empty string if no extension
is registered.
2023-12-04 19:15:20 -05:00
Brad King
6f936245c2 Merge topic 'ccmake-install-rds-crash'
d01120a47a cmGlobalGenerator: clear RuntimeDependencySet members at configure

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9013
2023-11-30 09:03:51 -05:00
Ben Boeckel
d01120a47a cmGlobalGenerator: clear RuntimeDependencySet members at configure
Commit f2617cf8e6 (Source: Add cmInstallRuntimeDependencySet,
2021-05-19) introduced via !6186 to 3.21 added storage to the global
generator for runtime dependency sets. However, this was not cleared at
the start of configure in the `ClearGeneratorMembers()` method. When
using `ccmake` to configure (and, presumably `cmake-gui` too), projects
using `install(TARGETS … RUNTIME_DEPENDENCY_SET)` would use dependency
set tracking instances from previous configure runs that held references
to targets free'd with the `cmMakefile` instance that held them.

Clear the dependency sets at the beginning of configure so that they are
not remembered and trigger via use-after-free bugs when used.

Fixes: #25446
2023-11-29 08:34:21 -05:00
Brad King
cdd741ebf9 Merge branch 'backport-ci-fedora-39' into ci-fedora-39 2023-11-17 11:35:41 -05:00
Brad King
2744f14db1 codespell: Fix typos 2023-11-17 09:58:21 -05:00
William Sciaroni
5e0c1777a3 Optionally make test target depend on all
Fixes: #8774
2023-11-10 13:19:11 -05:00
Ben Boeckel
186673ba0b cmGlobalGenerator: hint about missing extensions on Windows
Discussed on Discourse:

    https://discourse.cmake.org/t/cross-compiling-from-a-windows-host-targeting-raspbian-32-bits-arm/9250
2023-10-24 11:21:31 -04:00
Cristian Le
b37b912e8f CMAKE_PROJECT_INCLUDE: Allow to run module files
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
2023-10-18 18:01:05 +02:00
Ben Boeckel
7a4c02cb38 cmGlobalGenerator: factor out messaging for CMP0037
Also make some strings into character literals.
2023-09-25 17:39:35 -04:00
Ben Boeckel
34b393f97f cmGlobalGenerator: use static string views for reserved targets
Also make the array static.
2023-09-25 17:39:35 -04:00
Ben Boeckel
80d6544398 cxxmodules: generate synthetic targets as an initial pass
We need to be able to construct BMIs that will be usable from the client
modules for the target importing the module, so create BMI-only
compilation rules for `IMPORTED` targets to create these BMIs.
2023-08-17 14:42:53 -04:00
Ben Boeckel
4980f47b46 cmGlobalGenerator: always support generating rule hashes 2023-08-08 14:25:01 -04:00
Brad King
241ee252ce IWYU: Update for Debian 12 CI job
`include-what-you-use` diagnostics, in practice, are specific to
the environment's compiler and standard library.  Update includes
to satisfy IWYU for our CI job under Debian 12.
2023-07-28 09:14:08 -04:00
Ben Boeckel
2a74f641db cmGlobalGenerator: use single chars where possible 2023-07-19 16:32:33 -04:00
Ben Boeckel
cfdb5c970c cmGlobalGenerator: use cmStrCat where possible 2023-07-19 16:32:25 -04:00
Clemens Wasser
b928f52983 cmGlobalGenerator: Remove unused windows.h include 2023-06-22 18:11:45 +02:00
Clemens Wasser
1bb0e59318 codecvt: Extrace codecvt::Encoding to remove codecvt includes 2023-06-22 18:11:45 +02:00
Ben Boeckel
0183e1bca3 cxxmodules: remove CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP variable
It is now subsumed by the UUID setting completely.
2023-06-01 14:43:26 -04:00
Brad King
aa3675d281 Merge topic 'cmake-compile-no-warning-as-error'
da27ff1e96 Preserve --compile-no-warning-as-error in automatic CMake re-runs
e0b48284a1 Xcode: Internally uses -S instead of -H to specify source directory

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8522
2023-06-01 09:45:56 -04:00
Brad King
c4f273e722 Merge topic 'AddCacheEntry-suppress-raw-pointer-usage'
4fc322bab4 AddCacheEntry: Suppress raw pointer usage

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8520
2023-05-31 09:35:25 -04:00
Brad King
5b063510f9 Merge topic 'cmake-verbose-print-build-tool-command'
8451a3f0b5 cmGlobalGenerator: use a stream for output in `Build`
e060666531 cmake: write the build command itself with `--verbose`
b017c9f127 cmGlobalGenerator: fix off-by-one for `&&` command joining
c715fd8d76 cmGlobalGenerator: quote commands in `::Build` output
d6c0e827bc cmGlobalGenerator: add a `QuotedPrintable` method for commands
28ee3bef34 cmGlobalGenerator: add missing spaces in output
465ab8d872 cmGlobalGenerator: use `cmStrCat` in `::Build`
81d45dabc4 cmOutputConverter: add a `static` version of `EscapeForShell`

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !8183
2023-05-31 09:33:26 -04:00
Brad King
da27ff1e96 Preserve --compile-no-warning-as-error in automatic CMake re-runs
When the build system re-runs `cmake` to regenerate itself, preserve the
`--compile-no-warning-as-error` option if it was used when `cmake` was
last explicitly invoked.  Normally such settings are preserved in the
cache, but the purpose of this option is to be beyond the reach of
project code.
2023-05-30 17:44:43 -04:00
Marc Chevrier
4fc322bab4 AddCacheEntry: Suppress raw pointer usage 2023-05-30 16:41:59 +02:00
Ben Boeckel
8451a3f0b5 cmGlobalGenerator: use a stream for output in Build
This allows output to show up in output immediately instead of being
batched.
2023-05-27 07:04:17 -04:00
Marc Chevrier
aa5fed5052 SetProperty: suppress raw pointer usage 2023-05-26 14:48:22 +02:00
Marc Chevrier
5884303e69 Apple Framework: enhance path parsing 2023-05-21 14:26:08 +02:00
Ben Boeckel
b017c9f127 cmGlobalGenerator: fix off-by-one for && command joining
Only add `&&` if there is another command after the current one.
2023-05-16 12:48:20 -04:00
Ben Boeckel
c715fd8d76 cmGlobalGenerator: quote commands in ::Build output
Now that these are going to be visible when running with `--verbose`,
properly quote things so that they can be used as-is.
2023-05-16 12:48:19 -04:00
Ben Boeckel
d6c0e827bc cmGlobalGenerator: add a QuotedPrintable method for commands 2023-05-16 12:47:50 -04:00
Ben Boeckel
28ee3bef34 cmGlobalGenerator: add missing spaces in output
The preludes to commands should have a space to separate them from the
first argument of the command sequence.
2023-05-16 12:47:50 -04:00
Ben Boeckel
465ab8d872 cmGlobalGenerator: use cmStrCat in ::Build
Also replace some single-char strings with character literals.
2023-05-16 12:15:31 -04:00
Marc Chevrier
241304190f CMake code rely on cmList class for CMake lists management (part. 2) 2023-04-29 09:54:31 +02:00
Marc Chevrier
e08ba229ee CMake code rely on cmList class for CMake lists management (part. 1) 2023-04-24 10:41:10 +02:00
Orkun Tokdemir
69cf9700e6 Autogen: Defer setup until Generate step
It is better to set variables up once all target dependencies are known.
2023-04-05 16:12:16 -04:00
Brad King
17e6b2bdca Merge topic 'automoc-cxx-standard'
429a452705 Autogen: Add target's C++ standard to moc_predef.h
21f812e57c Autogen: Split creation and setup of custom targets into separate steps

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8359
2023-03-31 08:09:06 -04:00
Brad King
689616785f macOS: Do not pass Apple-specific flags to llvm-strip
Since commit cf82300a63 (BinUtils: Clarify search logic and make it more
consistent, 2021-05-27, v3.21.0-rc1~119^2~2) we prefer `llvm-strip` over
`strip` when using Clang.  However, since commit 20291e8e72 (install:
Fix stripping on macOS, 2019-01-30, v3.14.0-rc1~31^2) on macOS we add
flags `-u -r`, needed by Apple's `strip` for executables, but that
`llvm-strip` does not need or support.  Improve the condition to add
Apple-specific flags only when the selected `strip` tool is Apple's.

Note that Apple dylibs must be stripped with `-x` with either Apple's
`strip` or `llvm-strip`.

Fixes: #24601
2023-03-29 15:19:47 -04:00
Brad King
367aa65a9f Merge topic 'module-depends-static-lib-cycle'
01d7860fdb Ninja,Makefile: Restore Fortran module scanning in static library cycle
846baa7c5b cmGlobalGenerator: Factor out helper to check target ordering

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8363
2023-03-27 09:51:59 -04:00