1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-05-12 08:05:28 +08:00

671 Commits

Author SHA1 Message Date
Kitware Robot
0b96ae1f6a Revise C++ coding style using clang-format with "east const"
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Issue: #26123
2025-01-23 13:09:50 -05:00
Alex Turbov
c3777c1536 ci: Extend spellcheck job with 'typos' tool
Unlike the `codespell`, `typos` is capable of finding typos
in combined identifiers (`CamelCase` or `snake_case`).
2025-01-22 08:51:45 -05:00
Brad King
5c7bb0bfd9 Merge topic 'rename-cmakelists'
fcbc883fa3 cmake: Allow configuration of default script names

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !10059
2024-12-18 08:49:58 -05:00
Martin Duffy
fcbc883fa3 cmake: Allow configuration of default script names
Adds the ``--project-file`` command-line option to modify the default script
name loaded by CMake and ``add_subdirectory`` to values other than
``CMakeLists.txt``.

Fixes: #21570
2024-12-17 12:47:02 -05:00
Alex Turbov
bdece1c754 Refactor: Optimize ostream::operator<<() calls for some generators 2024-12-11 19:40:41 +04:00
Marc Chevrier
7907c83175 Link step: Add LINK_WARNING_AS_ERROR target property
Add a way to specify, in a portable way, to raise an error for any
warning during the link step. For that purpose, define:
* CMAKE_LINK_WARNING_AS_ERROR variable
* LINK_WARNING_AS_ERROR target property

Fixes: #25343
2024-11-12 15:11:53 +01:00
Marc Chevrier
656267c871 COMPILE_WARNING_AS_ERROR: rename methods to prepare link similar functionality
Methods renamed:
* SetIgnoreWasinigAsError => SetIgnoreCompileWasningAsError
* GetIgnoreWasinigAsError => GetIgnoreCompileWasningAsError
2024-11-12 14:52:28 +01:00
Marc Chevrier
2bd4c06c26 Refactoring cmRulePlaceHolderExpander: propagate cmBuildStep information 2024-11-04 17:08:02 +01:00
Marc Chevrier
35350c419d Add support of "LINKER:" prefix for CMAKE_<TYPE>_LINKER_FLAGS variable
The following variables now support the LINKER: prefix:
* CMAKE_<TYPE>_LINKER_FLAGS
* CMAKE_<TYPE>_LINKER_FLAGS_<CONFIG>

Fixes: #26171
2024-11-04 17:07:58 +01:00
Pavel Liavonau
a36df0220f VS: Honor INTERPROCEDURAL_OPTIMIZATION for Fortran targets
Also map `-Qipo` to its `.vfproj` attribute.

Fixes: #26361
2024-10-14 10:17:12 -04:00
Brad King
e25f95c4cc Merge topic 'standard-link-directories'
20e9b59d5e Linking: Add CMAKE_LANG_STANDARD_LINK_DIRECTORIES

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9707
2024-08-29 08:31:17 -04:00
Vito Gamberini
20e9b59d5e
Linking: Add CMAKE_LANG_STANDARD_LINK_DIRECTORIES
Closes: #18222
2024-08-28 15:54:43 -04:00
Vitaly Stakhovsky
58da4aa47d Source: Avoid comparing pointers to nullptr 2024-08-27 10:56:38 -04:00
Brad King
03c31b0395 Drop Visual Studio 9 2008 generator
This generator has been deprecated since CMake 3.27.  Remove it.
2024-05-08 10:37:34 -04:00
Brad King
0bdcf1cb17 cmLocalVisualStudio7Generator: Make vfproj conditions more explicit
Avoid relying on the conditions for `vcproj` used by the VS9 generator.
2024-05-08 10:37:25 -04:00
Brad King
acc5ea7390 cmLocalVisualStudio7Generator: Reset per-target members after every target 2024-05-08 10:36:22 -04:00
Brad King
f498032141 cmVisualStudioGeneratorOptions: Rename {IsDebug => UsingDebugInfo}
The latter name is more precise.
2024-02-20 10:48:31 -05:00
Brad King
43d218d970 VS: Add support for using Intel oneAPI Fortran compiler in .vfproj files
Add a `fortran={ifort,ifx}` field to `CMAKE_GENERATOR_TOOLSET` to
specify which Intel Fortran compiler to use.

Fixes: #25427
2023-11-22 10:22:12 -05: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
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
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
Brad King
536c1de1d4 Drop Visual Studio 11 2012 generator
This generator has been deprecated since CMake 3.25.  Remove it.
2023-06-13 14:20:48 -04:00
Brad King
da27ff1e96 Preserve --compile-no-warning-as-error in automatic CMake re-runs
When the build system re-runs `cmake` to regenerate itself, preserve the
`--compile-no-warning-as-error` option if it was used when `cmake` was
last explicitly invoked.  Normally such settings are preserved in the
cache, but the purpose of this option is to be beyond the reach of
project code.
2023-05-30 17:44:43 -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
4c866cac40 VS: Do not regenerate build system concurrently with CMP0147
The VS generators add a custom command to `CMakeLists.txt` to re-run
CMake when input files have changed.  Mark this custom command as if it
were specified with `USES_TERMINAL`.  We already do this for the
equivalent `rebuild_cache` target in Makefile and Ninja generators.

