Commit Graph

249 Commits

Author SHA1 Message Date
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
Craig Scott
ca24b70d31 Export: Specify a policy range in exported files
This should reduce policy-related warnings coming from the
generated files, but in a way that doesn't increase the minimum
CMake version for consumers.

Relates: #20561
2020-05-19 08:36:57 +10:00
Vitaly Stakhovsky
36aba01223 cmGeneratorTarget::GetProperty: return cmProp 2020-04-29 10:59:39 -04:00
Alex Turbov
3fdd8db3aa Refactor: Avoid std::endl where it's not necessary (part 1)
The `std::endl` manupulator, except inserting `\n` character, also
performs `os.flush()`, which may leads to undesired effects (like
disk I/O in the middle of forming data strings). For the
`std::stringstream` it also has no meaning.
2020-03-26 11:36:57 +08:00
Brad King
d2e0b8bcfd Merge topic 'prop_t'
60f57d0dcc cmPropertyMap: Introduce cmProp as return type for GetProperty() functions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4471
2020-03-17 08:05:29 -04:00
Vitaly Stakhovsky
60f57d0dcc cmPropertyMap: Introduce cmProp as return type for GetProperty() functions
Currently properties are usually stored internally as `std::string`.
However, family of GetProperty() functions return them as `const char *` using `c_str()`.
The proposed `cmProp`, typedef'ed as `const std::string *` will expose properties
more naturally.
2020-03-13 13:32:17 -04:00
Alexandru Croitor
67a592583d Source: Remove trailing whitespace from export generation code 2020-03-13 15:31:38 +01:00
Vitaly Stakhovsky
bbc07e4561 Source: use std::string in place of const char* 2020-01-29 14:31:01 -05:00
Brad King
f0e67da061 target_link_libraries: Fix out-of-dir linking of a list of targets
In a case like

    target_link_libraries(targetInOtherDir PUBLIC "$<1:a;b>")

then all entries in the list need to be looked up in the caller's
scope.  Previously our `::@(directory-id)` suffix would apply only
to the last entry.  Instead surround the entire entry by a pair
`::@(directory-id);...;::@` so that the `::@` syntax can encode
a directory lookup scope change evaluated as the list is processed.

Fixes: #20204
2020-01-16 13:24:27 -05:00
Joseph Snyder
c621839bd9 Add set_property option: DEPRECATION
Add a new property flag for a target which contains a message regarding
deprecation status.

Add a warning at "Generate" time if a linked target is marked as
deprecated.

Expand ExportImport test to ensure that new property is being set and
passed correctly.  Ensure that the message is shown during the
"Generate" step run of the ExportImport test.
2020-01-02 17:11:31 -05:00
Brad King
0e436c573c install,export: Do not treat language names as target names
When generating `IMPORTED_LINK_INTERFACE_LANGUAGES`, do not treat the
entries as target names.

Fixes: #19846
2019-10-16 12:48:20 -04:00
Brad King
3ded5b6da8 install,export: Fix export of a genex following $<INSTALL_PREFIX>
The relative path check added by commit 5838aba1aa (Export: Report error
on relative include with genex., 2013-11-26, v3.0.0-rc1~285^2) was added
one condition too early.  If the value starts in `${_IMPORT_PREFIX}`
(which comes from `$<INSTALL_PREFIX>`) then it is an absolute path.

Fixes: #19791
2019-10-04 09:53:22 -04:00
Kitware Robot
ed98209ddc Revise include order using clang-format-6.0
Run the `clang-format.bash` script to update our C and C++ code to a new
include order `.clang-format`.  Use `clang-format` version 6.0.
2019-10-01 12:26:36 -04:00
Daniel Eiband
1811411fec cmGeneratorExpression: Move quiet flag to cmCompiledGeneratorExpression
The quiet flag is false for all but one call to Evaluate.  Make the quiet flag
a setter of cmCompiledGeneratorExpression to be able to remove it from the
Evaluate function signature.
2019-09-22 09:49:41 +02:00