Commit Graph

506 Commits

Author SHA1 Message Date
Kitware Robot
1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05: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
Brad King
10cfc8f538 Merge topic 'extern-domain'
e109307c43 Add support for foreign targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10171
2025-01-22 09:30:49 -05:00
Vito Gamberini
e109307c43
Add support for foreign targets 2025-01-21 15:26:40 -05:00
Brad King
9b148ed1ac CMP0042: Remove support for OLD behavior 2025-01-19 09:41:02 -05:00
Brad King
84f737545f CMP0037: Remove support for OLD behavior 2025-01-19 09:41:01 -05:00
Brad King
f8bc8780c1 CMP0026: Remove support for OLD behavior 2025-01-19 09:40:59 -05:00
Brad King
65b45de1dd CMP0024: 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
Martin Duffy
097d4fd1b5 instrumentation: Collect and record project build system metrics
Add a feature for collecting build instrumentation for CMake projects.

Issue: #26099
2025-01-15 09:16:50 -05:00
Garrett Campbell
9ed178f9d8 Add generator-agnostic DEBUGGER_WORKING_DIRECTORY target property
Generalize the `VS_DEBUGGER_WORKING_DIRECTORY` property.

Issue: #16478
2024-12-09 10:47:10 -05:00
Martin Duffy
ea8e3107ec cmake --install: Respect CMAKE_DEFAULT_CONFIGS
When `cmake --install` is run with no `--config` passed, use
`CMAKE_DEFAULT_CONFIGS` to determine which config(s) to install.

Fixes: #21475
2024-11-19 11:37:47 -05:00
Martin Duffy
f50fb77a4f Ninja: Regenerate when test or install scripts are missing
Rerun CMake when `cmake_install.cmake` or `CTestTestfile.cmake` are out
of date.  This enables regeneration if a subdirectory is removed before
invoking `ninja`.

Fixes: #26396
2024-11-06 08:35:57 -05:00
Brad King
14e17a83be cmGlobalGenerator: Clarify Build method output mode argument name 2024-10-17 08:37:12 -04:00
Brad King
b8f14c6c4d cmGlobalGenerator: Remove default Build method output mode
Clarify call sites by passing the output mode explicitly.
2024-10-17 08:37:12 -04:00
Ben Boeckel
84bc710d84 cmGlobalGenerator: generate build database files for targets 2024-08-27 12:37:36 -04:00
Ben Boeckel
670f753f24 cmDyndepCollation: write build database metadata
Generators will hook this up into the build graph as needed.
2024-08-27 12:37:36 -04:00
Ben Boeckel
7b8b751637 cmGlobalGenerator: add a method to make an output-formatted string
This is needed to inject arguments through flag generation mechanisms so
that they can all be unescaped uniformly. Eventually, these methods
should go away and the escape/unescape dance be avoided completely.
2024-08-27 11:30:23 -04:00
Martin Duffy
159ba027b9 Install: Add parallel installation option
Fixes: #26000
2024-07-15 11:49:29 -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
Ben Boeckel
2c8361f923 cxxmodules: link to std-providing targets when available 2024-04-11 10:19:44 -04:00
Brad King
666d2e6451 Merge topic 'restore-pch-with-unity'
30829da506 Unity: Clarify source comments on unity build transformation
87bf1c6c33 Merge branch 'unity-after-compile-features' into restore-pch-with-unity
df08c37a42 cmGlobalGenerator: Add unity/pch sources after computing compile features
004c3c3986 Tests: Add case covering PCH in a unity build

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !9215
2024-02-05 09:57:19 -05:00
Brad King
df08c37a42 cmGlobalGenerator: Add unity/pch sources after computing compile features
Sources that will be scanned for C++ module dependencies need to be
excluded from unity builds.  We need to compute compile features in
order to know which sources will be scanned.  Unity build and PCH
sources can be added afterward without changing the compile features.

This re-implements commit 76b5383123 (cmGlobalGenerator: add unity
sources after computing target compile features, 2024-01-01,
v3.28.2~17^2~1) using a simpler approach that also preserves support for
PCH with Unity builds.

