Commit Graph

206 Commits

Author SHA1 Message Date
Brad King
4901fdb201 Merge topic 'presets-json-errors'
19305afd8a presets: Improve JSON parser and error messages

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !8290
2023-03-30 08:51:18 -04:00
Martin Duffy
19305afd8a presets: Improve JSON parser and error messages 2023-03-29 10:41:19 -04:00
Matthew Woehlke
302f5171d8 Utilities/Sphinx: Add 'cref' role
Add a role that can be used to create local links (a la '`LINK`_'), but
that also applies literal style. This is particularly useful for
referring to subcommands within the command's documentation in a style
that is consistent with ':command:`BAR <foo(BAR)>`' but is much less
verbose.

Although this is intended for subcommands, it works with any local
reference.

Co-authored-by: Brad King <brad.king@kitware.com>
2023-03-14 15:20:47 -04:00
Brad King
8c52458a9e cmRST: Fix cmake domain directives with newline before argument
The `signature` directive added by commit 74e3c1d313 (Utilities/Sphinx:
Add a directive to document command signatures, 2023-02-24) will be
commonly used with the form:

    .. signature::
       some_command(SOME_SIGNATURE)

      Docs for this signature.

Drop the assumption that all CMake domain directives are immediately
followed by their argument on the same line.
2023-03-09 16:10:03 -05:00
Matthew Woehlke
74e3c1d313 Utilities/Sphinx: Add a directive to document command signatures
Add a `signature` directive to offer a CMake version of Sphinx's
`function` directive, similar to that found in other domains (py, cpp,
etc.).  Like others, this takes one or more signatures as arguments and
creates dt/dd nodes from the signatures and the directive contents.
2023-03-03 17:05:02 -05:00
David Gobbi
aa86e8ddfd Remove component size limit for version comparisons
The VersionCompare() function converted version components to
'unsigned long' prior to comparing them.  Any version components
too large for 'unsigned long' were treated as equal to ULONG_MAX.
This impacted operators like VERSION_GREATER, VERSION_LESS, and
VERSION_EQUAL.  The new code does not limit the length of the
version components for valid comparisons.
2023-02-20 12:54:43 -05:00
David Gobbi
7e730d8f7f Tests: Add cases for cmSystemTools::VersionCompare 2023-02-20 12:54:04 -05:00
Brad King
0abeb3e394 Tests: Remove references to dropped KWSys SharedForward component 2023-02-07 10:50:17 -05:00
Kitware Robot
33abef7416 Revise C++ coding style using clang-format-15
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 15.

* 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.

