Commit Graph

34774 Commits

Author SHA1 Message Date
Brad King
618fdc1c42 CMake 3.28.0 2023-12-06 08:57:42 -05:00
Brad King
ef9cba9f42 Merge topic 'fix-cxx-module-transitive-requirements' into release-3.28
e9b0dcbbfa cmCxxModuleMapper: Fix transitive requirements computation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9030
2023-12-06 08:51:18 -05:00
Brad King
fc6508921c cmComputeLinkInformation: Restore soname lookup for non-imported targets
In commit 7351d590ee (cmTarget: Add a way to represent imported shared
library stubs, 2023-07-17, v3.28.0-rc1~344^2) we accidentally stopped
passing the SONAME of a non-imported SHARED library to our runtime
search path ordering logic.  Unfortunately I have not found a way to add
a test case for this, but it at least shouldn't regress existing tests
or those added by that commit.
2023-12-05 15:50:56 -05:00
Brad King
03d86f9d9c cmGeneratorTarget: Add helper to check for known runtime artifact 2023-12-05 15:48:36 -05:00
namniav
e9b0dcbbfa cmCxxModuleMapper: Fix transitive requirements computation
Previously CMake may generate incomplete transitive requirements in
CMakeFiles/<target>.dir/CXXModules.json and therefore in module mapper
for compiler, when source files were listed in CMakeList.txt in a
certain order.

This commit fixes the problem by correctly tracking unfinished
transitive requirements computation of module units.

There have been a simple circular test case whose circular dependency
was reported by build system. Now with this correct implementation it's
reported by CMake generating module mappers.

Add two test cases for transitive requirements computation, one with
adding source files in hardcoded order, and the other in randomized
order.

Fixes: #25465
2023-12-05 10:26:10 -05:00
Brad King
3e8f021137 Merge topic 'RH-gcc-toolset-10-bug-check' into release-3.28
40af103402 cmCMakePath: do not use std::filesystem::path with RH gcc-toolset-10

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9026
2023-12-05 09:29:44 -05:00
Brad King
d301276bf5 Merge topic 'cxxmodules-pch' into release-3.28
40dc13b242 cmNinjaTargetGenerator: PCH files do not need dyndep
f61c64cd1c cmLocalGenerator: prevent scanning of PCH source files
ea8c37b759 Tests/CXXModules: add a test which scans a PCH-using source

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9032
2023-12-05 09:25:50 -05:00
Brad King
8c1da0b4bf Merge topic 'cmFileCopier-error-loss' into release-3.28
a820877d03 errors: avoid constructing a stream before getting the last error
5cf7018af6 cmFileCopier: remember error statuses and get their strings
0639a32d3a cmFileTimes: return status codes from APIs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9023
2023-12-05 09:23:48 -05:00
Brad King
696e14d977 cmFileLockResult: Fix inclusion of windows.h when cross-compiling
In commit 64821d8a26 (cmFileLockResult: Remove expensive windows.h
include, 2023-06-16, v3.28.0-rc1~446^2~13) we accidentally capitalized
the name of the header.  This matters when cross-compiling from a host
with a case-sensitive filesystem.

Fixes: #25474
2023-12-04 16:52:24 -05:00
Marc Chevrier
40af103402 cmCMakePath: do not use std::filesystem::path with RH gcc-toolset-10
Fixes: #25458, #25453
2023-12-04 17:39:06 +01:00
Ben Boeckel
40dc13b242 cmNinjaTargetGenerator: PCH files do not need dyndep
Fixes: #24209
2023-12-04 08:43:45 -05:00
Ben Boeckel
f61c64cd1c cmLocalGenerator: prevent scanning of PCH source files 2023-12-04 08:43:45 -05:00
Ben Boeckel
a820877d03 errors: avoid constructing a stream before getting the last error
Constructing a stream may involve operations that change the global
error state. Avoid the streams by using `cmStrCat` instead.
2023-12-01 22:58:05 -05:00
Ben Boeckel
5cf7018af6 cmFileCopier: remember error statuses and get their strings
The last error may have changed between the original call and the
`GetLastSystemError()` call. Remember the status explicitly and ask it
for its error string.

