Explorar o código

cmTarget: add the `INSTALL_OBJECT_NAME_STRATEGY` property

Ben Boeckel hai 3 meses
pai
achega
29c7f19280

+ 1 - 0
Help/manual/cmake-properties.7.rst

@@ -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

+ 1 - 0
Help/manual/cmake-variables.7.rst

@@ -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

+ 23 - 0
Help/prop_tgt/INSTALL_OBJECT_NAME_STRATEGY.rst

@@ -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.

+ 5 - 0
Help/release/dev/install-object-name-strategy.rst

@@ -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.

+ 8 - 0
Help/variable/CMAKE_INSTALL_OBJECT_NAME_STRATEGY.rst

@@ -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.

+ 1 - 0
Source/cmTarget.cxx

@@ -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 },

+ 1 - 0
Tests/RunCMake/property_init/CompileSources.cmake

@@ -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>"