Commit Graph

262 Commits

Author SHA1 Message Date
Ben Boeckel
249cd3efad cmExportFileGenerator: export private compile info for C++ modules
When consuming exported targets which contain C++ modules, the consuming
project must be able to recompile BMI files using the original target's
flags. This is because a module source may use some private target usage
requirement but not want to propagate it to consumers. To facilitate
this, export the private information as necessary for consumers to be
able to perform the BMI compilations.
2023-08-17 14:42:53 -04:00
Ben Boeckel
e166bbef7b cmComputeLinkInformation: prepare Item consumers for OBJECT libraries
After b665966933 (cmComputeLinkInformation: track `OBJECT` library
dependencies, 2023-07-22), introduced in !8645 as a fix for #25112,
`OBJECT` libraries were tracked in a separate member to reduce the risk
of further regressions. This commit prepares consumers to handle
`OBJECT` libraries once they start appearing as link items.
2023-08-01 10:06:02 -04:00
Marc Chevrier
45f17e5a85 cmList: Add container conversion to string 2023-06-22 15:44:17 +02:00
Brad King
ee80960f78 export: Increase maximum policy version in exported files to 3.26
The files generatd by `install(EXPORT)` and `export()` commands
are known to work with policies as of CMake 3.26, so enable them
in sufficiently new CMake versions.
2023-06-07 14:32:03 -04:00
Brad King
5924630e6d Merge topic 'compile-only-genex'
c42630ee62 cmGeneratorExpressionNode: implement `COMPILE_ONLY` genex
0fb923c460 cmGeneratorExpressionNode: implement `COMPILE_ONLY` genex

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8411
2023-05-05 12:42:23 -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
Ben Boeckel
0fb923c460 cmGeneratorExpressionNode: implement COMPILE_ONLY genex
This generator expression is the inverse of `LINK_ONLY` and only coveys
usage requirements for the purposes of compilation. Its intended use is
to avoid needing to export targets that do not have link usage
requirements (e.g., header-only libraries) when used by another target.

It will also be used to represent private usage requirements on exported
C++ module-containing targets in the future.

Eventually there should be logic to collapse nesting of
`$<COMPILE_ONLY>` and `$<LINK_ONLY>` when generating instances of
either. A TODO is left in the code for this case.

See: #15415
2023-04-12 10:43:48 -04:00
Kyle Edwards
42e5be8cef install(EXPORT): Fall back to set_property(APPEND) for FILE_SET
FILE_SET was introduced in CMake 3.23, so install(EXPORT) puts it
behind a version gate. However, this results in the include directories
not being picked up by older versions of CMake. Fall back to
set_property(APPEND) for versions of CMake older than 3.23.

Fixes: #24787
2023-04-12 09:33:24 -04: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
Brad King
4feea27761 export: Increase maximum policy version in exported files to 3.25
The files generatd by `install(EXPORT)` and `export()` commands
are known to work with policies as of CMake 3.25, so enable them
in sufficiently new CMake versions.
2023-02-01 17:01:38 -05:00
Kyle Edwards
830eed374d CMake: fix sizeof string literal violations 2022-11-18 09:37:58 -05:00
Kyle Edwards
09d7f947d6 cmGeneratorExpression: Require cmake instance 2022-11-11 12:29:41 -05:00
Brad King
6bd18eed8e export: Increase maximum policy version in exported files to 3.24
The files generatd by `install(EXPORT)` and `export()` commands
are known to work with policies as of CMake 3.24, so enable them
in sufficiently new CMake versions.
2022-10-12 12:41:25 -04:00
Brad King
ea73a8ea38 Merge topic 'export-no-shdeps'
0ebff0d61a export: Restore exclusion of private shared library dependencies from checks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7557
2022-08-16 12:42:21 -04:00
Brad King
0ebff0d61a export: Restore exclusion of private shared library dependencies from checks
Refactoring in commit 8c65b7042e (cmExportFileGenerator: Simplify
collection of targets missing from export set, 2022-04-11,
v3.24.0-rc1~281^2) accidentally dropped the behavior change from
commit 0ad2a1c181 (Export: Never treat private link libraries as
public package dependencies., 2013-09-24, v3.0.0-rc1~559^2).
Restore the behavior and add a test.

