Help: Organize Binary Targets section of cmake-buildsystem.7
Add a subsection for Binary Executables just before Binary Library Types. Divide the library section into Normal Libraries and Object Libraries.
This commit is contained in:
parent
4054534cc6
commit
50dca47106
|
@ -19,8 +19,8 @@ and the rules for regeneration in response to change.
|
||||||
Binary Targets
|
Binary Targets
|
||||||
==============
|
==============
|
||||||
|
|
||||||
Executables and libraries are defined using the :command:`add_library`
|
Executables and libraries are defined using the :command:`add_executable`
|
||||||
and :command:`add_executable` commands. The resulting binary files have
|
and :command:`add_library` commands. The resulting binary files have
|
||||||
appropriate prefixes, suffixes and extensions for the platform targeted.
|
appropriate prefixes, suffixes and extensions for the platform targeted.
|
||||||
Dependencies between binary targets are expressed using the
|
Dependencies between binary targets are expressed using the
|
||||||
:command:`target_link_libraries` command:
|
:command:`target_link_libraries` command:
|
||||||
|
@ -37,9 +37,28 @@ is defined as an executable formed by compiling and linking ``zipapp.cpp``.
|
||||||
When linking the ``zipapp`` executable, the ``archive`` static library is
|
When linking the ``zipapp`` executable, the ``archive`` static library is
|
||||||
linked in.
|
linked in.
|
||||||
|
|
||||||
|
Binary Executables
|
||||||
|
------------------
|
||||||
|
|
||||||
|
The :command:`add_executable` command defines an executable target:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
add_executable(mytool mytool.cpp)
|
||||||
|
|
||||||
|
Commands such as :command:`add_custom_command`, which generates rules to be
|
||||||
|
run at build time can transparently use an :prop_tgt:`EXECUTABLE <TYPE>`
|
||||||
|
target as a ``COMMAND`` executable. The buildsystem rules will ensure that
|
||||||
|
the executable is built before attempting to run the command.
|
||||||
|
|
||||||
Binary Library Types
|
Binary Library Types
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
.. _`Normal Libraries`:
|
||||||
|
|
||||||
|
Normal Libraries
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
By default, the :command:`add_library` command defines a static library,
|
By default, the :command:`add_library` command defines a static library,
|
||||||
unless a type is specified. A type may be specified when using the command:
|
unless a type is specified. A type may be specified when using the command:
|
||||||
|
|
||||||
|
@ -66,6 +85,11 @@ It is a type which is loaded as a plugin using runtime techniques.
|
||||||
|
|
||||||
add_library(archive MODULE 7z.cpp)
|
add_library(archive MODULE 7z.cpp)
|
||||||
|
|
||||||
|
.. _`Object Libraries`:
|
||||||
|
|
||||||
|
Object Libraries
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The ``OBJECT`` library type is also not linked to. It defines a non-archival
|
The ``OBJECT`` library type is also not linked to. It defines a non-archival
|
||||||
collection of object files resulting from compiling the given source files.
|
collection of object files resulting from compiling the given source files.
|
||||||
The object files collection can be used as source inputs to other targets:
|
The object files collection can be used as source inputs to other targets:
|
||||||
|
@ -83,11 +107,6 @@ they may not be installed, exported, or used in the right hand side of
|
||||||
:command:`target_link_libraries`. They also may not be used as the ``TARGET``
|
:command:`target_link_libraries`. They also may not be used as the ``TARGET``
|
||||||
in a use of the :command:`add_custom_command(TARGET)` command signature.
|
in a use of the :command:`add_custom_command(TARGET)` command signature.
|
||||||
|
|
||||||
Commands such as :command:`add_custom_command`, which generates rules to be
|
|
||||||
run at build time can transparently use an :prop_tgt:`EXECUTABLE <TYPE>`
|
|
||||||
target as a ``COMMAND`` executable. The buildsystem rules will ensure that
|
|
||||||
the executable is built before attempting to run the command.
|
|
||||||
|
|
||||||
Build Specification and Usage Requirements
|
Build Specification and Usage Requirements
|
||||||
==========================================
|
==========================================
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue