Commit Graph

625 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
9f6011e307 CMP0049: Remove support for OLD behavior 2025-01-19 09:41:03 -05:00
Brad King
ed99370f63 CMP0043: Remove support for OLD behavior
Note that per-source `COMPILE_DEFINITIONS_<CONFIG>` are not covered by
the policy, and are still supported.
2025-01-19 09:41:02 -05:00
Ben Boeckel
c66821b22b cmGeneratorTarget: add the concept of a "family" name
With synthetic targets, a name which is the same between all synthetic
targets which share a base target is warranted.
2024-08-27 11:30:23 -04:00
Vitaly Stakhovsky
61ce6a6eeb Source: Delete unused prototypes 2024-07-29 10:45:02 -04:00
Aditya Vidyadhar Kamath
d27fe9dfba AIX: Add option to archive shared libraries
Add option `CMAKE_AIX_SHARED_LIBRARY_ARCHIVE`.

There will no versions for the shared objects when this option is used.

Closes: #26033
2024-07-17 11:52:09 -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
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
Martin Duffy
ec2ba29ac5 Ninja: Allow compilation before generation of dependencies' private sources
This requires knowing when a generated header is public, which we can
model using file sets.  Add policy CMP0154 to treat generated sources
as private by default in targets with file sets.  Generated public
headers can be specified in public file sets.

Fixes: #24959
Issue: #15555
2023-09-20 10:25:24 -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
Craig Scott
84eae7aeda
OPTIMIZE_DEPENDENCIES: Skip order-only deps for non-linking targets
Fixes: #21517
2023-08-10 09:17:56 +10: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
f6435f799e Merge topic 'automoc-moc-options-test'
1f4b374d6e cmQtAutoGenInitializer: Reduce string copies
b6f66b445a cmQtAutoGenInitializer: Remove no-op calls
55d93bdabf cmQtAutoGenInitializer: Improve const correctness
feb56a666f cmTarget: Improve const correctness of AddUtility
5e513e562f Help: Add AUTOMOC_MOC_OPTIONS example
5380ad9d58 Tests: Add test for AUTOMOC_MOC_OPTIONS

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8523
2023-06-01 11:19:19 -04:00
Orkun Tokdemir
feb56a666f cmTarget: Improve const correctness of AddUtility 2023-05-31 13:01:29 -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
Marc Chevrier
aa5fed5052 SetProperty: suppress raw pointer usage 2023-05-26 14:48:22 +02:00
Marc Chevrier
ede33f30cf Apple: Handle generation and comsuption of text-based stubs (.tbd files)
Fixes: #24123
2023-03-01 12:23:28 +01:00
Marc Chevrier
fcbd723a50 Enhance support functions
* Avoid duplicate definiitions for IsExecutableWithExports, etc...
* Add helper IsApple()
2023-02-28 14:24:03 +01:00
Ben Boeckel
c97de1047f cmMakefile: add support for a "synthesized" target
It is a normal target, but will end up copying its internals from
another target. Keep track of this state so that such copying can only
occur when intended.
2023-02-14 12:33:58 -05:00
Ben Boeckel
1d0426f642 cmTarget: make Visibility an enum class 2023-02-14 12:28:58 -05:00
Ben Boeckel
5b58695321 cmTarget: store visibility as an enum rather than bools
C++ modules are going to introduce a third concept of "synthesized"
targets, so update logic where needed to avoid assuming "not imported?
must be normal".

Also add an accessor method to perform queries against the visibility.
2023-02-14 12:23:15 -05:00
Brad King
06404a1979 Merge topic 'check-library-properties-fix-performances-regression'
985b4c82a6 Check link libraries properties: fix performances regression
a47eef32a3 renames method FinalizeTargetCompileInfo() in FinalizeTargetConfiguration().

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7651
2022-09-09 09:48:56 -04:00
Marc Chevrier
a47eef32a3 renames method FinalizeTargetCompileInfo() in FinalizeTargetConfiguration(). 2022-09-07 14:23:21 +02:00
Brad King
52c95540b7 target_*: Fix cross-directory call backtraces
Record the call-site backtrace, not the current backtrace of the
target's directory.

Fixes: #23873
2022-08-22 15:29:43 -04:00
Brad King
d9cca8e83d Merge topic 'verify-interface-header-sets-add-compile-definitions'
27fd172d8d VERIFY_INTERFACE_HEADER_SETS: Finalize compile info for verify targets
626e641a19 cmTarget: Factor out FinalizeTargetCompileInfo()

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7516
2022-07-28 08:11:19 -04:00
Kyle Edwards
626e641a19 cmTarget: Factor out FinalizeTargetCompileInfo() 2022-07-27 12:24:53 -04:00
Ben Boeckel
386465bf83 cmTarget: add support for C++ module fileset types
C++ modules have two variants which are of importance to CMake:

  - `CXX_MODULES`: interface modules (those using `export module M;`,
    `export module M:part;`, or `module M:internal_part;`)
  - `CXX_MODULE_HEADER_UNITS`: importable header units

