10727 Commits

Author SHA1 Message Date
Orkun Tokdemir
d0bedb2170 Autogen: Forward dependencies when both Makefile and DEPFILE are used
Since commit ebc9e448b3 (Autogen: Add depfile support for Makefiles,
2023-09-07, v3.28.0-rc1~101^2~1) CMake does not generate the correct
dependency graph when both `Makefile` and `DEPFILE` are used.
The build of `<target_name>_autogen_timestamp_deps` fails due to
missing dependencies.  To tackle that problem, forward target
dependencies to both `<target_name>_autogen_timestamp_deps` and
`<target_name>_autogen` instead of just `<target_name>_autogen`.

Fixes: #25600
2024-01-28 09:40:47 -05:00
Florian Weimer
a10d2ad397 Tests: Improve C compatibility of LoadCommand tests
The previous code used `char **` and `const char **`` types as if they
were the same.  But they are distinct types in C, so when passing
these pointers as function arguments, their types have to match.
Future C compilers will treat this as an error, similar to what
C++ compilers do today.
2024-01-25 14:35:01 -05:00
Brad King
b6e4e4babc cmUVProcessChain: Simplify SetExternalStream usage
It is commonly called with the `fileno()` of a `FILE*` stream,
so accept the latter directly.
2024-01-24 16:59:49 -05:00
Brad King
d32c30906a Tests: Add missing include in testUVProcessChainHelper on Windows
We use `STATUS_ACCESS_VIOLATION` from `windows.h`.
2024-01-24 16:59:23 -05:00
Ben Boeckel
d791f3a180 cxxmodules: make export trampoline script files unique
Include the name of the `EXPORT` in the filename when generating export
information for C++ modules. This allows the same directory to be used
for multiple sets of C++ module-using targets.

For `export(TARGETS)` uses, generate a name based on the hash of the
concatenation of the target names involved with the `export()` call.

Fixes: #25609
2024-01-18 17:40:44 -05:00
Matheus Izvekov
c09f8d27cd cxxmodules: compute link information for C++ module-consuming targets
Compute link information for all C++ targets which support
modules instead of just those which may provide modules, as
they may import modules as well. This captures `OBJECT` libraries using modules
which otherwise do not have link steps.

Fixes: #25592
2024-01-14 14:14:26 -03:00
Brad King
3160b136b2 Merge topic 'vs-scan-for-modules' into release-3.28
405dc7d19c Tests/CXXModules/scan_properties: use `ixx` extension
029ddc3410 cmVisualStudio10TargetGenerator: always specify scanning
6c9614cbf4 Tests/CXXModules: add a test case for VS generation without flags
34f4423851 cmVisualStudio10TargetGenerator: fix typo in flag name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9104
2024-01-10 10:17:01 -05:00
Brad King
2858af8d6b Merge topic 'cxxmodules-no-unity' into release-3.28
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:44 -05:00
Orkun Tokdemir
7198f0d149 Makefile: Fix double escaping when DEPFILE is used
In commit cfd8a5ac1f (Makefiles: Add support of DEPFILE for
add_custom_command, 2020-12-04, v3.20.0-rc1~237^2~1) we added a
`ConvertToOutputPath` call on a path given to the `depends` field of
`WriteMakeRule`.  The latter already handles escaping for Makefile
syntax.

Fixes: #25554
2024-01-09 10:44:43 -05:00
Ben Boeckel
405dc7d19c Tests/CXXModules/scan_properties: use ixx extension
This ensures that Visual Studio is told not to scan this explicitly.
2024-01-09 09:47:47 -05:00
Ben Boeckel
6c9614cbf4 Tests/CXXModules: add a test case for VS generation without flags
Previously, the `ScanSourceForModuleDependencies` flag was not added to
the VS project if "nothing" prompted custom flags.

See: #25519
2024-01-06 11:18:57 -05:00
Ben Boeckel
7fc2a83fe6 Tests/CXXModules: add a test with unity build support
C++ module-using TUs cannot participate in unity builds. Add a test case
for this situation.
2024-01-05 05:03:29 -05:00
Gergely Meszaros
ce9c6d0994 HIP: Propagate CMAKE_HIP_PLATFORM from/to the test project in check_language
Fixes: #25541
2024-01-04 11:25:15 -05:00
Marc Chevrier
255c2e1430 Ninja: LINK_OPTIONS property should support newlines
Fixes: #25513
2023-12-20 17:05:09 +01:00
Marc Chevrier
defbfd6f55 Xcode: Restore support for standalone IMPORTED_LOCATION_<CONFIG>
In commit 878ae03832 (macOS: IMPORTED framework: Honor SYSTEM target
property in all cases, 2023-08-27, v3.28.0-rc1~162^2) we broke support
for `IMPORTED_LOCATION_<CONFIG>` without `IMPORTED_CONFIGURATIONS`.
Previously it worked if the importing project's configurations match the
set of `IMPORTED_LOCATION_<CONFIG>` properties set.  Fix that case.

Fixes: #25506
Issue: #25515
2023-12-18 10:18:25 -05:00
Robert Maynard
04959e0285 Tests: Verify CUDA::cupti existence on a subset of machines
When we know that the cupti library exists explicitly request the CUDA Toolkit test to verify the existence
2023-12-14 14:05:28 -05:00
Brad King
fabfaf0aa0 Merge topic 'test-gnu-hurd-sleep' into release-3.28
8f53526dec Tests: Do not expect EINTR when sleep is interrupted on GNU/Hurd

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9052
2023-12-09 08:10:37 -05:00
Mattias Ellert
8f53526dec Tests: Do not expect EINTR when sleep is interrupted on GNU/Hurd
Previously `RunCMake.CTestTimeout` failed on GNU/Hurd because the
`sleep` command does not set `errno` to `EINTR` when interrupted by a
signal, which is a Linux-specific feature.
2023-12-08 09:07:24 -05:00
Brad King
101ac06b28 Tests: Update for changes to upstream ninja development version
Account for:

* commit `8f47d5aa33` (Remove `-w dupbuild` completely, always error
                       on duplicate edges, 2023-11-29)
* commit `4d98903d4c` (Improve misleading error message when an output
                       is defined multiple times, 2023-12-06)
2023-12-08 09:04:44 -05:00
Brad King
ee79d06d45 Merge topic 'cxxmodules-msvc-corner-cases' into release-3.28
e63983956d Tests/CXXModules: enhance `internal-partitions` test
8a658fb9ec Tests/CXXModules: import from an internal partition

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9039
2023-12-06 08:52:06 -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
91392d7741 Merge topic 'LLVMFlang-MSVC-debug' into release-3.28
ef49ed0fe1 LLVMFlang: Fix MSVC ABI debug information format options

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9037
2023-12-06 08:50:17 -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
Ben Boeckel
e63983956d Tests/CXXModules: enhance internal-partitions test
This test previously did not *require* that the internal partition be
specified as a transitive usage because nothing from it was exposed.
Plumb through usages such that the internal partitions are required.
2023-12-05 09:19:32 -05:00
Ben Boeckel
8a658fb9ec Tests/CXXModules: import from an internal partition
It is reported that MSVC doesn't support the `modname=` syntax in its
`-reference modname=modname.ifc` for internal partitions. Add a test
case.
2023-12-05 08:17:46 -05:00
Brad King
ef49ed0fe1 LLVMFlang: Fix MSVC ABI debug information format options
In commit 26bf32cdc6 (LLVMFlang: Add support for targeting MSVC ABI on
Windows, 2023-09-28, v3.28.0-rc1~10^2) we incorrectly recorded `-g` as
supporting the `ProgramDatabase` format, but it is actually `Embedded`,
matching Clang.

In order to support easy integration with C and C++ projects that use
the `.pdb` debug formats, pretend LLVMFlang supports them and just don't
actually emit any debug information.

Issue: #24840
2023-12-04 20:30:46 -05:00
Ben Boeckel
ea8c37b759 Tests/CXXModules: add a test which scans a PCH-using source
This tests that PCH usage works with scanning logic.
2023-12-04 07:20:36 -05:00
Kyle Edwards
f6d2efa752 Tests: Add case to cover execute_process support for no extension on Windows
Issue: #25450
2023-11-30 09:59:36 -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
Brad King
4b2960b1f3 Merge topic 'fortran-objects-as-sources-fix' into release-3.28
beb1393f8f Merge branch 'revert-exact-collation-depends-3.27' into fortran-objects-as-sources-fix
a033dce326 Makefiles: provide, but do not consume, "forward linked" target dirs
7cd0adab1b cmCommonTargetGenerator: use modules from linked object-referenced targets
1175f1c874 LinkItem: track `cmSourceFile` instances for external objects
d2fa56772f Ninja: support "forwarding" modules from other targets
ec1e589bec Ninja: Revert exact collation dependencies for 3.27
06df59b930 cmCommonTargetGenerator: return forward linked target dirs too
f8729ab366 cmLocalUnixMakefileGenerator3: handle object-referencing Fortran modules
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8989
2023-11-27 08:36:44 -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
Brad King
cf2f2dfe63 Merge topic 'clang-scan-deps-failed-scan' into release-3.28
77a7edb73f Clang-CXX: copy into the dyndep output on success

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Namniav W <namniav@gmail.com>
Merge-request: !8991
2023-11-22 07:20:04 -05:00
Ben Boeckel
6fe8b84894 Merge branch 'revert-exact-collation-depends-3.27' (early part) into fortran-objects-as-sources-fix
* 'revert-exact-collation-depends-3.27' (early part):
  Tests/FortranModules: add test for TARGET_OBJECTS-as-linked-items module usage
  Tests/FortranModules: add test for TARGET_OBJECTS-as-sources module usage
2023-11-21 09:42:27 -05:00
Ben Boeckel
77a7edb73f Clang-CXX: copy into the dyndep output on success
When `clang-scan-deps` fails to scan (e.g., bad source syntax, junk
flags, etc.), the redirection unconditionally updates the file. If this
fails, the `.ddi` file timestamp is updated. If the state is then
reverted (e.g., the command line returns to the state of the last
successful build), the updated file is not useful, but `ninja` does not
rerun because:

- the command hash matches the last successful run
- the output file is newer than its inputs

However, since the `.ddi` file has been updated with bogus contents from
a failed scan, collation fails as the `rules` array is empty (or
incomplete from a batch scan).

If `clang-scan-deps` were properly aware of its output file, it could
use this to not write the file if any inner scan fails. Requested in
https://github.com/llvm/llvm-project/issues/72875.

See: https://github.com/llvm/llvm-project/issues/72875
Fixes: #25429
2023-11-21 09:41:59 -05:00
Ben Boeckel
9d2769ecbd Tests/FortranModules: add test for TARGET_OBJECTS-as-linked-items module usage
Test module usage across a `$<TARGET_OBJECTS>`-as-linked-items use case.

See: #25425
2023-11-21 09:17:43 -05:00
Ben Boeckel
7c1e52be87 Tests/FortranModules: add test for TARGET_OBJECTS-as-sources module usage
Test module usage across a `$<TARGET_OBJECTS>`-as-sources use case.

See: #25425
2023-11-21 09:17:36 -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
2744f14db1 codespell: Fix typos 2023-11-17 09:58:21 -05:00
Brad King
bc435bc288 Tests: Update HIP.MathFunctions case for nodiscard enforcement 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
d7988ff6b8 Merge branch 'backport-target-objects' into target-objects 2023-11-14 15:42:07 -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
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
e4483b8871 Tests: Avoid compiling call to dap::optional<dap::string>(nullptr) 2023-11-07 09:13:24 -05:00
Kyle Edwards
7d19246138 Xcode: Fix linking against .xcframework from static libraries
Issue: #21752
2023-11-06 17:40:00 -05:00
Kyle Edwards
c4be9c914b cmSystemTools::RunSingleCommand(): Pass stdin to child process
Fixes: #25383
2023-11-02 10:04:00 -04:00
Brad King
59c3ce4c83 Merge topic 'cxxmodules-cmp0155-graceful-fallback-without-scanner' into release-3.28
1f507580a1 cmGlobalGenerator: give context about module queries
889aa0354a CMP0155: ignore scanning for sources if no scanner is available

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8925
2023-11-01 13:48:14 -04:00