Reported on Discourse: https://discourse.cmake.org/t/9539
2023-12-01 22:58:05 -05:00
Ben Boeckel
0639a32d3a cmFileTimes: return status codes from APIs
This avoids accidentally overwriting the global error state before
fetching the intended error code.
2023-12-01 22:58:05 -05:00
Brad King
8bd78627dd CMake 3.28.0-rc6 2023-11-30 13:13:15 -05:00
Brad King
d2167f7224 Merge topic 'ccmake-install-rds-crash' into release-3.28
d01120a47a cmGlobalGenerator: clear RuntimeDependencySet members at configure

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9013
2023-11-30 09:03:50 -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
1b82da7e15 Merge topic 'cxxmodules-diagnostics' into release-3.28
cbd549b09e cxxmodules: Add more suggestions to no-modules-support diagnostics

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9011
2023-11-29 07:51:41 -05:00
Brad King
cbd549b09e cxxmodules: Add more suggestions to no-modules-support diagnostics
Tell users what generators *do* support C++ modules.  Report the current
generator to make clear it is not one of those supporting modules.
Also clarify the purpose of the existing documentation references.
2023-11-28 14:36:16 -05:00
halx99
6030df205a Xcode: Fix embed resources prop name
Fix commit e40d2cb3af (Xcode: Add embed resources support, 2023-07-31,
v3.28.0-rc1~281^2).  The implementation should not name the `_PATH`
suffix explicitly.  That variant is automatically handled by
`cmGlobalXCodeGenerator::AddEmbeddedObjects`.
2023-11-28 12:06:29 -05:00
Ben Boeckel
a033dce326 Makefiles: provide, but do not consume, "forward linked" target dirs
Makefiles do not have a per-object sense of where they come from, so
forwarding any module information here would end up with incorrect
module file path construction by consuming targets. Leave a TODO item in
its place.
2023-11-23 14:26:31 -05:00
Ben Boeckel
7cd0adab1b cmCommonTargetGenerator: use modules from linked object-referenced targets
Fortran modules provided by objects added as linked items via
`$<TARGET_OBJECTS>` should also be considered as "linked targets" for
collation purposes. As C++ modules have their own visibility rules
through their `FILE_SET` feature, do not expose these for C++ module
collation.
2023-11-23 14:26:31 -05:00
Ben Boeckel
1175f1c874 LinkItem: track cmSourceFile instances for external objects
The target may be required in order to provide Fortran modules, so track
the source file so that the target may be looked up when needed.
2023-11-23 14:26:31 -05:00
Ben Boeckel
d2fa56772f Ninja: support "forwarding" modules from other targets
When a target uses objects from another target which provides modules as
sources, the modules provided by the referenced target must also be
treated as if they were provided by the referencing target. Add the
concept of "forwarding" modules so that consumers can use modules
created by these sources as well.

Note that this is only sensible for Fortran where module usages are
implicit as far as CMake's visibility model is concerned. C++ modules
have their own concept of visibility which does not require or support
such `$<TARGET_OBJECTS>` reuse in this way.
2023-11-23 14:25:09 -05:00
Ben Boeckel
06df59b930 cmCommonTargetGenerator: return forward linked target dirs too
This will be used for module forwarding in order to support
`$<TARGET_OBJECTS>` usage in source and link libraries calls.
2023-11-21 09:44:39 -05:00
Ben Boeckel
f8729ab366 cmLocalUnixMakefileGenerator3: handle object-referencing Fortran modules
Targets only using Fortran modules via `$<TARGET_OBJECTS>` also need a
collation step to be performed. Check for this case and trigger the
depends rule to be used.
2023-11-21 09:43:49 -05:00
Ben Boeckel
6afe841e62 cmNinjaTargetGenerator: handle object-referencing Fortran modules
Targets only using Fortran modules via `$<TARGET_OBJECTS>` also need a
collation step to be performed. Check for this case and trigger the
collation rule to be added and used.
2023-11-21 09:43:47 -05:00
Ben Boeckel
c1fc5455b1 cmGeneratorTarget: also check included objects for Fortran modules
Fortran modules provided by objects in `$<TARGET_OBJECTS>` should also
count as "has Fortran modules" for the target referencing the objects.
2023-11-21 09:43:17 -05:00
Ben Boeckel
515ca5fcd1 cmCommonTargetGenerator: use modules from object-referenced targets
Fortran modules provided by objects added as sources via
`$<TARGET_OBJECTS>` should also be considered as "linked targets" for
collation purposes. As C++ modules have their own visibility rules
through their `FILE_SET` feature, do not expose these for C++ module
collation.
2023-11-21 09:42:58 -05:00
Ben Boeckel
d8182105a1 cmGeneratorTarget: add a query for targets with objects in the source list
This will be eventually be used to inform the collator of this
information so that Fortran modules provided by the resulting objects
can also be used as intended.
2023-11-21 09:42:58 -05:00
Ben Boeckel
ee4e85e615 cmGeneratorTarget: use pointers to const generator targets for languages 2023-11-21 09:42:58 -05:00
Ben Boeckel
b34a8fcb8e cmGeneratorTarget: track object libraries using a set
This avoids having to do manual "is already present" checks. The order
the targets are processed does not need to be preserved because the
resulting `languages` result is already a `set`.
2023-11-21 09:42:58 -05:00
Brad King
2f30b29ac3 Merge topic 'fileapi-file-sets-base-dirs-relative' into release-3.28
a3a85524cd fileapi: Fix file sets' base directories relative to top source

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !8977
2023-11-20 09:12:59 -05:00
Brad King
175829220f Merge topic 'custom-command-ninja-deps' into release-3.28
3c8d1eef72 Ninja: depfile: keep rules without dependencies

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8984
2023-11-20 09:01:41 -05:00
Marc Chevrier
3c8d1eef72 Ninja: depfile: keep rules without dependencies
To avoid repeated executions of custom command actions, depfile file
with rules without dependencies must be preserved.

