Commit Graph

94 Commits

Author SHA1 Message Date
Ben Boeckel
2f101b2c8c Tests/CXXModules: support testing with custom stdlib json locations 2025-09-11 18:03:05 -04:00
Brad King
c283aafe62 CMP0057: Remove support for OLD behavior 2025-01-22 10:40:53 -05:00
Ben Boeckel
5cfb8ae790 Tests/CXXModules: add a test with duplicate sources
See: #26549
2025-01-09 22:36:06 +01:00
Brad King
2670dd4ed1 Merge topic 'iface-public-modules' into release-3.31
854eba0c53 target_sources: Improve error message for CXX_MODULES on INTERFACE libraries
cd179e7560 Tests/RunCMake/CXXModules: Rename FileSetModules cases to be more specific

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10090
2024-12-12 09:11:59 -05:00
Brad King
854eba0c53 target_sources: Improve error message for CXX_MODULES on INTERFACE libraries
We support non-compiled `SOURCES` on `INTERFACE` libraries, and also
support `CXX_MODULES` on *imported* `INTERFACE` libraries (via synthetic
targets that compile module interface units).  However, we do not
support `CXX_MODULES` on non-imported `INTERFACE` libraries because
there is no place to hold module interface unit's object files for their
module initializers.  Previously this was not explicitly rejected, and
so was diagnosed only by "CMake Internal Error" messages due to
assumption violations in the implementation.

Fixes: #26524
Co-authored-by: Ben Boeckel <ben.boeckel@kitware.com>
2024-12-11 12:34:29 -05:00
Brad King
cd179e7560 Tests/RunCMake/CXXModules: Rename FileSetModules cases to be more specific
They all add `CXX_MODULES` to `STATIC` libraries.
2024-12-11 12:20:45 -05:00
Ben Boeckel
6863c1d823 Tests/CXXModules: add tests for module commands 2024-09-03 10:05:40 -04:00
Ben Boeckel
123107c1a4 Tests/CXXModules: add support for running targets under a given config 2024-08-27 12:37:36 -04:00
Ben Boeckel
438038b5e1 Tests/CXXModules: support building specific targets of example trees
This will be used to ensure that module command targets work as
intended.
2024-08-27 12:37:36 -04:00
Ben Boeckel
cf1e36e8c5 Tests/CXXModules: factor out running an import test 2024-08-27 11:30:23 -04:00
Brad King
1027c0e213 Merge topic 'cxxmodules-no-import-std-reason'
e89e819398 Tests/CXXModules: add tests for C++26 `import std` support
6dad18f060 cxxmodules: give a reason for unavailability of `import std`

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9486
2024-05-03 09:26:39 -04:00
Brad King
de08bce94d Merge topic 'cxxmodules-build-export-different-directory'
1fba6d3233 Merge branch 'cxxmodules-build-export-different-directory-3.28' into cxxmodules-build-export-different-directory
ec35251510 cmDyndepCollation: look at all `export(TARGETS)` calls

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9485
2024-05-03 09:23:36 -04:00
Ben Boeckel
e89e819398 Tests/CXXModules: add tests for C++26 import std support 2024-05-02 14:46:51 -04:00
Ben Boeckel
1fba6d3233 Merge branch 'cxxmodules-build-export-different-directory-3.28' into cxxmodules-build-export-different-directory
* cxxmodules-build-export-different-directory-3.28:
  cmDyndepCollation: look at all `export(TARGETS)` calls
2024-05-01 22:09:43 -04:00
Ben Boeckel
ec35251510 cmDyndepCollation: look at all export(TARGETS) calls
Previously, only `export()` calls in the same directory were noticed.

Also add a test that exports in a different directory than the target
itself resides in.

Fixes: #25813
2024-05-01 22:08:35 -04:00
Brad King
be111897b3 Merge topic 'export-name-safe-name'
142a85f9c1 cxxmodules: use filesystem-safe export names in filenames
4452d41488 cmGeneratorTarget: add method to get a filesystem-safe export name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9474
2024-05-01 09:29:57 -04:00
Brad King
4bf49bc437 Merge topic 'export-name-safe-name' into release-3.29
142a85f9c1 cxxmodules: use filesystem-safe export names in filenames
4452d41488 cmGeneratorTarget: add method to get a filesystem-safe export name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9474
2024-05-01 09:29:55 -04:00
Brad King
2549f5a66e Merge topic 'exported-modules-with-headers'
2041f7c9bf cmGeneratorTarget: add the original target as a COMPILE_ONLY link
051c2110c8 Tests/CXXModules: test exporting modules which include headers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9469
2024-04-30 10:10:36 -04:00
Ben Boeckel
142a85f9c1 cxxmodules: use filesystem-safe export names in filenames
Also add tests.

