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

1029 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
Brad King
381c446ff7 VS: Remove support for appending a platform to the generator name
Compatibility with CMake versions prior to 3.1 is no longer supported.

Fixes: #26481
2025-01-21 08:08:22 -05:00
Brad King
f8bc8780c1 CMP0026: Remove support for OLD behavior 2025-01-19 09:40:59 -05:00
Brad King
41a7a0119f CMP0018: Remove support for OLD behavior 2025-01-18 09:51:44 -05:00
Alex Turbov
bc8621d999
Fix: A lot of typos in code found by typos
Yet another great code spellchecker: https://github.com/crate-ci/typos/

(Will be added later as a `pre-commit` hook)
2025-01-12 18:49:34 +04: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
Aleksei Sapitskii
0282429c5a Xcode: Fix XCODE_EMBED_FRAMEWORKS when settings differ across targets
In commit 5651901c54 (Xcode: add support for embedding frameworks,
2020-10-24, v3.20.0-rc1~402^2) we incorrectly reused `PBXBuildFile`
instances when the same framework is embedded in multiple targets,
causing target-specific settings to conflict.

Fixes: #26438
2024-12-06 09:22:07 -05: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
Alex Turbov
f3f70c2f90
StringAlgorithms: Refactor cmTokenize() function
- Refactor and optimize the loop to make it shorter and faster
- Make it push elements into an arbitrary (templated) output iterator
- Make it a template on a separator type with the most used defaults
- Add a backward compatible signature to return `std::vector<std::string>`
- Add an alternative function `cmTokenizedView()` to return a vector of string views
2024-11-06 18:42:17 +04:00
Marc Chevrier
8bcf9c7a3e Add support of "LINKER:" prefix for artifact creation flags
The following variables now support the LINKER: prefix:
    * CMAKE_SHARED_LIBRARY_CREATE_<LANG>_FLAGS
    * CMAKE_SHARED_MODULE_CREATE_<LANG>_FLAGS
    * CMAKE_<LANG>_LINK_FLAGS
2024-11-04 17:08:03 +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
Gusts Kaksis
e3be24da68 Xcode: case-insensitive target ordering 2024-10-11 16:28:52 +03:00
Gusts Kaksis
80d0770250 Xcode: Fix target ordering operator to meet std::sort requirements
`std::sort` requires strict-weak ordering where `a == b` is false.
2024-10-10 15:57:02 -04:00
Vito Gamberini
20e9b59d5e
Linking: Add CMAKE_LANG_STANDARD_LINK_DIRECTORIES
Closes: #18222
2024-08-28 15:54:43 -04:00
Brad King
b38000d774 cmGlobalXCodeGenerator: Re-implement legacy makefile path escaping
Apply commit d74e651b78 (Makefiles: Re-implement makefile target path
escaping and quoting, 2020-04-10, v3.18.0-rc1~334^2~1) to the Xcode
generator's legacy Makefile generation.  This adds support for '#'.
However, since we use '$(VAR)' placeholders, do not escape '$'.

Issue: #25604
2024-05-15 13:27:38 -04:00
Brad King
d929089687 cmGlobalXCodeGenerator: Do not use legacy makefile escaping in shell commands
The `ConvertToMakefilePath` helper is meant only for paths in `.make`
files we generate for custom commands in the legacy build system.
2024-05-15 11:41:01 -04:00
Brad King
d61fc2c52e cmGlobalXCodeGenerator: Migrate legacy makefile path escaping to local helper
Also clarify the name.  It does not do any relative path conversion.
2024-05-15 11:40:31 -04:00
Brad King
ff1693cb3c cmGeneratorTarget: Clarify enum for specifying purpose of usage requirements
Since commit 1e49880472 (cmGeneratorTarget: Avoid boolean trap in usage
requirement lookup, 2021-12-08, v3.23.0-rc1~245^2) we have clarified
the distinction between compile-only and link-only usage requirements.
Rename the `LinkInterfaceFor` enum to `UseTo` to clarify that its role
is to specify the purpose of usage requirements.
2024-05-03 13:04:10 -04:00
Ilya Kulakov
3071660247 Xcode: Use builtin "default" file type
"sourcecode" is not appropriate for binary files, such as video, and
hinders Xcode performance.
2024-04-22 20:53:07 -04:00
lapfelix
1fa2ec1bbd Xcode: Use deterministic object ids for targets
When a CMake-generated Xcode project is included in another Xcode project,
the used targets' object ids are kept as `remoteGlobalIDString`.
Make the ids deterministic and somewhat independent of the build
tree location.
2024-04-10 14:33:57 -04:00
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
Mikko Lehtonen
77c4d2f9a2 Xcode: Fix PCH support with Swift & C++
Previously, when a mixed language target ends up with `Swift` as the
`LINKER_LANGUAGE`, the PCH file was not set for the target at all.

