Commit Graph

127 Commits

Author SHA1 Message Date
Brad King 8832f78dd6 IWYU: Update for Debian 13 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 13.  Some patterns:

* Types named in virtual `override` signatures no longer require
  includes since the overridden signature already names them.

* A function argument's type needs to be included even if its constructor
  is called only by implicit conversion.  For example, constructing a
  `std::function` from a lambda now requires `<functional>`.

* Some prior mysterious `<type_traits>` inclusions are no longer required.
2025-11-12 14:54:35 -05:00
Eduard Voronkin e42881422f FASTBuild: optimize try_compile builds
The generator does a lot of tricks in order to make the "rebuild-bff"
target up-to-date immediately after the generation. We can skip all of
those during "TryCompile" runs, which should reduce configure time.
2025-10-22 17:32:48 -07:00
Brad King 50f87b4bf2 cmGlobalGenerator: Simplify collection of targets under a project() 2025-09-16 11:32:27 -04:00
Daniel Pfeifer ee1c32b6d7 source: Pass cmBuildOptions by value 2025-07-30 11:55:34 -04:00
Ben Boeckel b82a74d918 generators: use GetSupportDirectory() in more places 2025-05-23 11:39:53 +02:00
Ben Boeckel 557c44b93e cmStrCat: use character literals where possible
Found and replaced using the `cmstrcat-to-char-literal` rule for
`ast-grep`.
2025-05-15 19:12:04 +02:00
Ben Boeckel 23779057fd cmStrCat: combine neighboring arguments where possible
Found using the `cmstrcat-adjacent-literals` rule for `ast-grep`.
2025-05-15 19:11:41 +02:00
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
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
Ben Boeckel d4144b9c0a strings: use emplace_back with cmStrCat arguments 2023-07-27 20:15:51 -04:00
Brad King 3728f079af codespell: Avoid escape sequence that looks like misspelled "nodes" 2023-05-22 16:50:51 -04:00
Marc Chevrier e08ba229ee CMake code rely on cmList class for CMake lists management (part. 1) 2023-04-24 10:41:10 +02:00
Kyle Edwards 480b363724 cmCustomCommand: Refactor custom command-specific policy values
Many custom commands are created by CMake itself rather than by
the user. These custom commands should always have their policies
set to NEW, and user-created custom commands should have their
policy values set only from the state snapshot. In addition, we
want to genericize the mechanism of recording a policy at the time
of custom command creation.

Add a CM_FOR_EACH_CUSTOM_COMMAND_POLICY macro to genericize
custom command policies. Use this to define all custom command
policies. Make all such policies NEW instead of WARN by default.
Remove individual policy modifier methods and add a single method
that records relevant values from a cmStateSnapshot. Remove the
no longer needed explicit policy settings from synthesized custom
commands.
2023-02-06 15:04:16 -05:00
Vitaly Stakhovsky b3edfcf46e cmValue: Use operator* explicitly to convert to std::string; avoid extra call 2023-01-15 23:39:02 -05:00
Alex Turbov 6e3e8827fa Refactor: cmGlobalGeneratorFactory::GetDocumentation returns entry
Before, a documentation entry was in/out parameter.
Now it's a normal return value.

This also makes possible to eliminate defaulted default ctor
for `cmDocumentationEntry` for C++ 11.

Also, simplify `cmake::AppendGlobalGeneratorsDocumentation()`.
2022-11-17 16:37:13 +04:00
Fred Baksik 1de3382de5 GHS: Fix RERUN_CMAKE issue when generation step fails
Fixes: 23435
2022-04-16 07:54:46 -04:00
Fred Baksik 93c1acd8ff GHS: List predefined targets before user targets in GUI 2022-03-17 19:11:47 -04:00
Fred Baksik a645287784 GHS: update build command
* Remove unecessary logic for selecting gbuild
  -- CMake defaults to the Cache entry

* Support building multiple targets

* Fix error when ctest passes in a vector potentially containing
  an empty string.
  -- At minimum build the ALL_BUILD project, never just the Top Project.

* Add verbose support

* There can only be one top-level project per directory because the
  project() command can only be used once per directory. Multiple calls
  of project() only use the last invocation.
