Commit Graph

892 Commits

Author SHA1 Message Date
Brad King
2744f14db1 codespell: Fix typos 2023-11-17 09:58:21 -05:00
Ben Boeckel
1f507580a1 cmGlobalGenerator: give context about module queries
Some queries are merely investigating support in order to change
behavior. Let the method know so that any internal errors can be skipped
over.
2023-11-01 09:52:13 -04:00
Ben Boeckel
889aa0354a CMP0155: ignore scanning for sources if no scanner is available
This allows for a more graceful transition for projects using C++20
without scanner support (e.g., Clang 15 or GCC 13). While newer
compilers will (needlessly) scan, it allows C++20-using projects to use
older compilers without having to set `CMAKE_CXX_SCAN_FOR_MODULES` to
support newer CMake minimum versions.

Fixes: #25357
2023-11-01 09:52:08 -04:00
Brad King
32438138c3 cxxmodules: Reference documentation in no-modules-support diagnostics
Help users avoid errors about module support when they may not need it.

While at it, polish sentence syntax in the diagnostic messages.
2023-10-11 09:52:41 -04:00
Brad King
b8ead378de cxxmodules: Scan only targets that explicitly enable C++ 20
Previously we scanned any targets for which C++ 20 is enabled,
even if enabled only by the compiler's default, such as when
`CXXFLAGS=-std=c++20`.
2023-10-05 13:17:00 -04:00
Brad King
68fca3eafe cmGeneratorTarget: Track explicitly enabled language standard levels
Previously we only tracked when an explicit setting requires the
standard level to be higher than the compiler's default.
2023-10-05 13:16:24 -04:00
Brad King
da36e0638b cmGeneratorTarget: Remove outdated const/mutable pair 2023-10-04 18:45:30 -04:00
Brad King
23b57462aa cmStandardLevelResolver: Report feature std level from GetNewRequiredStandard
Regardless of whether the feature requires a new (higher) standard
level, always report the standard level that the feature needs.
2023-10-04 18:44:18 -04:00
Brad King
7ac696549a cxxmodules: Fix CMP0155 NEW behavior when C++ compile features are not known
With CMP0155 NEW behavior, we scan C++ sources in targets using C++ 20,
i.e., in which the `cxx_std_20` feature is available.  However, our
check for C++ feature availability may incorrectly succeed in two cases:

* MSVC versions from VS 2013 do not model C++ standard levels,
  so we assume all features are available as a heuristic to let
  projects at least try compiling with them.

* During ABI detection the `CMAKE_CXX20_COMPILE_FEATURES` variable is not
  populated so we assume all features are available, knowing that our
  ABI detection project does not need them.

For purposes of detecting targets using C++ 20, we do not want to assume
`cxx_std_20` is available, so verify that we really know it is.
2023-10-03 16:06:46 -04:00
Ben Boeckel
437280b127 cxxmodules: scan C++ sources for imports by default
Existing projects are not using C++ modules in their sources,
so introduce policy CMP0155 to enable scanning by default.
2023-10-02 10:17:31 -04:00
Ben Boeckel
068fde1c34 cmGeneratorTarget: use this-> for method calls 2023-10-02 10:17:31 -04:00
Ben Boeckel
197a6bf171 cxxmodules: rework control logic for scanning regular C++ sources
Now that scanning support is no longer experimental, the logic for
whether or not to scan C++ 20 sources is now important because all
projects are now exposted to the logic. Make the scanning rules explicit
in the documentation and rework the queries to localize all of the
associated logic.

A policy to handle the ultimate fallback logic will be implemented in a
following commit.
2023-10-02 10:17:31 -04:00
Ben Boeckel
0c07f39006 cmExperimental: remove the flag for C++ modules
All the major compilers now have scheduled releases with support for
scanning, so remove the experimental gate.

