ALIASED_TARGET: Make property read-only

The ALIAS_GLOBAL property is read-only, so ALIASED_TARGET should be as
well. Even when set, there is no way to read the property value, so this
change gives an explicit error for users.
This commit is contained in:
Arha Gatram
2026-06-24 10:51:41 -07:00
parent a121419908
commit 3b327695aa
3 changed files with 7 additions and 1 deletions

View File

@@ -1,7 +1,10 @@
ALIASED_TARGET
--------------
Name of target aliased by this target.
Read-only property containing the name of target aliased by this target.
.. versionchanged:: 4.5
CMake 4.4 and earlier did not enforce the read-only nature of this property.
If this is an :ref:`Alias Target <Alias Targets>`, this property contains
the name of the target aliased.

View File

@@ -4,3 +4,5 @@ alias-transparency
* The :command:`set_property` and :command:`set_target_properties` commands
now accept :ref:`Alias Targets`. Properties are set on the target which
the alias references.
* The :prop_tgt:`ALIASED_TARGET` target property is now read-only.

View File

@@ -2116,6 +2116,7 @@ bool IsSettableProperty(cmMakefile* context, cmTarget* target,
{ "SYMBOLIC", { ROC::All } },
{ "TYPE", { ROC::All } },
{ "ALIAS_GLOBAL", { ROC::All, cmPolicies::CMP0160 } },
{ "ALIASED_TARGET", { ROC::All } },
{ "BINARY_DIR", { ROC::All, cmPolicies::CMP0160 } },
{ "CXX_MODULE_SETS", { ROC::All, cmPolicies::CMP0160 } },
{ "IMPORTED", { ROC::All, cmPolicies::CMP0160 } },