Help: Apply syntax highlighting to project commands

* Replace most "::" by ".. code-block:: cmake"
  * Header sentence in imperative voice,
    detailed command description in present tense.
This commit is contained in:
Joachim Wuttke (o) 2018-10-25 13:34:27 +02:00
parent 2459b5e832
commit adbaadf0ee
45 changed files with 108 additions and 103 deletions

View File

@ -1,9 +1,9 @@
add_compile_definitions
-----------------------
Adds preprocessor definitions to the compilation of source files.
Add preprocessor definitions to the compilation of source files.
::
.. code-block:: cmake
add_compile_definitions(<definition> ...)

View File

@ -1,9 +1,9 @@
add_compile_options
-------------------
Adds options to the compilation of source files.
Add options to the compilation of source files.
::
.. code-block:: cmake
add_compile_options(<option> ...)

View File

@ -8,7 +8,9 @@ There are two main signatures for ``add_custom_command``.
Generating Files
^^^^^^^^^^^^^^^^
The first signature is for adding a custom command to produce an output::
The first signature is for adding a custom command to produce an output:
.. code-block:: cmake
add_custom_command(OUTPUT output1 [output2 ...]
COMMAND command1 [ARGS] [args1...]
@ -200,7 +202,7 @@ before or after building the target. The command becomes part of the
target and will only execute when the target itself is built. If the
target is already built, the command will not execute.
::
.. code-block:: cmake
add_custom_command(TARGET <target>
PRE_BUILD | PRE_LINK | POST_BUILD

View File

@ -3,7 +3,7 @@ add_custom_target
Add a target with no output so it will always be built.
::
.. code-block:: cmake
add_custom_target(Name [ALL] [command1 [args1...]]
[COMMAND command2 [args2...] ...]

View File

@ -1,9 +1,9 @@
add_definitions
---------------
Adds -D define flags to the compilation of source files.
Add -D define flags to the compilation of source files.
::
.. code-block:: cmake
add_definitions(-DFOO -DBAR ...)

View File

@ -3,11 +3,11 @@ add_dependencies
Add a dependency between top-level targets.
::
.. code-block:: cmake
add_dependencies(<target> [<target-dependency>]...)
Make a top-level ``<target>`` depend on other top-level targets to
Makes a top-level ``<target>`` depend on other top-level targets to
ensure that they build before ``<target>`` does. A top-level target
is one created by one of the :command:`add_executable`,
:command:`add_library`, or :command:`add_custom_target` commands

View File

@ -3,7 +3,7 @@ add_executable
Add an executable to the project using the specified source files.
::
.. code-block:: cmake
add_executable(<name> [WIN32] [MACOSX_BUNDLE]
[EXCLUDE_FROM_ALL]
@ -47,7 +47,7 @@ within IDE.
--------------------------------------------------------------------------
::
.. code-block:: cmake
add_executable(<name> IMPORTED [GLOBAL])
@ -67,7 +67,7 @@ properties for more information.
--------------------------------------------------------------------------
::
.. code-block:: cmake
add_executable(<name> ALIAS <target>)

View File

@ -10,7 +10,7 @@ Add a library to the project using the specified source files.
Normal Libraries
^^^^^^^^^^^^^^^^
::
.. code-block:: cmake
add_library(<name> [STATIC | SHARED | MODULE]
[EXCLUDE_FROM_ALL]
@ -67,7 +67,7 @@ within IDE.
Imported Libraries
^^^^^^^^^^^^^^^^^^
::
.. code-block:: cmake
add_library(<name> <SHARED|STATIC|MODULE|OBJECT|UNKNOWN> IMPORTED
[GLOBAL])
@ -92,7 +92,7 @@ for more information.
Object Libraries
^^^^^^^^^^^^^^^^
::
.. code-block:: cmake
add_library(<name> OBJECT <src>...)
@ -121,7 +121,7 @@ consider adding at least one real source file to any target that references
Alias Libraries
^^^^^^^^^^^^^^^
::
.. code-block:: cmake
add_library(<name> ALIAS <target>)
@ -141,7 +141,7 @@ installed or exported.
Interface Libraries
^^^^^^^^^^^^^^^^^^^
::
.. code-block:: cmake
add_library(<name> INTERFACE [IMPORTED [GLOBAL]])

View File

@ -1,9 +1,9 @@
add_link_options
----------------
Adds options to the link of shared library, module and executable targets.
Add options to the link of shared library, module and executable targets.
::
.. code-block:: cmake
add_link_options(<option> ...)

View File

@ -3,12 +3,11 @@ add_subdirectory
Add a subdirectory to the build.
::
.. code-block:: cmake
add_subdirectory(source_dir [binary_dir]
[EXCLUDE_FROM_ALL])
add_subdirectory(source_dir [binary_dir] [EXCLUDE_FROM_ALL])
Add a subdirectory to the build. The source_dir specifies the
Adds a subdirectory to the build. The source_dir specifies the
directory in which the source CMakeLists.txt and code files are
located. If it is a relative path it will be evaluated with respect
to the current directory (the typical usage), but it may also be an

View File

@ -3,13 +3,13 @@ add_test
Add a test to the project to be run by :manual:`ctest(1)`.
::
.. code-block:: cmake
add_test(NAME <name> COMMAND <command> [<arg>...]
[CONFIGURATIONS <config>...]
[WORKING_DIRECTORY <dir>])
Add a test called ``<name>``. The test name may not contain spaces,
Adds a test called ``<name>``. The test name may not contain spaces,
quotes, or other characters special in CMake syntax. The options are:
``COMMAND``
@ -39,7 +39,9 @@ The ``COMMAND`` and ``WORKING_DIRECTORY`` options may use "generator
expressions" with the syntax ``$<...>``. See the
:manual:`cmake-generator-expressions(7)` manual for available expressions.
Example usage::
Example usage:
.. code-block:: cmake
add_test(NAME mytest
COMMAND testDriver --config $<CONFIGURATION>
@ -57,7 +59,7 @@ file produced by target ``myexe``.
---------------------------------------------------------------------
::
.. code-block:: cmake
add_test(<name> <command> [<arg>...])

View File

@ -3,7 +3,7 @@ aux_source_directory
Find all source files in a directory.
::
.. code-block:: cmake
aux_source_directory(<dir> <variable>)

View File

@ -3,7 +3,7 @@ create_test_sourcelist
Create a test driver and source list for building test programs.
::
.. code-block:: cmake
create_test_sourcelist(sourceListName driverName
test1 test2 test3

View File

@ -3,7 +3,7 @@ define_property
Define and document custom properties.
::
.. code-block:: cmake
define_property(<GLOBAL | DIRECTORY | TARGET | SOURCE |
TEST | VARIABLE | CACHED_VARIABLE>
@ -11,7 +11,7 @@ Define and document custom properties.
BRIEF_DOCS <brief-doc> [docs...]
FULL_DOCS <full-doc> [docs...])
Define one property in a scope for use with the :command:`set_property` and
Defines one property in a scope for use with the :command:`set_property` and
:command:`get_property` commands. This is primarily useful to associate
documentation with property names that may be retrieved with the
:command:`get_property` command. The first argument determines the kind of

View File

@ -3,12 +3,12 @@ enable_language
Enable a language (CXX/C/Fortran/etc)
::
.. code-block:: cmake
enable_language(<lang> [OPTIONAL] )
This command enables support for the named language in CMake. This is
the same as the project command but does not create any of the extra
Enables support for the named language in CMake. This is
the same as the :command:`project` command but does not create any of the extra
variables that are created by the project command. Example languages
are ``CXX``, ``C``, ``CUDA``, ``Fortran``, and ``ASM``.

View File

@ -3,7 +3,7 @@ enable_testing
Enable testing for current directory and below.
::
.. code-block:: cmake
enable_testing()

View File

@ -3,11 +3,11 @@ export
Export targets from the build tree for use by outside projects.
::
.. code-block:: cmake
export(EXPORT <export-name> [NAMESPACE <namespace>] [FILE <filename>])
Create a file ``<filename>`` that may be included by outside projects to
Creates a file ``<filename>`` that may be included by outside projects to
import targets from the current project's build tree. This is useful
during cross-compiling to build utility executables that can run on
the host platform in one project and then import them into another
@ -25,7 +25,7 @@ export targets from an installation tree.
The properties set on the generated IMPORTED targets will have the
same values as the final values of the input TARGETS.
::
.. code-block:: cmake
export(TARGETS [target1 [target2 [...]]] [NAMESPACE <namespace>]
[APPEND] FILE <filename> [EXPORT_LINK_INTERFACE_LIBRARIES])
@ -49,7 +49,7 @@ unspecified.
transitive usage requirements of other targets that link to the
object libraries in their implementation.
::
.. code-block:: cmake
export(PACKAGE <PackageName>)
@ -65,7 +65,7 @@ wide installations, it is not desirable to write the user package
registry. If the :variable:`CMAKE_EXPORT_NO_PACKAGE_REGISTRY` variable
is enabled, the ``export(PACKAGE)`` command will do nothing.
::
.. code-block:: cmake
export(TARGETS [target1 [target2 [...]]] [ANDROID_MK <filename>])

View File

@ -3,7 +3,7 @@ fltk_wrap_ui
Create FLTK user interfaces Wrappers.
::
.. code-block:: cmake
fltk_wrap_ui(resultingLibraryName source1
source2 ... sourceN )

View File

@ -3,11 +3,11 @@ get_source_file_property
Get a property for a source file.
::
.. code-block:: cmake
get_source_file_property(VAR file property)
Get a property from a source file. The value of the property is
Gets a property from a source file. The value of the property is
stored in the variable ``VAR``. If the source property is not found, the
behavior depends on whether it has been defined to be an ``INHERITED`` property
or not (see :command:`define_property`). Non-inherited properties will set

View File

@ -3,7 +3,7 @@ get_target_property
Get a property from a target.
::
.. code-block:: cmake
get_target_property(VAR target property)

View File

@ -3,7 +3,7 @@ get_test_property
Get a property of the test.
::
.. code-block:: cmake
get_test_property(test property VAR)

View File

@ -3,7 +3,7 @@ include_directories
Add include directories to the build.
::
.. code-block:: cmake
include_directories([AFTER|BEFORE] [SYSTEM] dir1 [dir2 ...])

View File

@ -3,7 +3,7 @@ include_external_msproject
Include an external Microsoft project file in a workspace.
::
.. code-block:: cmake
include_external_msproject(projectname location
[TYPE projectTypeGUID]

View File

@ -3,11 +3,11 @@ include_regular_expression
Set the regular expression used for dependency checking.
::
.. code-block:: cmake
include_regular_expression(regex_match [regex_complain])
Set the regular expressions used in dependency checking. Only files
Sets the regular expressions used in dependency checking. Only files
matching ``regex_match`` will be traced as dependencies. Only files
matching ``regex_complain`` will generate warnings if they cannot be found
(standard header paths are not searched). The defaults are:

View File

@ -101,7 +101,7 @@ Installing Targets
.. _TARGETS:
::
.. code-block:: cmake
install(TARGETS targets... [EXPORT <export-name>]
[[ARCHIVE|LIBRARY|RUNTIME|OBJECTS|FRAMEWORK|BUNDLE|
@ -305,7 +305,7 @@ Installing Files
.. _FILES:
.. _PROGRAMS:
::
.. code-block:: cmake
install(<FILES|PROGRAMS> files... DESTINATION <dir>
[PERMISSIONS permissions...]
@ -340,7 +340,7 @@ Installing Directories
.. _DIRECTORY:
::
.. code-block:: cmake
install(DIRECTORY dirs... DESTINATION <dir>
[FILE_PERMISSIONS permissions...]
@ -424,7 +424,7 @@ Custom Installation Logic
.. _CODE:
.. _SCRIPT:
::
.. code-block:: cmake
install([[SCRIPT <file>] [CODE <code>]]
[COMPONENT <component>] [EXCLUDE_FROM_ALL] [...])
@ -447,7 +447,7 @@ Installing Exports
.. _EXPORT:
::
.. code-block:: cmake
install(EXPORT <export-name> DESTINATION <dir>
[NAMESPACE <namespace>] [[FILE <name>.cmake]|

View File

@ -3,11 +3,11 @@ link_directories
Add directories in which the linker will look for libraries.
::
.. code-block:: cmake
link_directories([AFTER|BEFORE] directory1 [directory2 ...])
Add the paths in which the linker should search for libraries.
Adds the paths in which the linker should search for libraries.
Relative paths given to this command are interpreted as relative to
the current source directory, see :policy:`CMP0015`.

View File

@ -3,7 +3,7 @@ link_libraries
Link libraries to all targets added later.
::
.. code-block:: cmake
link_libraries([item1 [item2 [...]]]
[[debug|optimized|general] <item>] ...)

View File

@ -3,21 +3,20 @@ load_cache
Load in the values from another project's CMake cache.
::
.. code-block:: cmake
load_cache(pathToCacheFile READ_WITH_PREFIX
prefix entry1...)
load_cache(pathToCacheFile READ_WITH_PREFIX prefix entry1...)
Read the cache and store the requested entries in variables with their
Reads the cache and store the requested entries in variables with their
name prefixed with the given prefix. This only reads the values, and
does not create entries in the local project's cache.
::
.. code-block:: cmake
load_cache(pathToCacheFile [EXCLUDE entry1...]
[INCLUDE_INTERNALS entry1...])
Load in the values from another cache and store them in the local
Loads in the values from another cache and store them in the local
project's cache as internal entries. This is useful for a project
that depends on another project built in a different tree. ``EXCLUDE``
option can be used to provide a list of entries to be excluded.

View File

@ -3,10 +3,9 @@ qt_wrap_cpp
Create Qt Wrappers.
::
.. code-block:: cmake
qt_wrap_cpp(resultingLibraryName DestName
SourceLists ...)
qt_wrap_cpp(resultingLibraryName DestName SourceLists ...)
Produce moc files for all the .h files listed in the SourceLists. The
Produces moc files for all the .h files listed in the SourceLists. The
moc files will be added to the library using the ``DestName`` source list.

View File

@ -3,12 +3,12 @@ qt_wrap_ui
Create Qt user interfaces Wrappers.
::
.. code-block:: cmake
qt_wrap_ui(resultingLibraryName HeadersDestName
SourcesDestName SourceLists ...)
Produce .h and .cxx files for all the .ui files listed in the
Produces .h and .cxx files for all the .ui files listed in the
``SourceLists``. The .h files will be added to the library using the
``HeadersDestNamesource`` list. The .cxx files will be added to the
library using the ``SourcesDestNamesource`` list.

View File

@ -1,9 +1,9 @@
remove_definitions
------------------
Removes -D define flags added by :command:`add_definitions`.
Remove -D define flags added by :command:`add_definitions`.
::
.. code-block:: cmake
remove_definitions(-DFOO -DBAR ...)

View File

@ -3,13 +3,13 @@ set_source_files_properties
Source files can have properties that affect how they are built.
::
.. code-block:: cmake
set_source_files_properties([file1 [file2 [...]]]
PROPERTIES prop1 value1
[prop2 value2 [...]])
Set properties associated with source files using a key/value paired
Sets properties associated with source files using a key/value paired
list. See :ref:`Source File Properties` for the list of properties known
to CMake. Source file properties are visible only to targets added
in the same directory (CMakeLists.txt).

View File

@ -3,13 +3,13 @@ set_target_properties
Targets can have properties that affect how they are built.
::
.. code-block:: cmake
set_target_properties(target1 target2 ...
PROPERTIES prop1 value1
prop2 value2 ...)
Set properties on targets. The syntax for the command is to list all
Sets properties on targets. The syntax for the command is to list all
the targets you want to change, and then provide the values you want to
set next. You can use any prop value pair you want and extract it
later with the :command:`get_property` or :command:`get_target_property`

View File

@ -3,11 +3,11 @@ set_tests_properties
Set a property of the tests.
::
.. code-block:: cmake
set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2 value2)
Set a property for the tests. If the test is not found, CMake
Sets a property for the tests. If the test is not found, CMake
will report an error.
:manual:`Generator expressions <cmake-generator-expressions(7)>` will be
expanded the same as supported by the test's :command:`add_test` call. See

View File

@ -4,7 +4,7 @@ source_group
Define a grouping for source files in IDE project generation.
There are two different signatures to create source groups.
::
.. code-block:: cmake
source_group(<name> [FILES <src>...] [REGULAR_EXPRESSION <regex>])
source_group(TREE <root> [PREFIX <prefix>] [FILES <src>...])

View File

@ -3,13 +3,13 @@ target_compile_definitions
Add compile definitions to a target.
::
.. code-block:: cmake
target_compile_definitions(<target>
<INTERFACE|PUBLIC|PRIVATE> [items1...]
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
Specify compile definitions to use when compiling a given ``<target>``. The
Specifies compile definitions to use when compiling a given ``<target>``. The
named ``<target>`` must have been created by a command such as
:command:`add_executable` or :command:`add_library` and must not be an
:ref:`ALIAS target <Alias Targets>`.

View File

@ -3,11 +3,11 @@ target_compile_features
Add expected compiler features to a target.
::
.. code-block:: cmake
target_compile_features(<target> <PRIVATE|PUBLIC|INTERFACE> <feature> [...])
Specify compiler features required when compiling a given target. If the
Specifies compiler features required when compiling a given target. If the
feature is not listed in the :variable:`CMAKE_C_COMPILE_FEATURES` variable
or :variable:`CMAKE_CXX_COMPILE_FEATURES` variable,
then an error will be reported by CMake. If the use of the feature requires

View File

@ -3,13 +3,13 @@ target_compile_options
Add compile options to a target.
::
.. code-block:: cmake
target_compile_options(<target> [BEFORE]
<INTERFACE|PUBLIC|PRIVATE> [items1...]
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
Specify compile options to use when compiling a given target. The
Specifies compile options to use when compiling a given target. The
named ``<target>`` must have been created by a command such as
:command:`add_executable` or :command:`add_library` and must not be an
:ref:`ALIAS target <Alias Targets>`.

View File

@ -3,13 +3,13 @@ target_include_directories
Add include directories to a target.
::
.. code-block:: cmake
target_include_directories(<target> [SYSTEM] [BEFORE]
<INTERFACE|PUBLIC|PRIVATE> [items1...]
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
Specify include directories to use when compiling a given target.
Specifies include directories to use when compiling a given target.
The named ``<target>`` must have been created by a command such
as :command:`add_executable` or :command:`add_library` and must not be an
:ref:`ALIAS target <Alias Targets>`.

View File

@ -3,13 +3,13 @@ target_link_directories
Add link directories to a target.
::
.. code-block:: cmake
target_link_directories(<target> [BEFORE]
<INTERFACE|PUBLIC|PRIVATE> [items1...]
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
Specify the paths in which the linker should search for libraries when
Specifies the paths in which the linker should search for libraries when
linking a given target. Each item can be an absolute or relative path,
with the latter being interpreted as relative to the current source
directory. These items will be added to the link command.

View File

@ -14,7 +14,9 @@ Overview
^^^^^^^^
This command has several signatures as detailed in subsections below.
All of them have the general form::
All of them have the general form
.. code-block:: cmake
target_link_libraries(<target> ... <item>... ...)
@ -128,7 +130,7 @@ buildsystem properties.
Libraries for a Target and/or its Dependents
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
.. code-block:: cmake
target_link_libraries(<target>
<PRIVATE|PUBLIC|INTERFACE> <item>...
@ -145,7 +147,7 @@ used for linking ``<target>``.
Libraries for both a Target and its Dependents
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
.. code-block:: cmake
target_link_libraries(<target> <item>...)
@ -163,7 +165,7 @@ exclusively by this signature private.
Libraries for a Target and/or its Dependents (Legacy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
.. code-block:: cmake
target_link_libraries(<target>
<LINK_PRIVATE|LINK_PUBLIC> <lib>...
@ -185,7 +187,7 @@ made part of the :prop_tgt:`INTERFACE_LINK_LIBRARIES`. If policy
Libraries for Dependents Only (Legacy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
.. code-block:: cmake
target_link_libraries(<target> LINK_INTERFACE_LIBRARIES <item>...)

View File

@ -3,13 +3,13 @@ target_link_options
Add link options to a target.
::
.. code-block:: cmake
target_link_options(<target> [BEFORE]
<INTERFACE|PUBLIC|PRIVATE> [items1...]
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
Specify link options to use when linking a given target. The
Specifies link options to use when linking a given target. The
named ``<target>`` must have been created by a command such as
:command:`add_executable` or :command:`add_library` and must not be an
:ref:`ALIAS target <Alias Targets>`.

View File

@ -3,13 +3,13 @@ target_sources
Add sources to a target.
::
.. code-block:: cmake
target_sources(<target>
<INTERFACE|PUBLIC|PRIVATE> [items1...]
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
Specify sources to use when compiling a given target. Relative
Specifies sources to use when compiling a given target. Relative
source file paths are interpreted as being relative to the current
source directory (i.e. :variable:`CMAKE_CURRENT_SOURCE_DIR`). The
named ``<target>`` must have been created by a command such as

View File

@ -10,7 +10,7 @@ Try building some code.
Try Compiling Whole Projects
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
.. code-block:: cmake
try_compile(RESULT_VAR <bindir> <srcdir>
<projectName> [<targetName>] [CMAKE_FLAGS <flags>...]
@ -28,7 +28,7 @@ below for the meaning of other options.
Try Compiling Source Files
^^^^^^^^^^^^^^^^^^^^^^^^^^
::
.. code-block:: cmake
try_compile(RESULT_VAR <bindir> <srcfile|SOURCES srcfile...>
[CMAKE_FLAGS <flags>...]
@ -47,7 +47,9 @@ returned in ``RESULT_VAR``.
In this form the user need only supply one or more source files that include a
definition for ``main``. CMake will create a ``CMakeLists.txt`` file to build
the source(s) as an executable that looks something like this::
the source(s) as an executable that looks something like this:
.. code-block:: cmake
add_definitions(<expanded COMPILE_DEFINITIONS from caller>)
include_directories(${INCLUDE_DIRECTORIES})

View File

@ -10,7 +10,7 @@ Try compiling and then running some code.
Try Compiling and Running Source Files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
.. code-block:: cmake
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
bindir srcfile [CMAKE_FLAGS <flags>...]