Fixes: #25828
2024-04-30 09:05:16 -04:00
Ben Boeckel
051c2110c8 Tests/CXXModules: test exporting modules which include headers
Test that headers that are part of the same target are available to
modules in the target itself.
2024-04-26 20:15:05 -04:00
Ben Boeckel
64548fef16 Tests/CXXModules: test using targets that import std 2024-04-11 10:19:44 -04:00
Ben Boeckel
85e1281e00 Tests/CXXModules: add tests for exporting CXX_MODULE_STD 2024-04-11 10:19:44 -04:00
Ben Boeckel
b8cc38f3a2 Tests/CXXModules: add tests that the C++ std targets don't get exported
These targets are purely internal and should never be exported.
2024-04-11 10:19:44 -04:00
Ben Boeckel
16bf12d1e8 Tests/CXXModules; add tests for CXX_MODULE_STD behavior 2024-04-11 10:19:44 -04:00
Ben Boeckel
b17e6a52f9 Tests/CXXModules: add tests for genex usage in CXX_MODULE_STD 2024-04-11 10:19:44 -04:00
Ben Boeckel
b8af090c78 Tests/CXXModules: add a test for the CXX_MODULE_STD property 2024-04-11 10:19:43 -04:00
Ben Boeckel
bf0b457461 Tests/CXXModules: add test case for import std support 2024-04-11 10:19:43 -04:00
Ben Boeckel
4ddf0453d5 Tests/CXXModules: add a test using TARGET_OBJECTS from modules
See: #25732
2024-03-06 12:34:46 -05:00
Ben Boeckel
028f3134e5 cmExportFileGenerator: only export include paths for HEADERS file sets 2024-02-28 05:26:10 -05:00
Ben Boeckel
a2e3e61a31 Tests/CXXModules: test transitive modules usage 2024-02-20 10:53:31 -05:00
Ben Boeckel
d4a517f82a Tests/CXXModules: add a test with transitive targets 2024-02-19 10:25:27 -05:00
Ben Boeckel
e0633a9517 Tests/CXXModules: add a test importing from a Ninja install
This ensures that consuming from a single configuration generator works
in all generators.

See: #25568
2024-02-16 11:09:56 -05:00
Ben Boeckel
150d7dbd68 Tests/CXXModules: support building a project with Ninja
This allows testing mixed generator setups.
2024-02-16 11:09:54 -05:00
Ben Boeckel
e48e5e5506 Tests/CXXModules: document CMake_TEST_MODULE_COMPILATION items 2024-02-16 10:28:10 -05:00
Brad King
d713896171 Merge topic 'cxxmodules-collation-restat' into release-3.28
a7424b636b Ninja: make the collator rule use `restat = 1`
e24eecfc33 Tests/CXXModules: add a test to ensure that `restat` works for collation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9259
2024-02-16 09:30:50 -05:00
Brad King
d8fd8c2cb1 Merge topic 'cxxmodules-visibility-change-rebuild' into release-3.28
60a8736378 cmNinjaTargetGenerator: scanning depends on the module metadata
52036ce090 Tests/CXXModules: test that objects depend on dependent modules json files
9a45c9fbd5 cmNinjaTargetGenerator: use `emplace_back` for scanning deps

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9247
2024-02-16 09:22:32 -05:00
Brad King
2808c49d82 Merge topic 'cxxmodules-depend-on-modmap-file' into release-3.28
363300ace5 cxxmodules: depend on the modmap contents
940628d48d Tests/CXXModules: test that objects depend on their modmap files
681ee92030 Tests/CXXModules: support testing rebuild conditions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9248
2024-02-16 09:20:09 -05:00
Ben Boeckel
e24eecfc33 Tests/CXXModules: add a test to ensure that restat works for collation
Also update the `modules-json-file` test to account for the fact that
`CXXModules.json` is not updated for timestamp-only rebuild triggers.

See: #25511
2024-02-14 23:01:25 -05:00
Ben Boeckel
52036ce090 Tests/CXXModules: test that objects depend on dependent modules json files 2024-02-14 22:36:37 -05:00
Ben Boeckel
940628d48d Tests/CXXModules: test that objects depend on their modmap files 2024-02-14 20:36:47 -05:00
Ben Boeckel
681ee92030 Tests/CXXModules: support testing rebuild conditions 2024-02-14 14:34:07 -05:00
Ben Boeckel
0f0d853de7 cmDyndepCollation: collapse full path before looking up
`cmSourceFile::GetFullPath()` performs a `CollapseFullPath` before
storing the path. Match this behavior when looking up paths from the
source file set constructions.

Fixes: #25614
2024-02-14 11:51:05 -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
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
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
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
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