Commit Graph

220 Commits

Author SHA1 Message Date
Brad King b7ad081f1a Tests: Fix RunCMake.CXXModules compilation with Clang 21
Clang 21 now enforces placement of the module declaration:

    .../scan_properties/module.cxx:7:8: error: module
       declaration must occur at the start of the translation unit
2025-10-30 17:40:02 -04:00
AJIOB 5de7a09e77 Tests/RunCMake: Match dots more precisely, part 3 2025-10-20 14:45:24 -04:00
AJIOB 62b112ee25 Tests/RunCMake: Match CMakeLists.txt file name more precisely 2025-10-16 17:42:12 +03:00
AJIOB 06ccd15457 Tests/RunCMake: Match xxx.cmake file name more precisely 2025-10-16 17:42:12 +03:00
Hanna Rusakovich 638cf8f194 Tests/RunCMake: Match CMakeLists.txt file name more precisely 2025-10-15 09:39:01 -04:00
AJIOB 6874efb592 MSVC: Always define a character set
When targeting the MSVC ABI, define `_MBCS` by default if the project
does not define `_SBCS` or `_UNICODE`.  Visual Studio has long defined
one of the three character set macros automatically.  For consistency,
define it when compiling for the MSVC ABI with other generators.
Add policy CMP0204 for compatibility.

Fixes: #27275
2025-10-07 09:29:32 -04:00
Ben Boeckel 2f101b2c8c Tests/CXXModules: support testing with custom stdlib json locations 2025-09-11 18:03:05 -04:00
Ben Boeckel 050f891d81 Tests: choose an explicit FULL strategy in tests expecting it
Since it can be set in the environment when running the test suite,
guard tests which are sensitive to intermediate directory strategy
changes with explicit settings.
2025-07-29 08:06:30 -04:00
Ben Boeckel 52e2785018 experimental/CXXModules: recycle the UUID
Now that `clang -stdlib=libstdc++` is supported.
2025-04-30 13:48:13 +02:00
Ben Boeckel 12d73c9f78 cmExperimental: recycle build database uuid 2025-03-03 22:03:27 +01:00
Ben Boeckel 8a773168fd Tests/CXXModules: help diagnose build database errors
In tests that compare multiple files, knowing which file(s) errors come
from is difficult. Log the actual filepaths when this occurs to help
debugging.
2025-03-03 22:02:40 +01:00
Ben Boeckel 7ca4ac8e13 cmBuildDatabase: fix language comparison for visibility
Only C++ sources need checked for `CXX_MODULES` file set types, not the
other way around.
2025-03-03 22:00:23 +01:00
Brad King c283aafe62 CMP0057: Remove support for OLD behavior 2025-01-22 10:40:53 -05:00
Brad King 6c39558077 Merge topic 'test-ninja-1.13'
24f0848836 Tests: Update expected results for ninja post-1.12 development

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10182
2025-01-17 08:12:00 -05:00
Brad King 24f0848836 Tests: Update expected results for ninja post-1.12 development
Account for changes to upstream ninja:

* commit `5d93f2da28` (Add exit code to the failed target, 2024-12-03)
* commit `311bf93416` (Propagate jobs' exit codes to the ninja's exit code,
                       2024-12-03)
2025-01-16 08:14:25 -05:00
Brad King 92f6b92155 Merge topic 'duplicate-source-behavior'
3e15419bd4 target_sources: Restore toleration of duplicate CXX_MODULES sources
5cfb8ae790 Tests/CXXModules: add a test with duplicate sources

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10155
2025-01-10 09:28:16 -05:00
Ben Boeckel 3e15419bd4 target_sources: Restore toleration of duplicate CXX_MODULES sources
In commit 9c0491a3e4 (cmDyndepCollation: write out scanned source
information too, 2024-03-25) via !9708, the `sf_map` gained a new job of
also being used to track non-file set sources which could import
modules. This was implemented by removing processed `FILE_SET TYPE
CXX_MODULES` sources from the map and working with the sources
remaining. When a `FILE_SET TYPE CXX_MODULES` source appeared multiple
times, this would then erroneously complain that it "was not scheduled
for compilation". Use a set of source paths to track sources that have
already been processed. If duplicates are found, trigger an author
warning and skip the duplicate file.

Fixes: #26549
2025-01-09 22:36:06 +01:00
Ben Boeckel 5cfb8ae790 Tests/CXXModules: add a test with duplicate sources
See: #26549
2025-01-09 22:36:06 +01:00
Ben Boeckel 469175c2e6 Experimental: recycle the import std UUID
Now that GCC is supported, update the feature UUID.
2025-01-08 16:32:14 -05:00
Ben Boeckel a980dab9b1 gcc: support import std 2025-01-08 16:32:14 -05:00
Ben Boeckel 2791b7564b Tests/RunCMake: handle C++26 support where needed 2025-01-08 16:32:14 -05:00
Brad King 35425256a5 Merge topic 'iface-public-modules'
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:12:01 -05: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
Brad King bc69ff7c6d Tests/RunCMake/CXXModules: Improve failure message formatting 2024-10-21 19:53:46 -04:00
Ben Boeckel e77655555c cmExperimental: gate build database support behind a flag
Given that the feature currently only supports C++ sources and is not
formally accepted by ISO yet, gate it behind a flag.
2024-09-03 10:05:40 -04: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 670f753f24 cmDyndepCollation: write build database metadata
Generators will hook this up into the build graph as needed.
2024-08-27 12:37:36 -04:00
Ben Boeckel 9c0491a3e4 cmDyndepCollation: write out scanned source information too
This is required to fill in the `requires` field for sources using
modules that do not provide them.
2024-08-27 12:37:35 -04:00
Ben Boeckel cf1e36e8c5 Tests/CXXModules: factor out running an import test 2024-08-27 11:30:23 -04:00
Ben Boeckel a46395df06 importstd: clarify when the experimental UUID must be available
Fixes: #25980
2024-05-15 07:15:05 -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 6dad18f060 cxxmodules: give a reason for unavailability of import std
If the `CMAKE_CXX<STANDARD>_COMPILER_IMPORT_STD_NOT_FOUND_MESSAGE`
variable is set, include its value in the error message.
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
Brad King c5d8fa3f2c Merge topic 'exported-modules-with-headers' into release-3.29
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:34 -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 678717f3e4 cxxmodules: provide a detection variable for import std 2024-04-18 09:53:21 -04:00
Ben Boeckel 15bbd1d9b8 Experimental: add an experimental feature gate for import std 2024-04-12 11:46:39 -04:00
Ben Boeckel d7e65b6178 Tests/CXXModules: mask C++23 std module targets
These tests mess with the availability of C++ module support. Hide
generation of the utility targets from any compiler detection.
2024-04-11 10:19:44 -04:00
Ben Boeckel 64548fef16 Tests/CXXModules: test using targets that import std 2024-04-11 10:19:44 -04:00