Commit Graph

1779 Commits

Author SHA1 Message Date
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
Brad King
ee83165923 cmake: Explicitly normalize input paths as they exist on disk
`CollapseFullPath` has two use cases:

1.  Normalize input paths from command-line arguments and environment
    variables.  On Windows, load their on-disk capitalization.

2.  Simplify paths constructed internally.  These should already have
    the correct capitalization.

Audit all `CollapseFullPath` call sites and code paths leading to them.
Replace those calls that normalize input paths with calls to
`ToNormalizedPathOnDisk` to express that they need the on-disk case.

By making this distinction we will later be able to remove the on-disk
capitalization lookup `CollapseFullPath`, thus eliminating disk accesses
from internal path processing.

Issue: #20214
2024-10-22 13:26:19 -04:00
Daniel Pfeifer
281e9039cb cmWorkingDirectory: Unify error messages 2024-10-18 15:04:07 -04:00
Daniel Pfeifer
1440b05bf1 cmMakefile: invoke callback after command execution
`cmMakefile` has a hook that invokes a callback before each command
execution.  The only user of that hook is `cmCTestScriptHandler`,
which uses it to update the elapsed time since it was started.
The `ctest_sleep` command again updates the elapsed time explicitly.
This explicit update can be saved by invoking the callback after
the command execution instead.
2024-10-11 15:38:25 +02:00
Brad King
fe6cf6d28c Add deprecation warnings for policies CMP0139 and below
The OLD behaviors of all policies are deprecated, but only by
documentation.  Add an explicit deprecation diagnostic for policies
introduced in CMake 3.24 and below to encourage projects to port
away from setting policies to OLD.
2024-10-10 09:31:52 -04:00
Brad King
2daeb0b504 Merge topic 'build-databases'
e77655555c cmExperimental: gate build database support behind a flag
23cbeb5035 ci: enable `build_database` CXXModules tests
6863c1d823 Tests/CXXModules: add tests for module commands
123107c1a4 Tests/CXXModules: add support for running targets under a given config
438038b5e1 Tests/CXXModules: support building specific targets of example trees
84bc710d84 cmGlobalGenerator: generate build database files for targets
670f753f24 cmDyndepCollation: write build database metadata
dcf9a66ffe cxxmodules: plumb control data for exporting build databases
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9708
2024-09-05 09:20:23 -04:00
Ben Boeckel
c48affe037 cmMakefile: support "after generator target" generator actions
These actions may require additional information gathered during
generation. Run them at the appropriate time.
2024-08-27 11:30:23 -04:00
Vitaly Stakhovsky
58da4aa47d Source: Avoid comparing pointers to nullptr 2024-08-27 10:56:38 -04:00
Alex Turbov
62bb8a77a5 cmMakefile: Teach ConfigureFile to move the temp file instead of copying it
In the variables substitution mode `cmMakefile::ConfigureFile`
was copy file and then remove temporary rendered file.

With updated signature of `MoveFileIfDifferent` it can be used
instead of `CopyFileIfDifferent`.
2024-07-18 10:29:47 -04:00
Alex Turbov
0a0a826b86 cmMakefile: Use find_if instead of manual loop
...in the `cmMakefile::ValidateCustomCommand()` as it was a warning
issued by `clang-tidy`.
2024-07-18 10:29:47 -04:00
Alex Turbov
e0294fa310 cmMakefile: Replace single-char string literal with char for cmStrCat
Also, remove redundant quote escapes.
2024-07-18 10:29:46 -04:00
Alex Turbov
206961bc60 cmMakefile::FormatListFileStack: Refactor "manual" loop into algorithms 2024-07-18 10:29:46 -04:00
Alex Turbov
ce991188f3 cmMakefile::FormatListFileStack: Exit early on empty stack trace
And deindent the rest of the function.
2024-07-18 10:29:46 -04:00
Alex Turbov
29fb605822 cmMakefile::FormatListFileStack: Refactor 'while' into 'for' 2024-07-18 10:29:46 -04:00
Alex Turbov
b8fb4b778c cmMakefile::ConfigureFile: Convert 'else' block to early return and deindent 2024-07-18 10:29:46 -04:00
Alex Turbov
d4faff52d3 cmMakefile: strnspn => std::strnspn 2024-07-18 10:29:45 -04:00
Alex Turbov
1df30b6bf2 cmMakefile: Use cmStrCat instead of std::stringstream 2024-07-18 10:29:45 -04:00
Alex Turbov
33986a1c60 cmMakefile: Remove redundant << stream operators 2024-07-18 10:29:45 -04:00
Alex Turbov
b9a5a2b494 cmMakefile: Replace ternary with bool => int cast 2024-07-18 10:29:45 -04:00
Raul Metsma
2785364b7b iOS: Add support for Mac Catalyst
Issue: #20132
Signed-off-by: Raul Metsma <raul@metsma.ee>
2024-07-03 11:15:45 -04:00
Brad King
4394464501 Add deprecation warnings for policies CMP0129 and below
The OLD behaviors of all policies are deprecated, but only by
documentation.  Add an explicit deprecation diagnostic for policies
introduced in CMake 3.23 and below to encourage projects to port
away from setting policies to OLD.
2024-06-05 13:19:07 -04:00
Brad King
4d661e3a92 cmMakefile: Reduce GetModulesFile caller allocations 2024-03-22 09:51:06 -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
9c5e981e60 Add deprecation warnings for policies CMP0128 and below
The OLD behaviors of all policies are deprecated, but only by
documentation.  Add an explicit deprecation diagnostic for policies
introduced in CMake 3.22 and below to encourage projects to port
away from setting policies to OLD.
2024-02-06 17:07:09 -05:00
Chen Linxuan
3b07ec631d add_custom_command: Allow adding build event via ALIAS target
Signed-off-by: Chen Linxuan <me@black-desk.cn>
2024-02-01 08:21:41 -05:00
Brad King
d9d9326e14 Source: Avoid out-of-range inputs to std::isspace()
`isspace` takes `int` but documents that the value must be representable
by `unsigned char`, or be EOF.  Use a wrapper to cast to `unsigned char`
to avoid sign extension while converting to `int`.  This generalizes the
fix from commit 5e8c176e2a (cmExecuteProcessCommand: Cast c to unsigned
char before cast to int, 2024-01-05) to other `isspace` call sites.

