Merge topic 'target_link_libraries-self-link-is-an-error'

9436ad35df target_link_libraries: self-link through ALIAS is an error

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4826
This commit is contained in:
Brad King
2020-06-02 11:53:34 +00:00
committed by Kitware Robot
12 changed files with 62 additions and 1 deletions

View File

@@ -57,6 +57,7 @@ Policies Introduced by CMake 3.18
.. toctree::
:maxdepth: 1
CMP0108: A target cannot link to itself through an alias. </policy/CMP0108>
CMP0107: An ALIAS target cannot overwrite another target. </policy/CMP0107>
CMP0106: The Documentation module is removed. </policy/CMP0106>
CMP0105: Device link step uses the link options. </policy/CMP0105>

19
Help/policy/CMP0108.rst Normal file
View File

@@ -0,0 +1,19 @@
CMP0108
-------
A target is not allowed to link to itself even through an ``ALIAS`` target.
In CMake 3.17 and below, a target can link to a target aliased to itself.
The ``OLD`` behavior for this policy is to allow a target to link to a target
aliased to itself.
The ``NEW`` behavior of this policy is to prevent a target to link to itself
through an ``ALIAS`` target.
This policy was introduced in CMake version 3.17. Use the
:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
Unlike many policies, CMake version |release| does *not* warn
when this policy is not set and simply uses ``OLD`` behavior.
.. include:: DEPRECATED.txt

View File

@@ -0,0 +1,5 @@
self-link-through-alias
-----------------------
* Linking a target to itself through an alias now raise an error.
See policy :policy:`CMP0108`.