1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-07-17 12:14:23 +08:00

984 Commits

Author SHA1 Message Date
Vitaly Stakhovsky
1a49b439a5 Source: Use cmValue::IsOn and IsOff
Speed up a bit by calling members directly.
2024-03-17 19:05:37 -04:00
Brad King
721d8b192a VS: Add UseDebugLibraries to vcxproj files by default
Use heuristics to select a reasonable value.  Add policy CMP0162
to provide compatibility with existing projects.

Fixes: #25327
2024-02-22 08:43:16 -05:00
Brad King
47136b6959 VS: Suppress more MSBuild defaults affected by UseDebugLibraries
Extend commit 67de5b7b82 (VS: Suppress MSBuild default settings affected
by UseDebugLibraries, 2024-02-13) to cover a `Microsoft.Cl.Common.props`
default from VS 2015 and older.
2024-02-22 08:42:58 -05:00
Brad King
f498032141 cmVisualStudioGeneratorOptions: Rename {IsDebug => UsingDebugInfo}
The latter name is more precise.
2024-02-20 10:48:31 -05:00
Brad King
b814641444 VS: Add [CMAKE_]VS_USE_DEBUG_LIBRARIES options to control UseDebugLibraries
This indicates to MSBuild which configurations are considered debug
configurations.  This is useful for reference both by humans and tools.

Issue: #25327
2024-02-19 10:40:41 -05:00
Brad King
67de5b7b82 VS: Suppress MSBuild default settings affected by UseDebugLibraries
`Microsoft.Cl.Common.props` changes some default settings based on
`UseDebugLibraries`.  CMake models its own controls for these settings,
so if the project does not set them, explicitly suppress them to avoid
letting `UseDebugLibraries` affect them.
2024-02-19 10:40:40 -05:00
Brad King
0ae372daee VS: Factor out common MS tool configuration
De-duplicate code writing `PlatformToolset`.
2024-02-19 10:40:40 -05:00
Brad King
899a1f64af Merge topic 'vs-scan-for-modules'
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:03 -05:00
Ben Boeckel
029ddc3410 cmVisualStudio10TargetGenerator: always specify scanning
Set that sources should not be scanned on a target-wide basis and then
enable on a per-TU basis as needed.

Fixes: #25519
2024-01-06 11:18:57 -05:00
Ben Boeckel
34f4423851 cmVisualStudio10TargetGenerator: fix typo in flag name
It is case insensitive, so this only matches the official flag name and
still works.
2024-01-06 11:18:57 -05:00
Brad King
aff7870172 Merge topic 'cxxmodules-vs-no-synthetic-targets'
17fd7fe2ae Tests/CXXModules: test Visual Studio synthetic target error
badb6ab120 VS: Explicitly disallow C++ modules provided by imported targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8895
2023-10-18 09:51:53 -04:00
Ben Boeckel
badb6ab120 VS: Explicitly disallow C++ modules provided by imported targets
The `-ifcOnly` flag is understood by MSBuild, but there are unresolved
questions about how to integrate with with CMake's model.

See: #25328
2023-10-17 14:46:57 -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
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
Robert Maynard
aa8facefe8 CUDA: Visual Studio propagate objects to device linking
When given objects via `target_link_libraries(consumer PRIVATE producer)` the VisualStudio solution adds the objects
under as `<Object>` entries in the solution.

This works for host side linking but isn't handled by
the cuda msbuild extensions. So to work around this we
manually add the objects as additional link items.
2023-09-22 11:54:12 -04:00
Brad King
5b590882fa Merge topic 'cxxmodules-non-compiled-source'
24a9b00f83 Merge branch 'cxxmodules-non-compiled-source-release' into cxxmodules-non-compiled-source
458e3974a8 cxxmodules: detect and message about non-compiled sources

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8773
2023-09-14 13:01:21 -04:00
Ben Boeckel
24a9b00f83 Merge branch 'cxxmodules-non-compiled-source-release' into cxxmodules-non-compiled-source
* cxxmodules-non-compiled-source-release:
  cxxmodules: detect and message about non-compiled sources