Creating C++ modules or partitions are *not* supported in any other
source listing. This is because the source files must be installed (so
their scope matters), but not part of usage requirements (what it means
for a module source to be injected into a consumer is not clear at this
moment). Due to the way `FILE_SET` works with scopes, they are a perfect
fit as long as `INTERFACE` is not allowed (which it is not).
2022-06-16 10:28:34 -04:00
Ben Boeckel
aaa18f15cf cmTarget: add support for querying all file set names 2022-04-27 15:04:01 -04:00
Brad King
f011557f0e Merge topic 'xcode-universal'
40dd46a96a Xcode: Add tests for OBJECT library per target `OSX_ARCHITECTURES`
da4ccb502b Xcode: Check for multiple `OSX_ARCHITECTURES` on target
41ba35a42b cmTarget: Add `HasKnownObjectFileLocation()` shorthand

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7154
2022-04-14 09:30:29 -04:00
Brad King
f6476ba3a6 Merge topic 'file-set-repr-improvements'
5fa15ec9f3 Help: Document that target_sources defines [INTERFACE_]HEADER_SETS
c5d4812f20 cmTarget: make HEADER_SETS and INTERFACE_HEADER_SETS read-only
05783b168d cmFileSet: store visibility with the fileset

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7168
2022-04-12 10:05:26 -04:00
Hyper Nova Sun
41ba35a42b cmTarget: Add HasKnownObjectFileLocation() shorthand
Allow `cmGlobalGenerator`s to decide `HasKnownObjectFileLocation()` per given
`cmTarget`

- `cmGlobalGenerator::HasKnownObjectFileLocation()` now takes an optional `cmGeneratorTarget`
- `cmTarget::HasKnownObjectFileLocation()` added as a shorthand
2022-04-11 14:10:29 -07:00
Ben Boeckel
05783b168d cmFileSet: store visibility with the fileset
The visibility is intrinsic to the fileset, so store it with it. This
avoids recalculating it on every addition to the fileset.
2022-04-11 13:41:40 -04:00
Brad King
687a91967f Revert INTERFACE_LINK_LIBRARIES_DIRECT feature for 3.23 branch
Revert commit f3ad061858 (Add usage requirements to update direct link
dependencies, 2022-01-12, v3.23.0-rc1~44^2) and the property storage
updates in its predecessor commit 193a999cd5 (cmTarget: Add
INTERFACE_LINK_LIBRARIES_DIRECT{,_EXCLUDE} backtrace storage,
2022-01-06, v3.23.0-rc1~44^2~1) from the 3.23 release branch.

After initial experience using the feature in practice, additional
design considerations have been raised for discussion in the original
issue.  To avoid rushing this for the 3.23 series, we've decided to
revert the feature for now so it can be revised for a future release.

Issue: #22496
2022-03-21 13:17:32 -04:00
Brad King
069d836dab Merge topic 'restore-target-export-includes'
83d79636bf install(TARGETS): Restore per-export INCLUDES DESTINATION

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6969
2022-02-10 09:07:35 -05:00
Brad King
5a65e08644 Merge topic 'restore-target-export-includes' into release-3.23
83d79636bf install(TARGETS): Restore per-export INCLUDES DESTINATION

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6969
2022-02-10 09:07:34 -05:00
Eugene Shalygin
83d79636bf install(TARGETS): Restore per-export INCLUDES DESTINATION
In commit 55e4753bbb (Refactor cmTargetExport removing
InterfaceIncludeDirecories, 2021-07-20, v3.22.0-rc1~337^2~1) the storage
of `INCLUDES DESTINATION` was moved into each target.  However, a target
may be installed in multiple exports, and their `INCLUDES DESTINATION`
should not be mixed.

Convert the IncludeDirectoriesEntries vector to a map and modify access
function to store the directories lists with respect to cmExportTarget
object. This fixes error when the same target is exported more than once
via different exports and each for consequent export its include
directories list grows. Add a test for this case.

Fixes: #23183
2022-02-09 13:31:26 -05:00
Brad King
193a999cd5 cmTarget: Add INTERFACE_LINK_LIBRARIES_DIRECT{,_EXCLUDE} backtrace storage
These properties will be given meaning by later commits.
2022-01-29 06:48:12 -05:00
Brad King
a84a62e0a7 cmTarget: Record backtraces for INTERFACE_LINK_LIBRARIES 2021-12-15 12:29:44 -05:00
Brad King
c749982c13 cmTargetPropertyComputer: Simplify by restoring use of cmMakefile
Logically revert commit 390a7d8647 (cmTargetPropertyComputer: Implement
GetProperty without cmMakefile, 2016-10-13, v3.8.0-rc1~445^2~9).
It relied on using `cmListFileBacktrace` to get a scope in which to
look up policies.

This does remove a backtrace from `LOCATION` property errors at generate
time, but the backtrace we reported before was incorrect.  It pointed at
the addition of a target, not to the reference to the property.
2021-12-08 10:03:48 -05:00
Kyle Edwards
f2a44a8afa cmTarget: Add cmFileSet and associated properties 2021-10-27 15:17:23 -04:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Kyle Edwards
ab94c369c9 Refactor: Convert parallel string/backtrace vectors to BT vectors 2021-09-03 09:52:14 -04:00
Marc Chevrier
6dfa581bab Enhancement: SetProperty accept cmProp or std::string
Methods SetProperty of classes cmPropertyMap, cmStateDirectory
and cmMakefile accept now cmProp or std::string as argument.
2021-08-25 10:09:02 +02:00
Eugene Shalygin
55e4753bbb Refactor cmTargetExport removing InterfaceIncludeDirecories
Because of this property in the cmTargetExport struct, exporting targets
is not uniform: top-level ones have to be dealt with via the
cmTargetExport objects, while all linked ones are cmGeneratorTarget
objects. Let's pass this additional includedirectories via a special
target property making handling exported targets uniform.
2021-07-22 13:08:58 +02:00
Ben Boeckel
b3b6ede6a1 clang-tidy: fix readability-redundant-access-specifiers 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
Brad King
3e36d5e846 cmGeneratorTarget: Refactor custom command dependency evaluation
Previously we only used cmCustomCommandGenerator to evaluate generator
expressions for dependencies.  Use it for command lines too.  It also
collects target references for us, with backtraces.
2020-10-29 09:37:44 -04:00