Fixes: #23838
2022-08-15 10:40:03 -04:00
Ben Boeckel
3526b8c123 cmExport*FileGenerator: support exporting C++ module properties
C++ module properties will be generated at build time, so generate code
that includes the files actually responsible for the information.
2022-07-06 10:15:23 -04:00
Da Quexian
9680b3b279 Add EXPORT_NO_SYSTEM target property, deprecate IMPORTED_NO_SYSTEM
Issue: #18040

Signed-off-by: Da Quexian <daquexian566@gmail.com>
2022-06-17 22:38:07 +08:00
Brad King
25b1312a6d export: Increase maximum policy version in exported files to 3.23
The files generatd by `install(EXPORT)` and `export()` commands
are known to work with policies as of CMake 3.23, so enable them
in sufficiently new CMake versions.
2022-06-14 15:05:09 -04:00
Ben Boeckel
a1a7f62918 generated-scripts: improve prose messages with CMake lists
Instead of printing a CMake list, make it an English-style list. This
also allows the line-break algorithm to make these messages much more
readable.
2022-04-20 15:36:21 -04:00
Ben Boeckel
c2194176db generated-scripts: unset used variables 2022-04-20 15:36:20 -04:00
Ben Boeckel
233997a914 generated-scripts: use foreach(IN LISTS) 2022-04-20 15:34:28 -04:00
Ben Boeckel
2ec44be41e generated-scripts: quote variable expansions 2022-04-20 15:34:06 -04:00
Ben Boeckel
d74761b181 generated-scripts: simplify if conditions 2022-04-20 15:33:34 -04:00
Ben Boeckel
59cc92085e generated-cmake: use _cmake_ prefixes for local variables
This avoids stomping on any user variables.
2022-04-20 15:33:06 -04:00
Ben Boeckel
a2cb1754a5 cmExportFileGenerator: require CMake 2.8.3
This allows use of `CMAKE_CURRENT_LIST_DIR`, `foreach(IN LISTS)`,
`if(VERSION_*)`, and more.

Note that generated filesets code already uses `if(VERSION_*)` and
requires CMake 2.8.3 in practice.
2022-04-20 14:09:46 -04:00
Brad King
8c65b7042e cmExportFileGenerator: Simplify collection of targets missing from export set
Store the list of missing target names in a member instead of threading
an explicit reference to it through the call stack.
2022-04-11 13:40:13 -04:00
Brad King
6d34cc3cb8 export: Fix TARGET_NAME lookup for out-of-dir linking
Improve the logic added by commit f0e67da061 (target_link_libraries: Fix
out-of-dir linking of a list of targets, 2020-01-14, v3.17.0-rc1~149^2)
to, while exporting targets, look up referenced target names in the
correct directory.
2022-04-01 13:59:51 -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
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
f84dcbd496 Merge topic 'post-rel-dev'
9a48012f93 Configure CMake itself with policies through CMake 3.22
a5a9687799 export: Increase maximum policy version in exported files to 3.22
a9ffded98c Add deprecation warnings for policies CMP0097 and below

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6948
2022-02-04 08:24:26 -05:00
Brad King
d184bf0659 Replace DEVEL_CMAKE_VERSION with literal 3.23 release version
This was accidentally left out of commit 736663deed (Begin 3.23 release
versioning, 2022-02-03).  The step is documented as part of the release
branching process in the CMake Maintainer Guide `Help/dev/maint.rst`.
2022-02-04 06:44:22 -05:00
Brad King
a5a9687799 export: Increase maximum policy version in exported files to 3.22
The files generatd by `install(EXPORT)` and `export()` commands
are known to work with policies as of CMake 3.22, so enable them
in sufficiently new CMake versions.
2022-02-03 14:13:12 -05:00
Brad King
f3ad061858 Add usage requirements to update direct link dependencies
Link line construction starts with `LINK_LIBRARIES` and appends
dependencies from the transitive closure of `INTERFACE_LINK_LIBRARIES`.
Only the entries of `LINK_LIBRARIES` are considered direct link
dependencies.  In some advanced use cases, particularly involving static
libraries and static plugins, usage requirements need to update the list
of direct link dependencies.  This may mean adding new items, removing
existing items, or both.