2023-09-12 14:47:20 -04:00
Ben Boeckel
458e3974a8 cxxmodules: detect and message about non-compiled sources
Previously an internal error was raised which ended up causing an
internal exception to be thrown. This is a typo situation that should
fall into an explicit error.

Fixes: #25207
2023-09-12 14:46:36 -04:00
Brad King
93d813d87c Merge topic 'vs-cuda-object-libs'
6ebff6ebf8 VS: Avoid unnecessary CUDA device linking for OBJECT libraries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8794
2023-09-12 09:06:15 -04:00
Robert Maynard
6ebff6ebf8 VS: Avoid unnecessary CUDA device linking for OBJECT libraries
Without `CudaLink` fields, MSBuild tries to perform a device link step
for object libraries with CUDA_SEPARABLE_COMPILATION on them even when
not needed.  This commonly was encountered when generating PTX or
OPTIX-IR output.
2023-09-11 16:49:35 -04: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
159585967a cmGeneratorTarget: classify BMI-only C++ module sources 2023-08-17 14:42:53 -04:00
Ben Boeckel
36bd3d82f8 cmSystemTools: move ComputeCertificateThumbprint to the only consumer
There's no need to have this API on `cmSystemTools` with only a single
consumer.
2023-08-08 14:25:01 -04:00
Ben Boeckel
ec5f1c489a cmCryptoHash: prefer to cmSystemTools::ComputeStringMD5
The latter call is no longer post-bootstrap only since 596439b1bb
(cmCustomCommandGenerator: Add option to transform depfile, 2020-10-05)
via !5325. Convert callers to just use `cmCryptoHash` directly and
remove the bootstrap guard.
2023-08-08 13:22:13 -04:00
Brad King
1972a7b6e3 Merge branch 'backport-revert-vs-show-cmake-files' 2023-08-02 12:11:11 -04:00
Brad King
0d1529000d VS: Revert "Add CMake input files to ZERO_CHECK"
Since commit df58dbb0e9 (VS: Add CMake input files to ZERO_CHECK,
2023-03-19, v3.27.0-rc1~157^2), projects that specify the same file both
as input to `configure_file` and as the `MAIN_DEPENDENCY` of a custom
command fail to configure.  Revert the change pending further
investigation.  Add a test case demonstrating the problem.

Issue: #24557
Fixes: #25149
2023-08-02 11:53:48 -04: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
d8b6a750a0 Merge topic 'windows-tidy-cmstrcat'
d58253d155 clang-tidy: fix `performance-faster-string-find` lints
a19ec77200 clang-tidy: fix `readability-static-accessed-through-instance` lints
3d03629f20 cmWIXRichTextFormatWriter: remove identity cast
1df29567ac clang-tidy: fix `modernize-use-equals-default` lints
32fe862b8c clang-tidy: fix `readability-container-size-empty` lints
7eaab9a957 clang-tidy: fix `modernize-raw-string-literal` lints
ffa49c23aa clang-tidy: fix `readability-else-after-return` lints
4489e9a85c clang-tidy: fix `modernize-use-auto` lints
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8668
2023-08-01 09:31:45 -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
Ben Boeckel
d4144b9c0a strings: use emplace_back with cmStrCat arguments 2023-07-27 20:15:51 -04:00
Ben Boeckel
809248a0c9 strings: use character literals where possible 2023-07-27 20:00:59 -04:00
Ben Boeckel
7137b17835 cmStrCat: use in Windows-specific sources 2023-07-27 20:00:59 -04:00
Ben Boeckel
2409f62d18 strings: simplify streaming sequences 2023-07-27 19:10:39 -04:00
Ben Boeckel
a5ba00bdf8 strings: combine string literals where possible 2023-07-27 19:10:39 -04:00
Ben Boeckel
3f1378fbca strings: compare to static string_view instances in Windows-only code 2023-07-27 19:10:39 -04:00
Brad King
4938a0cbdd Merge topic 'vs-cxxmodules-same-src-name'
b9c99830c5 VS: Fix C++ modules in source files with the same name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8596
2023-06-30 09:28:20 -04:00
Brad King
b9c99830c5 VS: Fix C++ modules in source files with the same name
When multiple source files in a single target have the same name, we
already set `ObjectFileName` explicitly to avoid a `.obj` collision. For
C++ module sources, set `Module{Output,Dependencies}File` to avoid
`.ifc` and `.module.json` collisions.