Fixes: #24315
2023-01-18 16:20:47 -05:00
Kyle Edwards
1cca051470 cmStrCat(): allow any argument to be an rvalue string
This will allow us to re-use any rvalue allocation that is
available, not just from the first argument.
2022-12-06 13:54:42 -05:00
Kyle Edwards
beba50bd61 cmStrCat(): optimize when first argument is an rvalue string 2022-11-30 00:05:09 -05:00
Brad King
87b9a31489 Merge topic 'modernize-build-self'
9629be8080 Build: Use `CMAKE_CURRENT_XXX_DIR` instead of top dirs
e6fb5a1feb Build: Sort linked libraries list of `CMakeLib`
aa7290e8dc Build: Use imported target `Threads::Threads` instead of variable
df8ad72ffa Build: Use imported target `kwiml::kwiml` instead of variables
eeebf31e54 Build: Use imported target `LibRHash::LibRHash` instead of variables
08be01a181 Build: Use imported target `LibUV::LibUV` instead of variables
ddac6dcbe8 Build: Use imported target `JsonCpp::JsonCpp` instead of variables
ac76c53d33 Build: Use imported target `CURL::libcurl` instead of variables
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7570
2022-09-23 08:46:08 -04:00
Alex Turbov
0aed435b35 Build: Simplify configure_file() calls 2022-09-22 09:24:47 -04:00
Alex Turbov
a509602699 Build: Modernize some foreach calls to use IN LISTS/IN ITEMS 2022-09-22 09:24:46 -04:00
Brad King
ef1d34b20d Merge topic 'parse-large-int'
8fc822e13a file: Avoid strange istringstream crash in cmake.org binaries on Alpine Linux
31f158e4c8 cmStringAlgorithms: Add functions to parse strings to long long integers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7698
2022-09-21 10:12:11 -04:00
Brad King
31f158e4c8 cmStringAlgorithms: Add functions to parse strings to long long integers 2022-09-20 12:00:08 -04:00
Marc Chevrier
02c067dee5 cm::enum_set: fix various bugs 2022-08-22 16:25:53 +02:00
Matthew Woehlke
f2ef60ca54 cmArgumentParser: Ignore positional after keyword
Tweak cmArgumentParser to ignore positional arguments once a keyword
argument has been seen. This prevents mingling of keyword arguments
being able to effectively skip positional arguments, with later
arguments being picked up again; this seems highly likely to lead to
user confusion. This is also consistent with how other languages (e.g.
Python) handle a mix of "named" and positional arguments.
2022-08-17 11:03:51 -04:00
Brad King
7ca8d9f0f8 cmArgumentParser: Model non-empty strings with wrapper type
Some clients have been explicitly checking whether the string specified
after a keyword is empty.  Offer them a way to specify that the string
must be non-empty as part of the binding type.
2022-07-28 08:24:47 -04:00
Brad King
236bacc244 cmArgumentParser: Offer bindings for positional arguments 2022-07-27 07:03:32 -04:00
Brad King
1f2eb63d1c cmArgumentParser: Add callback bindings 2022-07-27 07:03:32 -04:00
Brad King
77fcb00a2b cmArgumentParser: Propagate constructors through binding wrapper types 2022-07-27 07:03:31 -04:00
Brad King
f7e81802f2 cmArgumentParser: Offer binding for list of parsed keywords
Some clients ask for this list in their `Parse()` call.
Offer them a way to express this request as a binding.
2022-07-25 13:52:01 -04:00
Brad King
f95a5832c7 cmArgumentParser: Drop unused keywordsMissingValue argument to Parse()
All clients have been converted to encoding this requirement in their
bindings.
2022-07-25 13:51:43 -04:00
Brad King
b7c82b26b0 cmArgumentParser: Capture keyword errors in parse results
Since commit f46b2e9142 (cmArgumentParser: Model maybe-missing string
with wrapper type, 2022-07-06) we know during parsing whether or not it
is an error for a keyword to be missing a value.  Record such errors in
the parse results structure.  Offer clients a helper method to report
them.  This provides clients with an alternative to manually checking
`keywordsMissingValue` and generating their own error message.
2022-07-22 10:32:24 -04:00
Brad King
50876f6b9a cmArgumentParser: Add structure to capture operational results
Create a way for the parser to record errors or incidental information
about the argument parsing operation that clients can inspect afterward.
Offer clients a way to hold the structure as part of their arguments
structure.
2022-07-22 10:32:18 -04:00
Brad King
f46b2e9142 cmArgumentParser: Model maybe-missing string with wrapper type
Bindings to `std::string` require one value.  Some clients have been
filtering `keywordsMissingValue` to support keywords that tolerate a
missing value.  Offer them a type-safe way to achieve this instead.
2022-07-07 09:49:04 -04:00
Brad King
e6d1e29ffa cmArgumentParser: Model maybe-empty and non-empty lists with wrapper types
Previously bindings to `std::vector<std::string>` required at least one
value.  Some clients have been filtering `keywordsMissingValue` to
support keywords followed by empty lists.  Instead, require clients to
specify whether a keyword's list can be empty as part of the binding
type.
2022-07-07 09:48:58 -04:00
Brad King
0a4c5164c9 cmArgumentParser: Offer cm::optional bindings to capture keyword presence
Several clients have been using `keywordsMissingValue` or
`parsedKeywords` to check for the presence of keywords.  Offer them a
type-encoded way to explicitly check whether a keyword is present.
2022-07-05 16:35:01 -04:00
Brad King
1ee5a4a548 cmArgumentParser: Avoid allocating copies of keyword strings 2022-07-05 16:34:57 -04:00
Ben Boeckel
6ff03d463f clang-tidy: address google-readability-casting lints
At least those involving `static_cast`.
2022-05-24 09:09:43 -04:00
Martin Duffy
30336dab66 cmJSONHelpers: Restructure cmJSONHelpers
Restructure cmJSONHelpers to prevent SunPro errors when passing context.
2022-05-05 12:12:12 -04:00
Marc Chevrier
b13eef5a90 cm::enum_set: container that contains a set of unique enum values.
The enum must be an `enum class` with an unsigned integer as base type.
2022-04-27 19:40:40 +02:00
Brad King
3055b202ec Merge topic 'builtin-help-versionadded'
054754359a cmRST: support `versionadded` and `versionchanged` directives

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6667
2021-10-28 09:09:24 -04:00
Ben Boeckel
054754359a cmRST: support versionadded and versionchanged directives
This makes `versionadded` and `versionchanged` directives show up in
`cmake --help-*` output instead of disappearing (and potentially making
empty sections).