Issue: #25650
Co-authored-by: Ben Boeckel <ben.boeckel@kitware.com>
2024-02-02 09:39:13 -05:00
Brad King
446abdf324 Merge topic 'cxxmodules-no-unity'
63bbb3768d cmLocalGenerator: ignore scanned sources for unity builds
76b5383123 cmGlobalGenerator: add unity sources after computing target compile features
7fc2a83fe6 Tests/CXXModules: add a test with unity build support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9118
2024-01-10 10:15:46 -05:00
Ben Boeckel
76b5383123 cmGlobalGenerator: add unity sources after computing target compile features
We need to know which sources will be scanned for C++ module
dependencies in order to exclude them from unity builds.  The
addition of unity sources will not change the set of features.
2024-01-05 14:19:42 -05:00
Evan Wilde
64b3367845 cmGlobalGenerator: Allow passing language to GetLangaugeOutputExtension
The original GetLanguageOutputExtension took a sourcefile instead of the
name of the language itself. This implementation provided a convenient
handler for when the SourceFile doesn't know what language it is, but
there are times where we know the language, but don't necessarily have a
source file. Adding an overload that takes the name of the language and
returns the extension of that language, or empty string if no extension
is registered.
2023-12-04 19:15:20 -05: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
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
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
Brad King
88c6dc75ba Merge topic 'command-job-server-aware'
95941fd990 add_custom_{target,command}: Add argument JOB_SERVER_AWARE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8547
2023-07-20 10:23:31 -04:00
Chris Mahoney
95941fd990 add_custom_{target,command}: Add argument JOB_SERVER_AWARE
Issue: #16273
2023-07-19 10:45:33 -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
0183e1bca3 cxxmodules: remove CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP variable
It is now subsumed by the UUID setting completely.
2023-06-01 14:43:26 -04:00
Brad King
5b063510f9 Merge topic 'cmake-verbose-print-build-tool-command'
8451a3f0b5 cmGlobalGenerator: use a stream for output in `Build`
e060666531 cmake: write the build command itself with `--verbose`
b017c9f127 cmGlobalGenerator: fix off-by-one for `&&` command joining
c715fd8d76 cmGlobalGenerator: quote commands in `::Build` output
d6c0e827bc cmGlobalGenerator: add a `QuotedPrintable` method for commands
28ee3bef34 cmGlobalGenerator: add missing spaces in output
465ab8d872 cmGlobalGenerator: use `cmStrCat` in `::Build`
81d45dabc4 cmOutputConverter: add a `static` version of `EscapeForShell`

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !8183
2023-05-31 09:33:26 -04:00
Ben Boeckel
8451a3f0b5 cmGlobalGenerator: use a stream for output in Build
This allows output to show up in output immediately instead of being
batched.
2023-05-27 07:04:17 -04:00
Marc Chevrier
5884303e69 Apple Framework: enhance path parsing 2023-05-21 14:26:08 +02:00
Ben Boeckel
d6c0e827bc cmGlobalGenerator: add a QuotedPrintable method for commands 2023-05-16 12:47:50 -04: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
Orkun Tokdemir
69cf9700e6 Autogen: Defer setup until Generate step
It is better to set variables up once all target dependencies are known.
2023-04-05 16:12:16 -04:00
Brad King
17e6b2bdca Merge topic 'automoc-cxx-standard'
429a452705 Autogen: Add target's C++ standard to moc_predef.h
21f812e57c Autogen: Split creation and setup of custom targets into separate steps

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8359
2023-03-31 08:09:06 -04:00
Brad King
689616785f macOS: Do not pass Apple-specific flags to llvm-strip
Since commit cf82300a63 (BinUtils: Clarify search logic and make it more
consistent, 2021-05-27, v3.21.0-rc1~119^2~2) we prefer `llvm-strip` over
`strip` when using Clang.  However, since commit 20291e8e72 (install:
Fix stripping on macOS, 2019-01-30, v3.14.0-rc1~31^2) on macOS we add
flags `-u -r`, needed by Apple's `strip` for executables, but that
`llvm-strip` does not need or support.  Improve the condition to add
Apple-specific flags only when the selected `strip` tool is Apple's.

Note that Apple dylibs must be stripped with `-x` with either Apple's
`strip` or `llvm-strip`.

Fixes: #24601
2023-03-29 15:19:47 -04:00
Brad King
367aa65a9f Merge topic 'module-depends-static-lib-cycle'
01d7860fdb Ninja,Makefile: Restore Fortran module scanning in static library cycle
846baa7c5b cmGlobalGenerator: Factor out helper to check target ordering

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8363
2023-03-27 09:51:59 -04:00
Brad King
846baa7c5b cmGlobalGenerator: Factor out helper to check target ordering 2023-03-24 15:57:52 -04:00
Orkun Tokdemir
21f812e57c Autogen: Split creation and setup of custom targets into separate steps
Defer the setup step until after compile features have been finalized on
normal targets.  Later this will help pass the information to Qt tools.

Issue: #24624
2023-03-24 12:23:47 -04:00
Brad King
88bc8dfc14 cmMakefile: Store recursion depth limit as size_t 2023-03-13 11:32:03 -04:00
Craig Scott
85f61686b6 Merge topic 'code-comment-typos'
a817948423 Code comments: Fix trivial typos

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8030
2022-12-19 15:14:19 -05:00
Craig Scott
a817948423
Code comments: Fix trivial typos 2022-12-18 09:47:11 +11:00
Ben Boeckel
5e026739e1 cmGlobalGenerator: factor out C++ module support checking
This will simplify adding support to other generators.
2022-11-23 17:31:31 -05:00
Marc Chevrier
0bd3efffbc Genex LINK_LIBRARY: Add support for framework with postfix 2022-09-21 16:14:36 +02:00