This matters since commit d6353e74b4 (VS: Add policy to build custom
commands concurrently, 2023-03-10) because with policy CMP0147 set to
NEW, we now add `BuildInParallel` in `.vcxproj` file entries for custom
commands that do not have `USES_TERMINAL` set, but we do not want to
re-run CMake concurrently with other custom commands.

Issue: #18405
2023-03-15 14:33:36 -04:00
Kyle Edwards
480b363724 cmCustomCommand: Refactor custom command-specific policy values
Many custom commands are created by CMake itself rather than by
the user. These custom commands should always have their policies
set to NEW, and user-created custom commands should have their
policy values set only from the state snapshot. In addition, we
want to genericize the mechanism of recording a policy at the time
of custom command creation.

Add a CM_FOR_EACH_CUSTOM_COMMAND_POLICY macro to genericize
custom command policies. Use this to define all custom command
policies. Make all such policies NEW instead of WARN by default.
Remove individual policy modifier methods and add a single method
that records relevant values from a cmStateSnapshot. Remove the
no longer needed explicit policy settings from synthesized custom
commands.
2023-02-06 15:04:16 -05:00
Ben Boeckel
66ca5b6137 clang-tidy: fix readability-redundant-smartptr-get lints 2022-11-29 12:39:46 -05:00
Ben Boeckel
2381634e7f clang-tidy: fix readability-qualified-auto lints 2022-11-29 12:39:45 -05:00
Ben Boeckel
1f893e5873 clang-tidy: fix modernize-loop-convert lints 2022-11-29 12:39:45 -05:00
Ben Boeckel
362d6cd234 clang-tidy: fix modernize-raw-string-literal lints 2022-11-29 12:39:45 -05:00
Ben Boeckel
27f5ce07cc clang-tidy: fix performance-unnecessary-value-param lints 2022-11-29 12:39:45 -05:00
Ben Boeckel
b72c45e39f clang-tidy: fix readability-else-after-return lints 2022-11-29 12:39:29 -05:00
Ben Boeckel
07172aa31e clang-tidy: fix readability-redundant-string-cstr lints 2022-11-29 12:39:29 -05:00
Ben Boeckel
c61ece5c40 clang-tidy: fix modernize-use-auto lints 2022-11-29 12:39:29 -05:00
Ben Boeckel
1b929ba8e4 clang-tidy: fix modernize-use-nullptr lints 2022-11-29 12:39:29 -05:00
Ben Boeckel
860adec528 clang-tidy: fix modernize-pass-by-value lints 2022-11-29 12:39:29 -05:00
Ben Boeckel
27e37b8a5a clang-tidy: fix modernize-use-override lints 2022-11-29 12:39:29 -05:00
Ben Boeckel
f8a2926986 clang-tidy: fix modernize-use-default-member-init lints 2022-11-29 12:39:29 -05:00
Peter Würth
60a5a39022 cmCustomCommandGenerator: refactor GetComment to return std::string
Refactoring was done because EvaluateComment leaked memory.
2022-11-19 13:32:56 +01:00
Ilia K
3166547cf6 ASM_MARMASM: Add support for Microsoft ARM assembler language
https://learn.microsoft.com/en-us/cpp/assembler/arm/arm-assembler-reference

Fixes: #23999
2022-11-09 10:22:46 -05:00
Brad King
8d6f015d59 Drop Visual Studio 10 2010 generator
This generator has been deprecated since CMake 3.22.  Remove it.
2022-09-26 15:43:04 -04:00
Robert Maynard
96bc59b1ca CUDA: Add Device LTO support for nvcc
Fixes #22200
2022-07-22 10:34:45 -04:00
Marc Chevrier
42965799b4 Genex: Add $<LINK_LIBRARY:...>
This generator expression offers the capability, for the link step, to
decorate libraries with prefix/suffix flags and/or adding any specific flag for each
library.

Fixes: #22812, #18751, #20078, #22703
2022-02-08 00:02:32 +01:00
Sumit Bhardwaj
a88f98b3be Make cmGlobalVisualStudioGenerator::VSVersion enum class 2022-01-25 11:25:18 -08:00
Sumit Bhardwaj
3b7520b94d Consolidate usage of VsProjectType
Move ProjectFileExtension handling logic to use ProjectType and remove
extraneous checks in .Net SDK style project generation. This change will
make introducing new project types relatively simpler.
2021-12-23 15:53:04 -08:00
Sumit Bhardwaj
aca153b104 VS: Add custom VCEnd labels only in C# projects
In commit dff98aa9ca (VS: add missing label in C# project-build events,
2021-12-15) the condition for adding our own `VCEnd` label was based on
the project being managed or not.  Since we support managed C++
projects, switch the condition to be based on whether the project is C#.

Issue: #21440
2021-12-16 15:31:14 -05:00
Brad King
d71425f989 Merge topic 'vs-csproj-scripts'
dff98aa9ca VS: add missing label in C# project-build events

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6801
2021-12-16 10:36:56 -05:00
Steven Boswell
dff98aa9ca VS: add missing label in C# project-build events 2021-12-15 11:11:48 -07:00
NAKAMURA Takumi
780341f360 cmCustomCommand: Track main dependency explicitly
Store the main dependency as the first entry in the dependency list plus
a boolean member indicating its existence.  Note that this slightly
changes existing behavior: the main dependency was previously the last
entry of the dependency list.
2021-12-14 10:48:43 -05:00