Fixes: #18355
2023-10-02 10:17:31 -04:00
Brad King
6bb05172ac Merge topic 'cxxmodules-export-dirs-with-prefix'
42654cc818 Tests/CXXModules: add tests for modules with include requirements
7217cb78cf Tests/CXXModules: relax line number matching in stderr
b3d1bbbbcc cmExportFileGenerator: relocate include directories for C++ modules
349ff8b080 cmGeneratorTarget: remove not-INTERFACE assertion
681a763425 cmGeneratorTarget: use a character literal

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8838
2023-09-27 11:25:22 -04:00
Ben Boeckel
349ff8b080 cmGeneratorTarget: remove not-INTERFACE assertion
IMPORTED INTERFACE targets which provide C++ modules may have include
directories that need checked for whether they are system directories or
not. These directories are intended for the module compilation
themselves (which may include headers that module consumers do not need).
2023-09-26 14:31:42 -04:00
Ben Boeckel
681a763425 cmGeneratorTarget: use a character literal 2023-09-26 08:52:48 -04:00
Ben Boeckel
0cf0a8e632 cmGeneratorTarget: use GetSupportDirectory in PCH codepaths
Instead of recalculating the support directory path, use the intended
method.
2023-09-25 17:39:34 -04:00
Brad King
18158bf81c HIP: Add support for NVIDIA GPUs
Add support for using the CUDA Toolkit's NVCC to compile HIP code.

Fixes: #25143
2023-09-21 15:34:37 -04:00
Brad King
b32ea7cff0 CUDA: Factor out helper to generate CUDA architecture flags
Prepare to use it for other languages.
2023-09-21 15:34:28 -04:00
Brad King
711de9aef6 cmGeneratorTarget: Clarify local variable names for device architectures 2023-09-19 11:31:23 -04:00
Ben Boeckel
045d8eca6c Merge branch 'fortran-object-libraries-release' into fortran-object-libraries
* fortran-object-libraries-release:
  cmComputeLinkInformation: compute link info for module-using targets
  cmGeneratorTarget: support config-independent Fortran source queries
2023-09-05 19:27:41 -04:00
Ben Boeckel
6251edaed1 cmGeneratorTarget: support config-independent Fortran source queries
Some locations care about "any config with Fortran", so make a query for
such (they may not know any configuration names themselves).
2023-09-05 18:12:25 -04:00
Marc Chevrier
878ae03832 macOS: IMPORTED framework: Honor SYSTEM target property in all cases
When IMPORTED_LOCATION holds a framework folder, SYSTEM property must be respected.
2023-08-27 10:59:36 +02:00
Brad King
863891adb2 Merge topic 'modules-better-messages'
571b5e1f2c cxxmodules: improve error messages for C++ module setup
8b4d32c18b cmStandardLevelResolver: add query for the effective standard level
17ddc4ac76 cmStandardLevelResolver: compare with static string literals
6f1dae2b01 cmStandardLevelResolver: use `cmStrCat` where possible
0d45d40e13 cmStandardLevelResolver: use character literals where possible

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8755
2023-08-25 11:27:27 -04:00
Ben Boeckel
571b5e1f2c cxxmodules: improve error messages for C++ module setup
Make it clear that:

