1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-22 20:34:08 +08:00

965 Commits

Author SHA1 Message Date
Brad King
2352dcc830 Source: Simplify hasher object construction 2024-01-18 17:40:32 -05:00
Brad King
45d53bdb70 CUDA/Clang: Do not pass explicit architecture flags when linking
Clang does not use architecture flags while driving the linker:

    warning: argument unused during compilation: '--cuda-gpu-arch=...'
2024-01-18 13:23:42 -05:00
Brad King
2c6ec6de15 Link to transitive dependencies on stub libraries only on some linkers
Only linkers that enforce `--no-allow-shlib-undefined` recursively need
to link private transitive dependencies on stub libraries explicitly.
2024-01-04 11:59:26 -05:00
Brad King
49dc6a44e0 Merge topic 'Xcode-Check-Imported-Framework'
defbfd6f55 Xcode: Restore support for standalone IMPORTED_LOCATION_<CONFIG>

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9082
2023-12-19 08:04:01 -05: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
Brad King
dbede7be7e Merge topic 'cmake-sources-no-scan'
91b7bf59a7 cmGlobalXCodeGenerator: disable C++ module scanning for force-lang files
9e19a61ddb cmLocalGenerator: disable C++ module scanning for unity sources
fa9a72a788 cmLocalGenerator: disable C++ module scanning for copied PCH sources
e5dce1a37e cmQtAutoGenInitializer: disable C++ module scanning for autogen sources
4fd596c34c cmGeneratorTarget: disable C++ module scanning for verify targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9064
2023-12-12 08:33:38 -05:00
Ben Boeckel
4fd596c34c cmGeneratorTarget: disable C++ module scanning for verify targets 2023-12-11 07:52:31 -05:00
Brad King
fb54e957d6 Merge topic 'imported-implib-only'
fc6508921c cmComputeLinkInformation: Restore soname lookup for non-imported targets
03d86f9d9c cmGeneratorTarget: Add helper to check for known runtime artifact

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !9041
2023-12-06 08:49:04 -05:00
Brad King
03d86f9d9c cmGeneratorTarget: Add helper to check for known runtime artifact 2023-12-05 15:48:36 -05:00
Brad King
8d6dcaa4b0 Merge topic 'LINK_LIBRARY-genex-with-INTERFACE_LINK_LIBRARIES_DIRECT'
9798482a8c LINK_LIBRARY-genex: correct behavior for INTERFACE_LINK_LIBRARIES_DIRECT

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8992
2023-11-30 09:08:53 -05:00
Marc Chevrier
9798482a8c LINK_LIBRARY-genex: correct behavior for INTERFACE_LINK_LIBRARIES_DIRECT
Fixes: #25416
2023-11-29 11:26:52 -05:00
Brad King
baafd7a874 Merge topic 'cxxmodules-diagnostics'
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:42 -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
Brad King
c2bd158712 Merge topic 'fortran-objects-as-sources-fix'
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:45 -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
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
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
cdd741ebf9 Merge branch 'backport-ci-fedora-39' into ci-fedora-39 2023-11-17 11:35:41 -05:00
Brad King
2744f14db1 codespell: Fix typos 2023-11-17 09:58:21 -05:00
Brad King
16c5977504 Fix per-config sources in multi-config generators when first config adds none
Since commit b1c3ae33ea (cmTarget: Short-circuit language computation if
context independent., 2014-04-09, v3.1.0-rc1~669^2~1) we've tried to
avoid repeating computation of the list of sources for a target for
every configuration in the case that a per-config source (or object
library) contributes zero sources.  However, it is possible that an
entry contributes zero sources in the first configuration processed but
at least one source in other configurations.

Fixes: #25400
2023-11-13 14:00:12 -05:00
Brad King
2e16fca2be Merge topic 'cxxmodules-cmp0155-graceful-fallback-without-scanner'
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:15 -04: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
Marc Chevrier
96a953b1ed Add options to specify linker tool
Offer the capability, through variable `CMAKE_LINKER_TYPE`, as well as
the target property `LINKER_TYPE` to specify which linker must be used.

The implementation of this capability is specified by variables specific
to the language and linker type: `CMAKE_<LANG>_USING_LINKER_<TYPE>`.
Some definitions are provided as part of `CMake`.

For example, to select the `LLVM` linker rather than the standard one,
the type `LLD` should be specified through the variable `CMAKE_LINKER_TYPE`.
And, on `Apple`, `Linux` and some environments on `Windows`, the variable
`CMAKE_<LANG>_USING_LINKER_LLD` has value `-fuse-ld=lld`. And for `Windows`
environments  based on `MSVC`, where the linker is used directly, the tool
`lld-link.exe` will be used rather than `link.exe`.

Fixes: #19174, #24254, #24990
2023-10-13 11:52:35 +02: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