Commit Graph

660 Commits

Author SHA1 Message Date
Martin Duffy
9689155a05 instrumentation: Add Config value to snippet data 2025-02-09 12:29:09 -05:00
Martin Duffy
ee3a55fc48 cmMakefileGenerator: Update GetConfigName to return const reference 2025-02-09 12:29:08 -05:00
Alex Turbov
d34971f455 Refactor: Eliminate redundant std::to_string as arg of cmStrCat
Plus optimize some other string operations in the modified files.
2025-01-26 04:03:38 +04:00
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
Martin Duffy
9d34069ca8 instrumentation: Add targetLabels field to link snippets
Adds a new data field `targetLabels` to link snippets which contains a list of
text labels from the LABELS target property.
2025-01-17 11:07:30 -05:00
Alex Turbov
b65930a7a7 Fortran: Add Fortran_BUILDING_INTRINSIC_MODULES for building intrinsics
In commit fe3f846e1b (Makefiles: Add support for building Fortran
intrinsics, 2020-11-19, v3.22.0-rc1~565^2) the property was added with
incorrect spelling `Fortran_BUILDING_INSTRINSIC_MODULES`.  Add a new
property with the correct spelling.  Keep the old one for compatibility.

Issue: #21463
2025-01-09 15:30:00 -05:00
Brad King
659d8bd430 cmPolicies: Remove now-unused REQUIRED_IF_USED and REQUIRED_ALWAYS states 2024-11-13 11:43: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
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
Brad King
b81c273445 Source: Remove unnecessary calls to CollapseFullPath
Remove call sites whose input is already an absolute path,
or whose result is not used.
2024-10-22 13:23:08 -04:00
Brad King
3ce26c57ba cmMakefileTargetGenerator: Avoid crash on GetLinkInformation failure 2024-09-20 13:45:45 -04:00
Juan Ramos
197cb419d1 add_custom_command: Add CODEGEN support
By specifying CODEGEN as an argument to add_custom_command the
custom command will be added to a codegen build target.

The intent is to provide a convenient way for users to get
their generated files without having to build the whole project.

This can be helpful for code analysis tools which can be useful
for IDEs and CI.
2024-07-01 12:02:49 -04:00
Brad King
ef006ebd9b PCH: Use per-arch .pch files only when building multiple Apple architectures
Since commit f593b354da (PCH: Add support for multi architecture iOS
projects, 2020-04-02, v3.18.0-rc1~414^2) we use per-arch .pch files
even when compiling for just the host architecture on macOS arm64.
This breaks with compilers that do not support `-Xarch_` flags, such
as GCC.  Avoid using per-arch .pch files in single-architecture builds.

Fixes: #25514
Issue: #20497
2024-05-01 12:43:39 -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
Brad King
4a9599927f Merge topic 'orkun_refactor_09_01_2024'
63d4e4ec28 Makefile: Reduce string copies
4d928592eb Makefile: Remove redundant push_back
3e533bd64f Makefile: Improve const correctness
c2dd5dfbe8 Makefile: Remove no-op call

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9142
2024-01-10 10:19:12 -05:00
Brad King
711e3f955a Merge topic 'makefile-depfile'
7198f0d149 Makefile: Fix double escaping when DEPFILE is used
5162ff64d4 Makefile: Reduce string copies

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9138
2024-01-10 10:14:24 -05:00
Orkun Tokdemir
7198f0d149 Makefile: Fix double escaping when DEPFILE is used
In commit cfd8a5ac1f (Makefiles: Add support of DEPFILE for
add_custom_command, 2020-12-04, v3.20.0-rc1~237^2~1) we added a
`ConvertToOutputPath` call on a path given to the `depends` field of
`WriteMakeRule`.  The latter already handles escaping for Makefile
syntax.

Fixes: #25554
2024-01-09 10:44:43 -05:00
Orkun Tokdemir
63d4e4ec28 Makefile: Reduce string copies 2024-01-09 13:05:01 +01:00
Orkun Tokdemir
4d928592eb Makefile: Remove redundant push_back 2024-01-09 13:05:01 +01:00
Orkun Tokdemir
3e533bd64f Makefile: Improve const correctness 2024-01-09 13:05:01 +01:00
Orkun Tokdemir
c2dd5dfbe8 Makefile: Remove no-op call 2024-01-09 13:05:01 +01:00
Orkun Tokdemir
5162ff64d4 Makefile: Reduce string copies 2024-01-08 11:58:04 -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
a033dce326 Makefiles: provide, but do not consume, "forward linked" target dirs
Makefiles do not have a per-object sense of where they come from, so
forwarding any module information here would end up with incorrect
module file path construction by consuming targets. Leave a TODO item in
its place.
2023-11-23 14:26:31 -05:00
Ben Boeckel
06df59b930 cmCommonTargetGenerator: return forward linked target dirs too
This will be used for module forwarding in order to support
`$<TARGET_OBJECTS>` usage in source and link libraries calls.
2023-11-21 09:44:39 -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
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
Marc Chevrier
3c685a578a LINK_OPTIONS: ensure correct dollar escaping
Ensure correct escaping for Ninja and Makefile generators.