2022-03-17 19:11:44 -04:00
Fred Baksik 724b5491ef GHS: Rearrange project files in binary directory
The top level project and the target projects are all in the same
directory so they are easier to find and looks nicer in the GUI.

All of the ancillary project files are located in the target
subdirectory.
2022-03-17 19:11:44 -04:00
Fred Baksik edff0f6a1d GHS: Use Custom Target for ALL_BUILD
Use a Custom Target for ALL_BUILD instead of special code.

This also changes the name from <project>.ALL_BUILD.tgt to
ALL_BUILD.tgt.  The name change is part of standardizing the
CMakePredefinedTargets names.
2022-03-17 19:11:43 -04:00
Fred Baksik ad426aa697 GHS: Create RERUN_CMAKE Custom Target
Create a Custom Target that will re-run CMake on user demand if any of
the CMake input files have changed.
2022-03-17 19:11:42 -04:00
Fred Baksik 2f2e88900e GHS: Fix gbuild job control
gbuild command line is "-parallel[=n]".

Fixes: #23252
2022-03-17 16:56:51 -04:00
Carsten Rudolph 193b8fca52 cmBuildOptions: Split build arguments into separate object. 2022-01-22 06:35:38 -05:00
Fred Baksik aa59eaac4f GHS: Allow setting GHS variables from toolchain file
* Update generator to use the current variable definition,
  not the CACHE definition.
* Avoid overwriting toolchain variables and avoid developer warnings
  when setting up the GHS variables.
  -- A cache entry is only required when:
     a) The toolchain uses set( CACHE ) to set the variable
     b) A -D or preset value was used to set the variable

     The cache entry is required so that the TYPE gets set properly.

  -- Avoid the Policy CMP0126 warnings:
     setting cache variable when normal variable exists
* Move GHS_PRIMARY_TARGET back into area so non-GHS generator
  toolchain file can trigger the OS search.
2021-11-15 13:15:12 -05:00
Fred Baksik a55b5c4e18 GHS: Update BSP selection logic
Selection of a BSP only needs to be performed if not set by user.

Remove all the logic for printing error and status messages about BSP
selection. These messages also breaks CMake tests.

NOTE: If BSP selection fails then the compiler checks will result in
a build error.  The build error will report that the BSP does not exist.
2021-11-15 13:15:11 -05:00
Fred Baksik 0427f22539 GHS: Update RTOS selection logic
Selection of an RTOS only needs to be performed if not set by user.

Avoid CMake developer warnings for setting GHS_OS_DIR multiple times.
Instead only set it once after searching has been performed.

Remove all the logic for printing error and status messages about RTOS
selection.  This was broken and reporting incorrect messages.  These
messages also breaks CMake tests.

NOTE: If RTOS selection fails then the compiler checks will result in
a build error.  The build error will report that the RTOS
"GHS_OS_DIR-NOT-SPECIFIED" does not exist.
2021-11-15 13:15:11 -05:00
Fred Baksik 83eb5695e9 GHS: Update toolset selection logic
-- Ensure that GHS_TOOLSET_ROOT is used as a path
   * Converts directory path slashes to CMake style
-- Use ComparePath() to properly check for path changes of build tool
   * Accounts for Windows file-system case insensitivity.
-- Don't print message "defaulting" messages (this causes CMake test failures)
-- Don't force update CMAKE_GENERATOR_TOOLSET back into cache when `-T`
   is not used on initial configure. This change avoids an unnessary
   error message when accidentally using `-T` in subsequent runs but the same
   tools are always used.
-- Use IssueMessage() for error messages.
2021-11-15 13:15:10 -05:00
Fred Baksik 831607889f GHS: Update selection of primaryTarget in MULTI project file
Changes to ``-A`` handling:
* Don't force CMAKE_GENERATOR_PLATFORM into cache when using default
  value (breaks using CMake presets).
* Don't print message when using default value (breaks CMake tests).

Changes to ``GHS_PRIMARY_TARGET`` handling:
* Add as a cache variable so its known to GUI
* Don't always include``GHS_TARGET_PLATFORM``, it's only needed if
  ``GHS_PRIMARY_TARGET`` wasn't set by the user.