Add target properties to encode these usage requirements:

* INTERFACE_LINK_LIBRARIES_DIRECT
* INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE

Fixes: #22496
2022-01-29 06:48:13 -05:00
Kyle Edwards
2a78d47b16 install(EXPORT): Install file sets 2021-10-27 15:17:23 -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
14d98bcfe6 export: Propagate IMPORTED_NO_SYSTEM target property to consumers
Enabling `IMPORTED_NO_SYSTEM` on a target built within the project has
no effect on the build system, but it is still a useful way to set the
property on imported targets generated by `install(EXPORT)` and
`export()`.

Issue: #17364
2021-10-15 13:04:19 -04:00
Brad King
b3248c083f export: Increase maximum policy version in exported files to 3.21
The files generatd by `install(EXPORT)` and `export()` commands
are known to work with policies as of CMake 3.21, so enable them
in sufficiently new CMake versions.
2021-10-08 12:17:04 -04:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Marcus Müller
35e38ef97a Config File Gen: When requiring >= 2.6, don't check < 2.5
This seems to be a clear-cut case.

Signed-off-by: Marcus Müller <marcus@hostalia.de>
2021-08-16 20:24:03 +02:00
Eugene Shalygin
e8e19ed8f2 Refactor export file generator inteface
Replace cmTargetExport with const cmGeneratorTarget to allow recursive
processing of exported targets and their link dependencies.
2021-07-22 13:08:58 +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
Brad King
83a3db5631 export: Increase maximum policy version in exported files to 3.20
The files generatd by `install(EXPORT)` and `export()` commands
are known to work with policies as of CMake 3.20, so enable them
in sufficiently new CMake versions.
2021-06-30 10:13:56 -04:00
Vitaly Stakhovsky
ce97b7909b Source: Remove unnecessary comparisons to nullptr 2021-05-10 11:44:53 -04:00
Brad King
141dbf2c19 export: Increase maximum policy version in exported files to 3.19
The files generatd by `install(EXPORT)` and `export()` commands
are known to work with policies as of CMake 3.19, so enable them
in sufficiently new CMake versions.
2021-02-10 09:26:04 -05:00
Ben Boeckel
cdfc4e3195 clang-tidy: fix readability-qualified-auto warnings 2021-01-27 08:45:45 -05:00
Brad King
06f921d9f6 export: Fix replacement of multiple TARGET_NAME expressions
After replacing each such expression, search for following expressions
immediately after the end of the replacement text, not after the
position of the end of the replaced text.

Fixes: #21661
2021-01-05 08:44:19 -05:00
Brad King
3eaf053940 export: Increase maximum policy version in exported files to 3.18
The files generatd by `install(EXPORT)` and `export()` commands
are known to work with policies as of CMake 3.18, so enable them
in sufficiently new CMake versions.
2020-10-13 14:37:47 -04:00
Deniz Bahadir
bf114602da install(EXPORT): Fix exporting target w/ source named using CONFIG genex
Fixes: #21203
2020-09-22 07:35:02 -04:00
Robert Maynard
7a969fe21d cmMakefile: Refactor API to better handle empty config values 2020-07-03 07:43:18 -04:00
Vitaly Stakhovsky
b36d1bdd9d Single location for cmProp typedef 2020-06-01 08:54:20 -04:00