summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-07-31 15:22:28 (GMT)
committerBrad King <brad.king@kitware.com>2020-07-31 15:22:28 (GMT)
commit716e76be3e3fa8a646fd1d5fc2240aecd91365d8 (patch)
treea6bfa1700f1fcd09111854f100bdc25b75baf91d /Help
parent1b0adeea819e82d19da190c47bab06e1f355cf8f (diff)
downloadCMake-716e76be3e3fa8a646fd1d5fc2240aecd91365d8.zip
CMake-716e76be3e3fa8a646fd1d5fc2240aecd91365d8.tar.gz
CMake-716e76be3e3fa8a646fd1d5fc2240aecd91365d8.tar.bz2
Help: Re-order add_library sections
Put all the sections that create in-project targets first, and move Imported Libraries and Alias Libraries at the end.
Diffstat (limited to 'Help')
-rw-r--r--Help/command/add_library.rst122
1 files changed, 61 insertions, 61 deletions
diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst
index 01c415a..232d0a9 100644
--- a/Help/command/add_library.rst
+++ b/Help/command/add_library.rst
@@ -64,42 +64,6 @@ See also :prop_sf:`HEADER_FILE_ONLY` on what to do if some sources are
pre-processed, and you want to have the original sources reachable from
within IDE.
-Imported Libraries
-^^^^^^^^^^^^^^^^^^
-
-.. code-block:: cmake
-
- add_library(<name> <SHARED|STATIC|MODULE|OBJECT|UNKNOWN> IMPORTED
- [GLOBAL])
-
-An :ref:`IMPORTED library target <Imported Targets>` references a library
-file located outside the project. No rules are generated to build it, and
-the :prop_tgt:`IMPORTED` target property is ``True``. The target name has
-scope in the directory in which it is created and below, but the ``GLOBAL``
-option extends visibility. It may be referenced like any target built
-within the project. ``IMPORTED`` libraries are useful for convenient
-reference from commands like :command:`target_link_libraries`. Details
-about the imported library are specified by setting properties whose names
-begin in ``IMPORTED_`` and ``INTERFACE_``.
-
-The most important properties are:
-
-* :prop_tgt:`IMPORTED_LOCATION` (and its per-configuration
- variant :prop_tgt:`IMPORTED_LOCATION_<CONFIG>`) which specifies the
- location of the main library file on disk.
-* :prop_tgt:`IMPORTED_OBJECTS` (and :prop_tgt:`IMPORTED_OBJECTS_<CONFIG>`)
- for object libraries, specifies the locations of object files on disk.
-* :prop_tgt:`PUBLIC_HEADER` files to be installed during :command:`install` invocation
-
-See documentation of the ``IMPORTED_*`` and ``INTERFACE_*`` properties
-for more information.
-
-An ``UNKNOWN`` library type is typically only used in the implementation of
-:ref:`Find Modules`. It allows the path to an imported library (often found
-using the :command:`find_library` command) to be used without having to know
-what type of library it is. This is especially useful on Windows where a
-static library and a DLL's import library both have the same file extension.
-
Object Libraries
^^^^^^^^^^^^^^^^
@@ -129,31 +93,6 @@ systems (such as Xcode) may not like targets that have only object files, so
consider adding at least one real source file to any target that references
``$<TARGET_OBJECTS:objlib>``.
-Alias Libraries
-^^^^^^^^^^^^^^^
-
-.. code-block:: cmake
-
- add_library(<name> ALIAS <target>)
-
-Creates an :ref:`Alias Target <Alias Targets>`, such that ``<name>`` can be
-used to refer to ``<target>`` in subsequent commands. The ``<name>`` does
-not appear in the generated buildsystem as a make target. The ``<target>``
-may not be an ``ALIAS``.
-
-An ``ALIAS`` to a non-``GLOBAL`` :ref:`Imported Target <Imported Targets>`
-has scope in the directory in which the alias is created and below.
-The :prop_tgt:`ALIAS_GLOBAL` target property can be used to check if the
-alias is global or not.
-
-``ALIAS`` targets can be used as linkable targets and as targets to
-read properties from. They can also be tested for existence with the
-regular :command:`if(TARGET)` subcommand. The ``<name>`` may not be used
-to modify properties of ``<target>``, that is, it may not be used as the
-operand of :command:`set_property`, :command:`set_target_properties`,
-:command:`target_link_libraries` etc. An ``ALIAS`` target may not be
-installed or exported.
-
Interface Libraries
^^^^^^^^^^^^^^^^^^^
@@ -185,3 +124,64 @@ directory in which it is created and below, but the ``GLOBAL`` option
extends visibility. It may be referenced like any target built within
the project. ``IMPORTED`` libraries are useful for convenient reference
from commands like :command:`target_link_libraries`.
+
+Imported Libraries
+^^^^^^^^^^^^^^^^^^
+
+.. code-block:: cmake
+
+ add_library(<name> <SHARED|STATIC|MODULE|OBJECT|UNKNOWN> IMPORTED
+ [GLOBAL])
+
+An :ref:`IMPORTED library target <Imported Targets>` references a library
+file located outside the project. No rules are generated to build it, and
+the :prop_tgt:`IMPORTED` target property is ``True``. The target name has
+scope in the directory in which it is created and below, but the ``GLOBAL``
+option extends visibility. It may be referenced like any target built
+within the project. ``IMPORTED`` libraries are useful for convenient
+reference from commands like :command:`target_link_libraries`. Details
+about the imported library are specified by setting properties whose names
+begin in ``IMPORTED_`` and ``INTERFACE_``.
+
+The most important properties are:
+
+* :prop_tgt:`IMPORTED_LOCATION` (and its per-configuration
+ variant :prop_tgt:`IMPORTED_LOCATION_<CONFIG>`) which specifies the
+ location of the main library file on disk.
+* :prop_tgt:`IMPORTED_OBJECTS` (and :prop_tgt:`IMPORTED_OBJECTS_<CONFIG>`)
+ for object libraries, specifies the locations of object files on disk.
+* :prop_tgt:`PUBLIC_HEADER` files to be installed during :command:`install` invocation
+
+See documentation of the ``IMPORTED_*`` and ``INTERFACE_*`` properties
+for more information.
+
+An ``UNKNOWN`` library type is typically only used in the implementation of
+:ref:`Find Modules`. It allows the path to an imported library (often found
+using the :command:`find_library` command) to be used without having to know
+what type of library it is. This is especially useful on Windows where a
+static library and a DLL's import library both have the same file extension.
+
+Alias Libraries
+^^^^^^^^^^^^^^^
+
+.. code-block:: cmake
+
+ add_library(<name> ALIAS <target>)
+
+Creates an :ref:`Alias Target <Alias Targets>`, such that ``<name>`` can be
+used to refer to ``<target>`` in subsequent commands. The ``<name>`` does
+not appear in the generated buildsystem as a make target. The ``<target>``
+may not be an ``ALIAS``.
+
+An ``ALIAS`` to a non-``GLOBAL`` :ref:`Imported Target <Imported Targets>`
+has scope in the directory in which the alias is created and below.
+The :prop_tgt:`ALIAS_GLOBAL` target property can be used to check if the
+alias is global or not.
+
+``ALIAS`` targets can be used as linkable targets and as targets to
+read properties from. They can also be tested for existence with the
+regular :command:`if(TARGET)` subcommand. The ``<name>`` may not be used
+to modify properties of ``<target>``, that is, it may not be used as the
+operand of :command:`set_property`, :command:`set_target_properties`,
+:command:`target_link_libraries` etc. An ``ALIAS`` target may not be
+installed or exported.