cmTarget: add the INSTALL_OBJECT_NAME_STRATEGY property

This commit is contained in:
Ben Boeckel
2025-08-07 07:22:59 -04:00
parent 757c40c478
commit 29c7f19280
7 changed files with 40 additions and 0 deletions

View File

@@ -282,6 +282,7 @@ Properties on Targets
/prop_tgt/IMPORT_SUFFIX
/prop_tgt/INCLUDE_DIRECTORIES
/prop_tgt/INSTALL_NAME_DIR
/prop_tgt/INSTALL_OBJECT_NAME_STRATEGY
/prop_tgt/INSTALL_REMOVE_ENVIRONMENT_RPATH
/prop_tgt/INSTALL_RPATH
/prop_tgt/INSTALL_RPATH_USE_LINK_PATH

View File

@@ -489,6 +489,7 @@ Variables that Control the Build
/variable/CMAKE_INCLUDE_CURRENT_DIR
/variable/CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE
/variable/CMAKE_INSTALL_NAME_DIR
/variable/CMAKE_INSTALL_OBJECT_NAME_STRATEGY
/variable/CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH
/variable/CMAKE_INSTALL_RPATH
/variable/CMAKE_INSTALL_RPATH_USE_LINK_PATH

View File

@@ -0,0 +1,23 @@
INSTALL_OBJECT_NAME_STRATEGY
----------------------------
.. versionadded:: 4.2
``INSTALL_OBJECT_NAME_STRATEGY`` is a string target property variable
specifying the strategy to use when naming installed object files. The
supported values are:
- ``FULL``: Object files are named after the associated source file.
- ``SHORT``: Object files are named based on the hash of the source file name
to reduce path lengths.
When unset or the named strategy is not supported, the ``FULL`` strategy is
used.
This property is initialized by the value of the variable
:variable:`CMAKE_INSTALL_OBJECT_NAME_STRATEGY` if it is set when a target is
created.
.. note::
Not all generators support all strategies and paths may differ between
generators.

View File

@@ -0,0 +1,5 @@
install-object-name-strategy
----------------------------
* The :prop_tgt:`INSTALL_OBJECT_NAME_STRATEGY` target property has been added
to control the naming strategy for installed object files.

View File

@@ -0,0 +1,8 @@
CMAKE_INSTALL_OBJECT_NAME_STRATEGY
----------------------------------
Strategy to use for naming installed object files.
``CMAKE_INSTALL_OBJECT_NAME_STRATEGY`` is used to initialize the
:prop_tgt:`INSTALL_OBJECT_NAME_STRATEGY` property on all targets. See that
target property for more information.

View File

@@ -419,6 +419,7 @@ TargetProperty const StaticTargetProperties[] = {
{ "BUILD_WITH_INSTALL_NAME_DIR"_s, IC::CanCompileSources },
// ---- Install
{ "INSTALL_NAME_DIR"_s, IC::CanCompileSources },
{ "INSTALL_OBJECT_NAME_STRATEGY"_s, IC::CanCompileSources },
{ "INSTALL_REMOVE_ENVIRONMENT_RPATH"_s, IC::CanCompileSources },
{ "INSTALL_RPATH"_s, ""_s, IC::CanCompileSources },
{ "INSTALL_RPATH_USE_LINK_PATH"_s, "OFF"_s, IC::CanCompileSources },

View File

@@ -78,6 +78,7 @@ set(properties
"BUILD_WITH_INSTALL_NAME_DIR" "@rpath/" "<SAME>"
### Install
"INSTALL_NAME_DIR" "@rpath/" "<SAME>"
"INSTALL_OBJECT_NAME_STRATEGY" "SHORT" "<SAME>"
"INSTALL_REMOVE_ENVIRONMENT_RPATH" "ON" "<SAME>"
"INSTALL_RPATH" "@rpath/" "<SAME>"
"INSTALL_RPATH_USE_LINK_PATH" "ON" "<SAME>"