Fixes: #22808
2021-10-27 09:15:00 -04:00
Sean McBride
1cf14f8c03 Source: fix many -Wmissing-prototypes warnings by marking functions static 2021-10-25 12:27:09 -04:00
Brad King
09f4edbcef Fix Clang -Wbitwise-instead-of-logical warnings 2021-10-13 10:00:08 -04:00
Sean McBride
907d098838 Source: Fix clang -Wextra-semi warnings 2021-09-28 09:59:24 -04:00
Brad King
b6c4d93dcd clang-analyzer: Suppress warnings in intentional use-after-move cases 2021-06-03 14:59:55 -04:00
Josef Angstenberger
e4a856f8b9 Tests: Fix typos and spelling in test error message 2021-05-07 17:00:14 +02:00
Ben Boeckel
808b17b120 clang-tidy: fix readability-make-member-function-const warnings 2021-01-27 08:45:45 -05:00
Brad King
7d498d6b43 Utilities/Sphinx: Add role and directive for 'genex' in CMake domain
This enables cross-reference syntax for CMake generator expressions:

    :genex:`SOME_GENEX`
    :genex:`$<SOME_GENEX>`
    :genex:`$<SOME_GENEX:...>`

and definition of CMake generator expressions via a directive:

    .. genex:: SOME_GENEX
    .. genex:: $<SOME_GENEX>
    .. genex:: $<SOME_GENEX:...>

It also adds generator expressions defined by the directive and by
`Help/genex/SOME_GENEX.rst` documents to the index.
2021-01-18 12:35:41 -05:00
Brad King
621ba5e1f2 cmRST: Add support for 'envvar' directive
This was accidentally left out of commit 8acf46caf1 (Utilities/Sphinx:
Add role and directive for 'envvar' in CMake domain, 2018-04-19,
v3.12.0-rc1~200^2~1).
2021-01-18 12:35:40 -05:00
Oleksandr Koval
209daa20b2 Code style: add missed explicit 'this->'
CMake uses explicit 'this->' style. Using custom clang-tidy check we can
detect and fix places where 'this->' was missed.
2021-01-05 14:32:36 +02:00
Eicke Herbertz
8c42cfb2e8 test/CMakeLib: make testUVProcessChain work with qemu
When building and testing CMake in a container with qemu
user mode emulation, the expected termination with std::abort()
in testUVProcessChainHelper leads qemu to emit an additional
message about an uncaught signal. There appears to be no way
to make qemu shut up, so any qemu message will be removed
from the output during validation.
2020-10-29 19:52:54 +01:00
Kyle Edwards
0668120398 cm::optional: Fix move assignment 2020-10-21 14:23:43 -04:00
Kyle Edwards
946adadd40 cmGccDepfileReader: Rework helper code
Fix some of the semantics of the depfile, add error handling, and
refactor cmGccDepfileLexerHelper.
2020-10-13 10:18:02 -04:00
Kyle Edwards
06c0d59c17 IWYU: Map <*> headers to <cm/*> headers
For headers which exclusively contain things that were not present
in C++11.
2020-10-08 13:40:21 -04:00
Kyle Edwards
3059e6aed7 cmJSONHelpers: Add new Bind() function 2020-10-05 09:49:59 -04:00
Marc Chevrier
82c9508313 cmake_path: enhancements
* Fix error on parsing "c:a" (root-name without root-directory)
* Enrich documentation
2020-09-20 15:17:34 +02:00