* Set ``GHS_PRIMARY_TARGET`` during platform selection instead of when
  a language is enabled.  By performing this sooner
  ``GHS_TARGET_PLATFORM`` is not always required to be set into cache.
2021-11-15 13:15:10 -05:00
Marc Chevrier cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Marc Chevrier e5cd39ca80 cmProp: refactoring: transform alias in class
To handle safely the values used by CMake variables and properties,
introduce the class cmProp as a replacement from the simple pointer
to std::string instance.
2021-08-08 16:19:08 +02:00
Brad King 09bee3bee1 cmGlobalGhsMultiGenerator: Simplify relative path conversion logic
Our call to `MaybeConvertToRelativePath` uses paths that always pass the
"maybe" checks.  Use `ForceToRelativePath` directly.
2021-05-12 15:53:26 -04:00
Ben Boeckel cdfc4e3195 clang-tidy: fix readability-qualified-auto warnings 2021-01-27 08:45:45 -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
Cengizhan Pasaoglu bd705788f6 Constify some code as suggested by clang-tidy 2020-10-20 00:04:04 +03:00
vvs31415 d298ae7470 cmake::GetCacheDefinition: Return cmProp 2020-09-28 09:32:22 -07:00
Vitaly Stakhovsky 11425041f0 cmMakefile::GetDefinition: return cmProp 2020-09-02 07:27:32 -04:00
Vitaly Stakhovsky f37c14e930 Source: use cmNonempty() 2020-07-28 08:31:31 -04:00
Brad King 422d9a0ab2 Factor out generator checks for filtering out interface libraries
Add a `cmGeneratorTarget::IsInBuildSystem` helper method to tell
generators whether a target should participate in the generated build
system.
2020-07-23 13:31:44 -04:00
Joerg Bornemann 2cdaf43d96 Allow generator expressions in the EXCLUDE_FROM_ALL target property
This allows for setting EXCLUDE_FROM_ALL, conditional on the build
configuration. However, only the Ninja Multi-Config generator supports
different property values per config. All other multi-config
generators will yield an error in that situation.

Fixes: #20923
2020-07-21 17:16:26 +02:00
Kyle Edwards 63ecf481da Merge topic 'cmnonempty'
eaad8072ee cmNonempty: Convenience inlines to check for non-empty string

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5017
2020-07-15 10:53:43 -04:00
Vitaly Stakhovsky eaad8072ee cmNonempty: Convenience inlines to check for non-empty string 2020-07-14 15:18:59 -04:00
Vitaly Stakhovsky 7156911242 cmIsOn: add overload accepting const std::string* 2020-07-14 08:22:24 -04:00
Vitaly Stakhovsky b36d1bdd9d Single location for cmProp typedef 2020-06-01 08:54:20 -04:00
Vitaly Stakhovsky 36aba01223 cmGeneratorTarget::GetProperty: return cmProp 2020-04-29 10:59:39 -04:00
Marc Chevrier aacd4e4a90 Refactoring: add cm::contains to <cmext/algorithm> 2020-04-17 10:00:03 +02:00
Alex Turbov 8e3a65d963 Refactor: Avoid std::endl where it's not necessary (part 3)
The `std::endl` manipulator, except inserting `\n` character, also
performs `os.flush()`, which may lead to undesired effects (like
disk I/O in the middle of forming data strings). For the
`std::stringstream` it also has no meaning.

* replace multiple `operator<<` calls on a string literal w/
  the only call and the only (bigger) string literal;
* replace one character string literal used in `operator<<`
  w/ a char literal.
2020-03-24 21:33:33 +08:00
Vitaly Stakhovsky 36a5b3d1d1 cmMakefile::AddCacheDefinition: Add overload that accepts std::string value 2020-03-11 09:40:43 -04:00
Vitaly Stakhovsky db17de2438 GHS: Use cm::erase in place of loop 2020-03-10 14:25:36 -04:00
Marc Chevrier 36c8cae2e8 cmLocalGenerator: modernize memory management 2019-12-10 00:24:06 +01:00