Fixes: #25049
2023-07-17 15:55:58 +02:00
Clemens Wasser
1bb0e59318 codecvt: Extrace codecvt::Encoding to remove codecvt includes 2023-06-22 18:11:45 +02:00
Ben Boeckel
8195aa3026 Makefiles: quote $(COLOR) expansions
This handles the case where `COLOR` is set to some ANSI-like color
sequence in the ambient environment. These sequences tend to include `;`
which terminates the command and tries to use the next component
(typically an integer, possibly with a trailing `m`) with errors like:

    /bin/sh: line 1: 2: command not found
    /bin/sh: line 1: 255: command not found
    /bin/sh: line 1: 221: command not found
    /bin/sh: line 1: 255m: command not found

Also add a test that sets `COLOR` in the environment which affects the
generated Makefiles behavior.

See: https://discourse.cmake.org/t/cmake-failing-gcc-compiler-checks/8277
2023-06-08 11:05:11 -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
Orkun Tokdemir
b480315e0c TargetGenerator: Add SKIP_LINTING source property
The `SKIP_LINTING` source property was added to disable code check for
desired source files. The `SKIP_LINTING`includes `cpplint`, `clang-tidy`, \
`cppcheck` and `include-what-you-use`. If `SKIP_LINTING` is set on a
source file, the tools mentioned above will not be run on that source file.
2023-05-16 10:47:56 -04:00
Orkun Tokdemir
993dde925f TargetGenerator: Factor out generation of code check rules
De-duplicate code check rule generation in Ninja and Makefile generators
by moving their implementation to `cmCommonTargetGenerator`.

Previously Ninja was generating code check rules per language.
It was changed to generate code check rules for each source file.
2023-05-16 10:46:35 -04:00
Orkun Tokdemir
023af4ab2f Improve Const Correctness 2023-05-12 16:09:38 +02:00
Marc Chevrier
72faa9a017 CreateRulePlaceholderExpander(): enhance memory management
This method returns now a std::unique_ptr instance rather than a raw pointer.
2023-05-04 19:34:36 +02: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
Marc Chevrier
241304190f CMake code rely on cmList class for CMake lists management (part. 2) 2023-04-29 09:54:31 +02:00
Marc Chevrier
e08ba229ee CMake code rely on cmList class for CMake lists management (part. 1) 2023-04-24 10:41:10 +02:00
Stefan Schober
099934e313 Add generator expression support to static code analysis hooks
Teach target properties `<LANG>_CPPCHECK`, `<LANG>_CPPLINT`,
`<LANG>_CLANG_TIDY` and `<LANG>_INCLUDE_WHAT_YOU_USE` to accept
generator expressions.
2023-03-27 11:48:41 -04:00
Brad King
43e973eba2 cmGeneratorTarget: Pass language to GetAppleArchs when possible 2023-03-15 10:18:41 -04:00
Brad King
93afe804ce cmGeneratorTarget: Convert GetAppleArchs output argument to return value 2023-03-15 10:11:37 -04: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
Robert Maynard
c5305cf493 Makefile: Don't pass the CUDA compiler response files with UTF8_BOM
Fixes #24544
2023-02-28 15:39:55 -05:00
Kyle Edwards
78cf427157 RULE_LAUNCH_*: Add support for generator expressions 2023-02-03 11:23:32 -05:00
Brad King
c3210aab46 Merge topic 'lang-linker-launcher-genex'
33e27f6ca6 <LANG>_LINKER_LAUNCHER: Allow generator expressions
84ada0b0c9 <LANG>_COMPILER_LAUNCHER: Expand subset of genexes that can be evaluated

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8152
2023-02-03 10:00:49 -05:00
Kyle Edwards
84ada0b0c9 <LANG>_COMPILER_LAUNCHER: Expand subset of genexes that can be evaluated 2023-02-02 11:37:30 -05:00