Fixes: #21224
2024-01-30 12:50:40 -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
91b7bf59a7 cmGlobalXCodeGenerator: disable C++ module scanning for force-lang files 2023-12-11 07:54:03 -05:00
Jonathan Earnshaw
2b4bb43ed3 Xcode: Add support to embed XPC Services 2023-11-30 10:09:34 +13:00
Brad King
91d3fe1638 Merge topic 'xcode-embed-resources'
6030df205a Xcode: Fix embed resources prop name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Deal <halx99@live.com>
Merge-request: !9008
2023-11-29 07:50:04 -05:00
halx99
6030df205a Xcode: Fix embed resources prop name
Fix commit e40d2cb3af (Xcode: Add embed resources support, 2023-07-31,
v3.28.0-rc1~281^2).  The implementation should not name the `_PATH`
suffix explicitly.  That variant is automatically handled by
`cmGlobalXCodeGenerator::AddEmbeddedObjects`.
2023-11-28 12:06:29 -05:00
Evan Wilde
c1d787e473 Swift: Add abstraction for compilation mode
Add a `CMAKE_Swift_COMPILATION_MODE` variable and corresponding
`Swift_COMPILATION_MODE` target property to control the compilation
mode.  Select among `wholemodule`, `singlefile`, and `incremental`.

Add policy CMP0157 to remove the default `-wmo` flags in favor of the
abstract setting.

Issue: #25366
2023-11-17 08:43:21 -05:00
Brad King
49df33c342 Merge topic 'static-library-link-xcframework'
7d19246138 Xcode: Fix linking against .xcframework from static libraries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8949
2023-11-07 09:56:25 -05:00
Kyle Edwards
7d19246138 Xcode: Fix linking against .xcframework from static libraries
Issue: #21752
2023-11-06 17:40:00 -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
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
Gregor Jasny
b78a14e204 Xcode: reject legacy buildsystem for Xcode 14
With Xcode 14 support for the Legacy Build System has been removed
and the BuildSystemType in the WorkspaceSettings is ignored.
If CMake still generates projects targeted to the Lecacy Build
System the build preparation phase will likely fail because Xcode
for example misses any declared outputs from script invocations.

This is a hard to debug problem and CMake should reject the invalid
configuration instead.
2023-08-31 10:13:57 +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
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
17dcd9424a Merge topic 'xcode-embed-resources'
e40d2cb3af Xcode: Add embed resources support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Deal <halx99@live.com>
Merge-request: !8632
2023-08-01 09:33:15 -04:00
halx99
e40d2cb3af Xcode: Add embed resources support 2023-07-31 09:08:10 +08:00
Ben Boeckel
09b7ac7f67 strings: use single characters where possible 2023-07-30 18:33:07 -04:00
Ben Boeckel
6aa9023700 string_view: use string_view literals in comparisons 2023-07-30 18:33:07 -04:00
Ben Boeckel
1b60137b98 strings: combine string literals 2023-07-30 18:33:07 -04:00
Ben Boeckel
f5d04b5bf0 cmStrCat: use where possible in Apple-specific sources 2023-07-30 18:33:07 -04:00
Ben Boeckel
22bc92fbc1 clang-tidy: fix readability-braces-around-statements lints 2023-07-30 18:33:07 -04:00
Ben Boeckel
1c33464485 clang-tidy: fix readability-else-after-return lints 2023-07-30 18:33:07 -04:00
Ben Boeckel
709c185d8f clang-tidy: fix bugprone-branch-clone lints 2023-07-30 18:33:07 -04:00
Ben Boeckel
efd9398844 clang-tidy: fix modernize-use-default-member-init lints 2023-07-30 18:33:07 -04:00
Ben Boeckel
f5056d28c5 clang-tidy: fix modernize-use-auto lints 2023-07-27 18:35:52 -04:00