diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-08-13 18:16:18 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-08-13 18:16:25 (GMT) |
commit | 8b5aa9051b0df7bead47deb25d8cfa33679f747d (patch) | |
tree | 39d8bee86aec32930c93ccfc725414261fcc84d8 /Help | |
parent | 5748e76639822bf330986b0b77da6fd70f3de301 (diff) | |
parent | 2e42651dff43c4e962f03fc24281cbf446880ded (diff) | |
download | CMake-8b5aa9051b0df7bead47deb25d8cfa33679f747d.zip CMake-8b5aa9051b0df7bead47deb25d8cfa33679f747d.tar.gz CMake-8b5aa9051b0df7bead47deb25d8cfa33679f747d.tar.bz2 |
Merge topic 'optimize-static-library-deps'
2e42651dff Add option to optimize link dependencies for static libraries
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5103
Diffstat (limited to 'Help')
-rw-r--r-- | Help/manual/cmake-properties.7.rst | 1 | ||||
-rw-r--r-- | Help/manual/cmake-variables.7.rst | 1 | ||||
-rw-r--r-- | Help/prop_tgt/OPTIMIZE_DEPENDENCIES.rst | 38 | ||||
-rw-r--r-- | Help/release/dev/optimize-link-dependencies.rst | 7 | ||||
-rw-r--r-- | Help/variable/CMAKE_OPTIMIZE_DEPENDENCIES.rst | 4 |
5 files changed, 51 insertions, 0 deletions
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 30b2a05..afdf78c 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -307,6 +307,7 @@ Properties on Targets /prop_tgt/OBJCXX_EXTENSIONS /prop_tgt/OBJCXX_STANDARD /prop_tgt/OBJCXX_STANDARD_REQUIRED + /prop_tgt/OPTIMIZE_DEPENDENCIES /prop_tgt/OSX_ARCHITECTURES_CONFIG /prop_tgt/OSX_ARCHITECTURES /prop_tgt/OUTPUT_NAME_CONFIG diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index d780a65..4b40917 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -437,6 +437,7 @@ Variables that Control the Build /variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX /variable/CMAKE_NO_BUILTIN_CHRPATH /variable/CMAKE_NO_SYSTEM_FROM_IMPORTED + /variable/CMAKE_OPTIMIZE_DEPENDENCIES /variable/CMAKE_OSX_ARCHITECTURES /variable/CMAKE_OSX_DEPLOYMENT_TARGET /variable/CMAKE_OSX_SYSROOT diff --git a/Help/prop_tgt/OPTIMIZE_DEPENDENCIES.rst b/Help/prop_tgt/OPTIMIZE_DEPENDENCIES.rst new file mode 100644 index 0000000..533cf6a --- /dev/null +++ b/Help/prop_tgt/OPTIMIZE_DEPENDENCIES.rst @@ -0,0 +1,38 @@ +OPTIMIZE_DEPENDENCIES +--------------------- + +Activates dependency optimization of static and object libraries. + +When this property is set to true, some dependencies for a static or object +library may be removed at generation time if they are not necessary to build +the library, since static and object libraries don't actually link against +anything. + +If a static or object library has dependency optimization enabled, it first +discards all dependencies. Then, it looks through all of the direct and +indirect dependencies that it initially had, and adds them back if they meet +any of the following criteria: + +* The dependency was added to the library by :command:`add_dependencies`. +* The dependency was added to the library through a source file in the library + generated by a custom command that uses the dependency. +* The dependency has any ``PRE_BUILD``, ``PRE_LINK``, or ``POST_BUILD`` custom + commands associated with it. +* The dependency contains any source files that were generated by a custom + command. +* The dependency contains any languages which produce side effects that are + relevant to the library. Currently, all languages except C, C++, Objective-C, + Objective-C++, assembly, and CUDA are assumed to produce side effects. + However, side effects from one language are assumed not to be relevant to + another (for example, a Fortran library is assumed to not have any side + effects that are relevant for a Swift library.) + +As an example, assume you have a static Fortran library which depends on a +static C library, which in turn depends on a static Fortran library. The +top-level Fortran library has optimization enabled, but the middle C library +does not. If you build the top Fortran library, the bottom Fortran library will +also build, but not the middle C library, since the C library does not have any +side effects that are relevant for the Fortran library. However, if you build +the middle C library, the bottom Fortran library will also build, even though +it does not have any side effects that are relevant to the C library, since the +C library does not have optimization enabled. diff --git a/Help/release/dev/optimize-link-dependencies.rst b/Help/release/dev/optimize-link-dependencies.rst new file mode 100644 index 0000000..cfda826 --- /dev/null +++ b/Help/release/dev/optimize-link-dependencies.rst @@ -0,0 +1,7 @@ +optimize-link-dependencies +-------------------------- + +* A new target property, :prop_tgt:`OPTIMIZE_DEPENDENCIES`, was added to + avoid unnecessarily building dependencies for a static library. +* A new variable, :variable:`CMAKE_OPTIMIZE_DEPENDENCIES`, was added to + initialize the :prop_tgt:`OPTIMIZE_DEPENDENCIES` target property. diff --git a/Help/variable/CMAKE_OPTIMIZE_DEPENDENCIES.rst b/Help/variable/CMAKE_OPTIMIZE_DEPENDENCIES.rst new file mode 100644 index 0000000..eed352a --- /dev/null +++ b/Help/variable/CMAKE_OPTIMIZE_DEPENDENCIES.rst @@ -0,0 +1,4 @@ +CMAKE_OPTIMIZE_DEPENDENCIES +--------------------------- + +Initializes the :prop_tgt:`OPTIMIZE_DEPENDENCIES` target property. |