- the quoted string is a target name; and
- C++ sources that export modules is the important detail.
2023-08-23 16:47:29 -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
159585967a cmGeneratorTarget: classify BMI-only C++ module sources 2023-08-17 14:42:53 -04:00
Ben Boeckel
1690e451f7 cmGeneratorTarget: support better errors when checking for C++20 modules
Some callers have their own error reporting mechanisms which give more
context. Support handing off the error string for these use cases.
2023-08-16 10:40:11 -04:00
Craig Scott
84eae7aeda OPTIMIZE_DEPENDENCIES: Skip order-only deps for non-linking targets
Fixes: #21517
2023-08-10 09:17:56 +10:00
Ben Boeckel
e166bbef7b cmComputeLinkInformation: prepare Item consumers for OBJECT libraries
After b665966933 (cmComputeLinkInformation: track `OBJECT` library
dependencies, 2023-07-22), introduced in !8645 as a fix for #25112,
`OBJECT` libraries were tracked in a separate member to reduce the risk
of further regressions. This commit prepares consumers to handle
`OBJECT` libraries once they start appearing as link items.
2023-08-01 10:06:02 -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
Kyle Edwards
7050ac56a1 macOS: Add support for linking against .xcframework folders
Issue: #21752
2023-07-26 17:00:01 -04:00
Brad King
61bb728c0c Merge topic 'imported-target-framework-path'
d605f728f7 macOS: Allow IMPORTED_LOCATION to be a framework folder

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8586
2023-06-26 09:47:30 -04:00
Kyle Edwards
d605f728f7 macOS: Allow IMPORTED_LOCATION to be a framework folder
Issue: #24946
2023-06-23 12:07:18 -04:00
Brad King
994e88ec38 Merge topic 'build-pch'
aba5bab62e ci: Add nightly job to build CMake with PCH on macOS
44f08e94ff ci: Add nightly job to build CMake with PCH on Windows
e0eb97e923 libuv: Precompile common expensive headers
e2efa89c7f cmcppdap: Precompile common expensive headers
9d7921d388 liblzma: Precompile common expensive headers
6aaefdb3be libarchive: Precompile common expensive headers
a8d91e2719 curl: Precompile common expensive headers
59277bccd3 bzip: Precompile common expensive headers
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8571
2023-06-23 11:20:00 -04:00
Clemens Wasser
30c882827e C{Make,Test}Lib: Precompile common expensive headers 2023-06-22 18:11:45 +02:00
Marc Chevrier
45f17e5a85 cmList: Add container conversion to string 2023-06-22 15:44:17 +02:00
Kyle Edwards
36ec89639a VERIFY_INTERFACE_HEADER_SETS: Skip header files that have SKIP_LINTING
Fixes: #24972
2023-06-06 10:45:22 -04: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
64a4d1f104 Merge topic 'remove-header-unit-fileset-type'
7b62a83c6f cxxmodules: update the experimental UUID
6ff5cdc533 cxxmodules: remove support for `CXX_MODULE_HEADER_UNITS` filesets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8510
2023-06-01 09:53:34 -04:00
Rafael Stahl
45584508fa CUDA/NVIDIA: fix LTO with explicit architectures 2023-05-31 11:44:10 -04:00
Ben Boeckel
6ff5cdc533 cxxmodules: remove support for CXX_MODULE_HEADER_UNITS filesets
There's no backing implementation for header units anyways, so just
remove it for now.
2023-05-31 10:57:11 -04:00
Marc Chevrier
5884303e69 Apple Framework: enhance path parsing 2023-05-21 14:26:08 +02:00
Marc Chevrier
ad9020a899 Apple Frameworks: honor SYSTEM target property
Fixes: #24109
2023-05-11 10:24:18 +02:00
Brad King
5924630e6d Merge topic 'compile-only-genex'
c42630ee62 cmGeneratorExpressionNode: implement `COMPILE_ONLY` genex
0fb923c460 cmGeneratorExpressionNode: implement `COMPILE_ONLY` genex

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8411
2023-05-05 12:42:23 -04:00
Robert Maynard
c42630ee62 cmGeneratorExpressionNode: implement COMPILE_ONLY genex
This generator expression is the inverse of `LINK_ONLY` and only coveys
usage requirements for the purposes of compilation. Its intended use is
to avoid needing to export targets that do not have link usage
requirements (e.g., header-only libraries) when used by another target.

See: #15415
2023-05-04 09:39:06 -04:00
Brad King
0d2d5a229c Merge topic 'use-linker-depfile'
375e6fdbbe Link step: use linker dependency linker file
24a3e5cda0 cmLocalGenerator::MayBeRelativeToWorkDir: take care of all cases

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8443
2023-05-04 09:06:23 -04:00
Brad King
28dd02c3ba Merge topic 'autogen-system-include'
7bf4e30090 Autogen: Default AUTOGEN_USE_SYSTEM_INCLUDE to ON if it is not set
033dc7ee2f Autogen: Add AUTOGEN_USE_SYSTEM_INCLUDE target property
8ba16db163 Tests/RunCMake: Add option for dynamic expected output

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8400
2023-05-04 09:01:08 -04:00
Marc Chevrier
375e6fdbbe Link step: use linker dependency linker file
Based on work done by @ben.boeckel (!8051)

Fixes: #22217
2023-05-03 17:08:07 +02:00
Orkun Tokdemir
033dc7ee2f Autogen: Add AUTOGEN_USE_SYSTEM_INCLUDE target property
`AUTOGEN_USE_SYSTEM_INCLUDE` was added. `AUTOGEN_USE_SYSTEM_INCLUDE`
is a boolean property that can be set on a target to indicate that the
autogen target include directory should be added as a system include
directory or normal include directory to the target.
2023-05-03 09:03:46 -04:00