Fixes: #25038
2023-06-28 06:43:10 -04:00
Brad King
93c379430d Merge topic 'vs-cxxmodules-public-bmis'
d90a61d671 VS: Make C++ module BMIs public by default for shared libraries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8549
2023-06-23 10:48:15 -04:00
Andreas Weis
d90a61d671 VS: Make C++ module BMIs public by default for shared libraries
Enable the `AllProjectBMIsArePublic` option for shared libraries in the
VS project files when building with C++20 modules support.
2023-06-22 14:22:56 -04:00
Brad King
f444f172c3 cmVisualStudio10TargetGenerator: Remove unused VS-10-only code
Remove code that is not used since commit 8d6f015d59 (Drop Visual Studio
10 2010 generator, 2022-09-26, v3.25.0-rc1~78^2).
2023-06-13 13:47:28 -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
Brad King
406a103318 VS: Add support for C++ module internal partitions in VS 17.6 and newer
VS 17.6 now implements `ScanSourceforModuleDependencies` using the same
`cl /scanDependencies` scanner that our Ninja generator uses.  It can
distinguish module internal partitions from module interface units based
on their content.  Switch from `CompileAsCppModule` to `CompileAsCpp`
for `CXX_MODULES` sources so that MSBuild can scan and classify them.
2023-05-17 11:59:24 -04:00
Marc Chevrier
241304190f CMake code rely on cmList class for CMake lists management (part. 2) 2023-04-29 09:54:31 +02:00
Alexander Neundorf
df58dbb0e9 VS: Add CMake input files to ZERO_CHECK
Add all cmake input files to the `ZERO_CHECK` project.  Place files
under `CMAKE_SOURCE_DIR` in a folder structure matching the directory
structure.  This way they are easier to find, and Visual Studio does not
close them when reloading the project.

Fixes: #24557
2023-04-25 17:35:39 -04:00
Marc Chevrier
e08ba229ee CMake code rely on cmList class for CMake lists management (part. 1) 2023-04-24 10:41:10 +02:00
Brad King
db4f4ad24e Merge topic 'support_cubin_fatbin_optix_cuda_output'
2def6a874b CUDA: Add support for CUBIN, FATBIN, and OPTIXIR compilation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8259
2023-03-14 09:35:00 -04:00
Robert Maynard
2def6a874b CUDA: Add support for CUBIN, FATBIN, and OPTIXIR compilation 2023-03-13 09:54:00 -04:00
Brad King
d6353e74b4 VS: Add policy to build custom commands concurrently
In commit 33c15ae2b9 (VS: Build custom commands concurrently when
possible, 2023-01-19, v3.26.0-rc1~56^2) we added `BuildInParallel` to
custom commands in `.vcxproj` files, but that had to be reverted by
commit abb1c12162 (VS: Revert "Build custom commands concurrently when
possible", 2023-03-07, v3.26.0-rc6~3^2) because some projects may have
custom commands that accidentally rely on serial execution in MSBuild.

Add a policy to use `BuildInParallel` for custom commands in projects
that have been updated to set the policy to `NEW`.

Fixes: #18405
2023-03-12 07:51:58 -04:00
Brad King
12234b2851 Merge topic 'vs-props-order'
d3c4c6d630 VS: Import default C++ props file before toolset-specific props file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8294
2023-03-08 09:00:29 -05:00