Fixes: #25428
2023-11-20 08:17:48 -05:00
Brad King
2744f14db1 codespell: Fix typos 2023-11-17 09:58:21 -05:00
Brad King
7517923418 codespell: Match valgrind output without repeating a spelling error 2023-11-17 09:58:21 -05:00
Kyle Edwards
a3a85524cd fileapi: Fix file sets' base directories relative to top source
This field was added by commit b3e9fb67bb (file-api: support exporting
file set information, 2022-11-03, v3.26.0-rc1~389^2) but the relative
path convention used elsewhere was accidentally left out.

Fixes: #25422
2023-11-17 07:59:05 -05:00
Brad King
0b6c6bb1ea CMake 3.28.0-rc5 2023-11-15 09:54:28 -05:00
Brad King
9cfff766eb CMake 3.27.8 2023-11-15 08:55:18 -05:00
Brad King
d7988ff6b8 Merge branch 'backport-target-objects' into target-objects 2023-11-14 15:42:07 -05:00
Brad King
1814853081 cmCommonTargetGenerator: Drop unused local variable 2023-11-14 15:40:33 -05:00
Brad King
377b78aef9 cmComputeLinkInformation: Simplify recording OBJECT libraries as link items
Simplify commit 2c7acd34e2 (cmComputeLinkInformation: add `OBJECT`
libraries as link items, 2023-07-24, v3.28.0-rc1~279^2) using the
existing local variables.
2023-11-14 15:40:29 -05:00
Brad King
50fdaf8f1f cmComputeLinkInformation: Track targets named by TARGET_OBJECTS sources
Since commit b6a5382217 (Ninja: depend on language module information
files directly, 2023-02-10, v3.27.0-rc1~502^2), the return value of
`cmCommonTargetGenerator::GetLinkedTargetDirectories` must account for
linked object libraries because they may provide modules (#25112).
These were added by commit b665966933 (cmComputeLinkInformation: track
OBJECT library dependencies, 2023-07-22, v3.27.1~5^2).  However, targets
named by `$<TARGET_OBJECTS:...>` sources are also needed (#25365).

The latter were added by commit 22da18b995 (Fortran: Restore support for
TARGET_OBJECTS providing modules, 2023-10-27, v3.28.0-rc4~9^2) and
commit 035302b7e3 (cmComputeLinkDepends: also copy the target from
object link items, 2023-10-27, v3.28.0-rc4~9^2~2).  However, their
approach added link entries not actually specified by projects.  It also
incorrectly re-used `cmComputeLinkDepends::AddLinkObject` for object
library targets when it is meant for their individual object files.
These problems caused additional regressions (#25417).  Revert the
implementation parts of those commits and leave behind an assertion and
comment to help avoid the mistake in the future.  Instead, track targets
named by `$<TARGET_OBJECTS:...>` sources with a dedicated member.

Issue: #25112
Issue: #25365
Fixes: #25417
Co-authored-by: Ben Boeckel <ben.boeckel@kitware.com>
2023-11-14 14:50:08 -05:00
Brad King
0e26bd334d cmCommonTargetGenerator: Factor out GetLinkedTargetDirectories loop body
Re-use the body in multiple loops instead of allocating to combine them.
2023-11-14 13:50:13 -05:00
Martin Duffy
27244a8f73 cmGeneratorExpressionNode: Fix short-circuit logic
Fix logic added by commit 634079b86d (cmGeneratorExpressionEvaluator:
Short-circuit boolean operators, 2023-09-11, v3.28.0-rc1~47^2) and
add missing test cases.

Fixes: #25412
2023-11-13 11:11:18 -05:00
Brad King
56544c1874 Merge topic 'cxx23' into release-3.28
a0fabc4769 cmGlobalGeneratorFactory: Provide complete cmGlobalGenerator to deleter
85627a93c9 cmCTestBuildCommand: Avoid requiring complete cmGlobalGenerator type publicly
641c02a3ce cmList: Avoid using operator-> on input iterator
e4483b8871 Tests: Avoid compiling call to dap::optional<dap::string>(nullptr)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !8950
2023-11-08 10:32:03 -05:00
Brad King
4f26c238a6 Merge topic 'static-library-link-xcframework' into release-3.28
7d19246138 Xcode: Fix linking against .xcframework from static libraries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8949
2023-11-07 09:56:24 -05:00
Brad King
a0fabc4769 cmGlobalGeneratorFactory: Provide complete cmGlobalGenerator to deleter
The libc++ `unique_ptr` implementation requires this since C++23.

Fixes: #25388
2023-11-07 09:13:25 -05:00