This was detected by assertions in the MSVC standard library while
processing UTF-8 text.

Issue: #25561
2024-01-17 10:17:06 -05:00
leha-bot
b62dcbf5d2 cmMakefile: check cmake script mode exit code after command
Which potentially may set it, and forward it to the cmExecutionStatus
for proper handling in caller.
2024-01-16 10:41:31 +03:00
leha-bot
3d9d504646 cmMakefile: Store the exit code from cmExecutionStatus to cmake instance 2024-01-16 10:41:31 +03: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
7cd0adab1b cmCommonTargetGenerator: use modules from linked object-referenced targets
Fortran modules provided by objects added as linked items via
`$<TARGET_OBJECTS>` should also be considered as "linked targets" for
collation purposes. As C++ modules have their own visibility rules
through their `FILE_SET` feature, do not expose these for C++ module
collation.
2023-11-23 14:26:31 -05:00
Brad King
cdd741ebf9 Merge branch 'backport-ci-fedora-39' into ci-fedora-39 2023-11-17 11:35:41 -05:00
Brad King
2744f14db1 codespell: Fix typos 2023-11-17 09:58:21 -05:00
Kyle Edwards
c6e6861e63 install(EXPORT): Export find_dependency() calls
Issue: #20511
Co-Authored-by: Brad King <brad.king@kitware.com>
Co-Authored-by: Robert Maynard <rmaynard@nvidia.com>
2023-11-13 11:07:52 -05:00
Sean McBride
07e9734790 Source: Fix clang -Wdeprecated-this-capture warnings
Explicitly capture variables used in the lambda.
2023-10-26 09:24:54 -04:00
Brad King
86d910ab73 Add deprecation warnings for policies CMP0126 and below
The OLD behaviors of all policies are deprecated, but only by
documentation.  Add an explicit deprecation diagnostic for policies
introduced in CMake 3.21 and below to encourage projects to port
away from setting policies to OLD.
2023-10-03 17:21:47 -04:00
Kyle Edwards
b4565c8c91 .xcframework: Check SupportedPlatformVariant 2023-08-15 09:45:17 -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
faf36e65b9 cmMakefile: use single characters where possible 2023-07-19 16:38:34 -04:00
Ben Boeckel
4fd80d5419 cmMakefile: use static string views in some locations 2023-07-19 16:38:27 -04:00
Ben Boeckel
e41ff26735 cmMakefile: use cmStrCat where possible 2023-07-19 16:38:27 -04:00
Gregor Jasny
25977e177b apple: add preliminary visionOS support 2023-07-11 20:20:25 +02:00
Marc Chevrier
45f17e5a85 cmList: Add container conversion to string 2023-06-22 15:44:17 +02:00
Brad King
9ba9b6c658 Add deprecation warnings for policies CMP0120 and below
The OLD behaviors of all policies are deprecated, but only by
documentation.  Add an explicit deprecation diagnostic for policies
introduced in CMake 3.20 and below to encourage projects to port
away from setting policies to OLD.
2023-06-07 14:31:50 -04:00
Brad King
c4f273e722 Merge topic 'AddCacheEntry-suppress-raw-pointer-usage'
4fc322bab4 AddCacheEntry: Suppress raw pointer usage

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8520
2023-05-31 09:35:25 -04:00
Marc Chevrier
4fc322bab4 AddCacheEntry: Suppress raw pointer usage 2023-05-30 16:41:59 +02:00
Glen Chung
a9a592f96e cmake: Add debugger
- Depends on cppdap and jsoncpp.
- Add --debugger argument to enable the Debugger.
- Add --debugger-pipe argument for DAP traffics over named pipes.
- Support breakpoints by filenames and line numbers.
- Support exception breakpoints.
- Call stack shows filenames and line numbers.
- Show Cache Variables.
- Show the state of currently defined targets,
  tests and directories with their properties.
- Add cmakeVersion to DAP initialize response.
- Include unit tests.

Co-authored-by: Ben McMorran <bemcmorr@microsoft.com>
2023-05-30 09:46:12 -04:00
Marc Chevrier
aa5fed5052 SetProperty: suppress raw pointer usage 2023-05-26 14:48:22 +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
Artin Alavi
8e579b0228 presets: Add trace options to configure presets
Add JSON schema version 7 to support them.

Fixes: #22543
2023-03-30 09:18:53 -04:00