Merge topic 'doc-improvements'

d4d1f85297 Help: Move a note about arguments and genexes into include file
968224484f Help: Drop unused `PROPERTY_GENEX` replace from `prop_tgt/INTERFACE_*` files
65457e4fae Help: Add _See Also_ sections to related CMake commands
c86ec79d07 Help: Use direct refs to genexes instead of ``$<GENEX-NAME>``
8c6274326d Help: Use CMake highlighting for command synopsis
c356a94512 Help: Use monospaced font for a genex name in a section title
f98c8707f4 Help: Use `code-block:: cmake` instead of `::` for sub-commands descriptions
2ba351ca4f Help: ``CMake`` → CMake
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7873
This commit is contained in:
Brad King
2022-11-10 15:11:11 +00:00
committed by Kitware Robot
120 changed files with 556 additions and 320 deletions
+3 -5
View File
@@ -7,8 +7,6 @@ Host And Device Specific Link Options
:prop_tgt:`CUDA_RESOLVE_DEVICE_SYMBOLS` properties and policy :policy:`CMP0105`,
the raw options will be delivered to the host and device link steps (wrapped in
``-Xcompiler`` or equivalent for device link). Options wrapped with
``$<DEVICE_LINK:...>``
:manual:`generator expression <cmake-generator-expressions(7)>` will be used
only for the device link step. Options wrapped with ``$<HOST_LINK:...>``
:manual:`generator expression <cmake-generator-expressions(7)>` will be used
only for the host link step.
:genex:`$<DEVICE_LINK:...>` generator expression will be used
only for the device link step. Options wrapped with :genex:`$<HOST_LINK:...>`
generator expression will be used only for the host link step.
+6
View File
@@ -0,0 +1,6 @@
.. |more_see_also| replace:: See the :manual:`cmake-buildsystem(7)` manual
for more on defining buildsystem properties.
Arguments to |command_name| may use generator expressions
with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. |more_see_also|
+7 -4
View File
@@ -21,7 +21,10 @@ Function-style definitions are not supported. CMake will automatically
escape the value correctly for the native build system (note that CMake
language syntax may require escapes to specify some values).
Arguments to ``add_compile_definitions`` may use "generator expressions" with
the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
.. |command_name| replace:: ``add_compile_definitions``
.. include:: GENEX_NOTE.txt
See Also
^^^^^^^^
* The command :command:`target_compile_definitions` adds target-specific definitions.
+9 -11
View File
@@ -14,10 +14,8 @@ directory and below.
Arguments
^^^^^^^^^
Arguments to ``add_compile_options`` may use "generator expressions" with
the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
.. |command_name| replace:: ``add_compile_options``
.. include:: GENEX_NOTE.txt
.. include:: OPTIONS_SHELL.txt
@@ -40,12 +38,12 @@ this command is in a compiler-specific conditional clause:
See Also
^^^^^^^^
This command can be used to add any options. However, for
adding preprocessor definitions and include directories it is recommended
to use the more specific commands :command:`add_compile_definitions`
and :command:`include_directories`.
* This command can be used to add any options. However, for
adding preprocessor definitions and include directories it is recommended
to use the more specific commands :command:`add_compile_definitions`
and :command:`include_directories`.
The command :command:`target_compile_options` adds target-specific options.
* The command :command:`target_compile_options` adds target-specific options.
The source file property :prop_sf:`COMPILE_OPTIONS` adds options to one
source file.
* The source file property :prop_sf:`COMPILE_OPTIONS` adds options to one
source file.
+5
View File
@@ -490,3 +490,8 @@ Ninja Multi-Config
``add_custom_command`` supports the :generator:`Ninja Multi-Config`
generator's cross-config capabilities. See the generator documentation
for more information.
See Also
^^^^^^^^
* :command:`add_custom_target`
+5
View File
@@ -181,3 +181,8 @@ Ninja Multi-Config
``add_custom_target`` supports the :generator:`Ninja Multi-Config`
generator's cross-config capabilities. See the generator documentation
for more information.
See Also
^^^^^^^^
* :command:`add_custom_command`
+6 -3
View File
@@ -1,7 +1,7 @@
add_definitions
---------------
Add -D define flags to the compilation of source files.
Add ``-D`` define flags to the compilation of source files.
.. code-block:: cmake
@@ -31,5 +31,8 @@ backwards compatibility. See documentation of the
properties for details on adding preprocessor definitions to specific
scopes and configurations.
See the :manual:`cmake-buildsystem(7)` manual for more on defining
buildsystem properties.
See Also
^^^^^^^^
* The :manual:`cmake-buildsystem(7)` manual for more on defining
buildsystem properties.
+9 -4
View File
@@ -20,7 +20,12 @@ transitively in its place since the target itself does not build.
.. versionadded:: 3.3
Allow adding dependencies to interface libraries.
See the ``DEPENDS`` option of :command:`add_custom_target` and
:command:`add_custom_command` commands for adding file-level
dependencies in custom rules. See the :prop_sf:`OBJECT_DEPENDS`
source file property to add file-level dependencies to object files.
See Also
^^^^^^^^
* The ``DEPENDS`` option of :command:`add_custom_target` and
:command:`add_custom_command` commands for adding file-level
dependencies in custom rules.
* The :prop_sf:`OBJECT_DEPENDS` source file property to add
file-level dependencies to object files.
+5
View File
@@ -107,3 +107,8 @@ 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.
See Also
^^^^^^^^
* :command:`add_library`
+8 -3
View File
@@ -85,8 +85,8 @@ Creates an :ref:`Object Library <Object Libraries>`. An object library
compiles source files but does not archive or link their object files into a
library. Instead other targets created by :command:`add_library` or
:command:`add_executable` may reference the objects using an expression of the
form ``$<TARGET_OBJECTS:objlib>`` as a source, where ``objlib`` is the
object library name. For example:
form :genex:`$\<TARGET_OBJECTS:objlib\> <TARGET_OBJECTS>` as a source, where
``objlib`` is the object library name. For example:
.. code-block:: cmake
@@ -101,7 +101,7 @@ They may contain custom commands generating such sources, but not
``PRE_BUILD``, ``PRE_LINK``, or ``POST_BUILD`` commands. Some native build
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>``.
:genex:`$\<TARGET_OBJECTS:objlib\> <TARGET_OBJECTS>`.
.. versionadded:: 3.12
Object libraries can be linked to with :command:`target_link_libraries`.
@@ -261,3 +261,8 @@ 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.
See Also
^^^^^^^^
* :command:`add_executable`
+9 -4
View File
@@ -23,13 +23,18 @@ exist to add libraries (:command:`target_link_libraries` or
since they do not use a linker. To add archiver or MSVC librarian flags,
see the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property.
Arguments to ``add_link_options`` may use "generator expressions" with
the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
.. |command_name| replace:: ``add_link_options``
.. include:: GENEX_NOTE.txt
.. include:: DEVICE_LINK_OPTIONS.txt
.. include:: OPTIONS_SHELL.txt
.. include:: LINK_OPTIONS_LINKER.txt
See Also
^^^^^^^^
* :command:`link_libraries`
* :command:`target_link_libraries`
* :command:`target_link_options`
+3 -3
View File
@@ -71,6 +71,6 @@ inside the block.
See Also
^^^^^^^^
* :command:`endblock`
* :command:`return`
* :command:`cmake_policy`
* :command:`endblock`
* :command:`return`
* :command:`cmake_policy`
+1 -1
View File
@@ -5,7 +5,7 @@ Disallowed since version 3.0. See CMake Policy :policy:`CMP0036`.
Use ``${CMAKE_SYSTEM}`` and ``${CMAKE_CXX_COMPILER}`` instead.
::
.. code-block:: cmake
build_name(variable)
@@ -17,7 +17,7 @@ Synopsis
Query host system specific information
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
.. code-block:: cmake
cmake_host_system_information(RESULT <variable> QUERY <key> ...)
+5
View File
@@ -79,3 +79,8 @@ invokes
cmake_policy(VERSION 2.4[...<max>])
which enables compatibility features for CMake 2.4 and lower.
See Also
^^^^^^^^
* :command:`cmake_policy`
+6
View File
@@ -113,3 +113,9 @@ interpreted as the beginning of the new option. E.g.
is a keyword itself ``MY_INSTALL_DESTINATION`` will be empty (but added
to ``MY_INSTALL_KEYWORDS_MISSING_VALUES``) and ``MY_INSTALL_OPTIONAL`` will
therefore be set to ``TRUE``.
See Also
^^^^^^^^
* :command:`function`
* :command:`macro`
+20 -20
View File
@@ -237,7 +237,7 @@ The following forms of the ``GET`` subcommand each retrieve a different
component or group of components from a path. See
`Path Structure And Terminology`_ for the meaning of each path component.
::
.. code-block:: cmake
cmake_path(GET <path-var> ROOT_NAME <out-var>)
cmake_path(GET <path-var> ROOT_DIRECTORY <out-var>)
@@ -408,7 +408,7 @@ meaning of each path component.
.. _HAS_RELATIVE_PART:
.. _HAS_PARENT_PATH:
::
.. code-block:: cmake
cmake_path(HAS_ROOT_NAME <path-var> <out-var>)
cmake_path(HAS_ROOT_DIRECTORY <path-var> <out-var>)
@@ -432,7 +432,7 @@ Note the following special cases:
.. _IS_ABSOLUTE:
::
.. code-block:: cmake
cmake_path(IS_ABSOLUTE <path-var> <out-var>)
@@ -446,7 +446,7 @@ false while ``HAS_ROOT_DIRECTORY`` can be true.
.. _IS_RELATIVE:
::
.. code-block:: cmake
cmake_path(IS_RELATIVE <path-var> <out-var>)
@@ -454,7 +454,7 @@ This will store the opposite of ``IS_ABSOLUTE`` in ``<out-var>``.
.. _IS_PREFIX:
::
.. code-block:: cmake
cmake_path(IS_PREFIX <path-var> <input> [NORMALIZE] <out-var>)
@@ -476,7 +476,7 @@ are :ref:`normalized <Normalization>` before the check.
.. _Path COMPARE:
.. _COMPARE:
::
.. code-block:: cmake
cmake_path(COMPARE <input1> EQUAL <input2> <out-var>)
cmake_path(COMPARE <input1> NOT_EQUAL <input2> <out-var>)
@@ -510,7 +510,7 @@ Modification
.. _cmake_path-SET:
::
.. code-block:: cmake
cmake_path(SET <path-var> [NORMALIZE] <input>)
@@ -539,7 +539,7 @@ Output::
.. _APPEND:
::
.. code-block:: cmake
cmake_path(APPEND <path-var> [<input>...] [OUTPUT_VARIABLE <out-var>])
@@ -570,7 +570,7 @@ the following algorithm (pseudo-code) applies:
.. _APPEND_STRING:
::
.. code-block:: cmake
cmake_path(APPEND_STRING <path-var> [<input>...] [OUTPUT_VARIABLE <out-var>])
@@ -579,7 +579,7 @@ Append all the ``<input>`` arguments to the ``<path-var>`` without adding any
.. _REMOVE_FILENAME:
::
.. code-block:: cmake
cmake_path(REMOVE_FILENAME <path-var> [OUTPUT_VARIABLE <out-var>])
@@ -609,7 +609,7 @@ Output::
.. _REPLACE_FILENAME:
::
.. code-block:: cmake
cmake_path(REPLACE_FILENAME <path-var> <input> [OUTPUT_VARIABLE <out-var>])
@@ -628,7 +628,7 @@ equivalent to the following:
.. _REMOVE_EXTENSION:
::
.. code-block:: cmake
cmake_path(REMOVE_EXTENSION <path-var> [LAST_ONLY]
[OUTPUT_VARIABLE <out-var>])
@@ -637,7 +637,7 @@ Removes the :ref:`extension <EXTENSION_DEF>`, if any, from ``<path-var>``.
.. _REPLACE_EXTENSION:
::
.. code-block:: cmake
cmake_path(REPLACE_EXTENSION <path-var> [LAST_ONLY] <input>
[OUTPUT_VARIABLE <out-var>])
@@ -661,7 +661,7 @@ Generation
.. _NORMAL_PATH:
::
.. code-block:: cmake
cmake_path(NORMAL_PATH <path-var> [OUTPUT_VARIABLE <out-var>])
@@ -670,7 +670,7 @@ Normalize ``<path-var>`` according the steps described in :ref:`Normalization`.
.. _cmake_path-RELATIVE_PATH:
.. _RELATIVE_PATH:
::
.. code-block:: cmake
cmake_path(RELATIVE_PATH <path-var> [BASE_DIRECTORY <input>]
[OUTPUT_VARIABLE <out-var>])
@@ -686,7 +686,7 @@ as that used by C++
.. _ABSOLUTE_PATH:
::
.. code-block:: cmake
cmake_path(ABSOLUTE_PATH <path-var> [BASE_DIRECTORY <input>] [NORMALIZE]
[OUTPUT_VARIABLE <out-var>])
@@ -713,7 +713,7 @@ target platform when cross-compiling.
.. _cmake_path-NATIVE_PATH:
.. _NATIVE_PATH:
::
.. code-block:: cmake
cmake_path(NATIVE_PATH <path-var> [NORMALIZE] <out-var>)
@@ -727,7 +727,7 @@ When the ``NORMALIZE`` option is specified, the path is :ref:`normalized
.. _cmake_path-TO_CMAKE_PATH_LIST:
.. _TO_CMAKE_PATH_LIST:
::
.. code-block:: cmake
cmake_path(CONVERT <input> TO_CMAKE_PATH_LIST <out-var> [NORMALIZE])
@@ -749,7 +749,7 @@ When the ``NORMALIZE`` option is specified, the path is :ref:`normalized
.. _cmake_path-TO_NATIVE_PATH_LIST:
.. _TO_NATIVE_PATH_LIST:
::
.. code-block:: cmake
cmake_path(CONVERT <input> TO_NATIVE_PATH_LIST <out-var> [NORMALIZE])
@@ -788,7 +788,7 @@ Hashing
.. _HASH:
::
.. code-block:: cmake
cmake_path(HASH <path-var> <out-var>)
+5
View File
@@ -150,3 +150,8 @@ use the pre-record policies when they are invoked. If the function or
macro implementation sets policies, the changes automatically
propagate up through callers until they reach the closest nested
policy stack entry.
See Also
^^^^^^^^
* :command:`cmake_minimum_required`
+5
View File
@@ -182,3 +182,8 @@ specify the output directory as an include directory:
include_directories(${CMAKE_CURRENT_BINARY_DIR})
so that sources may include the header as ``#include <foo.h>``.
See Also
^^^^^^^^
* :command:`file(GENERATE)`
+1 -1
View File
@@ -3,7 +3,7 @@ ctest_build
Perform the :ref:`CTest Build Step` as a :ref:`Dashboard Client`.
::
.. code-block:: cmake
ctest_build([BUILD <build-dir>] [APPEND]
[CONFIGURATION <config>]
+1 -1
View File
@@ -3,7 +3,7 @@ ctest_configure
Perform the :ref:`CTest Configure Step` as a :ref:`Dashboard Client`.
::
.. code-block:: cmake
ctest_configure([BUILD <build-dir>] [SOURCE <source-dir>] [APPEND]
[OPTIONS <options>] [RETURN_VALUE <result-var>] [QUIET]
+1 -1
View File
@@ -3,7 +3,7 @@ ctest_coverage
Perform the :ref:`CTest Coverage Step` as a :ref:`Dashboard Client`.
::
.. code-block:: cmake
ctest_coverage([BUILD <build-dir>] [APPEND]
[LABELS <label>...]
@@ -3,9 +3,9 @@ ctest_empty_binary_directory
empties the binary directory
::
.. code-block:: cmake
ctest_empty_binary_directory( directory )
ctest_empty_binary_directory(<directory>)
Removes a binary directory. This command will perform some checks
prior to deleting the directory in an attempt to avoid malicious or
+1 -1
View File
@@ -3,7 +3,7 @@ ctest_memcheck
Perform the :ref:`CTest MemCheck Step` as a :ref:`Dashboard Client`.
::
.. code-block:: cmake
ctest_memcheck([BUILD <build-dir>] [APPEND]
[START <start-number>]
+2 -2
View File
@@ -3,9 +3,9 @@ ctest_read_custom_files
read CTestCustom files.
::
.. code-block:: cmake
ctest_read_custom_files( directory ... )
ctest_read_custom_files(<directory>...)
Read all the CTestCustom.ctest or CTestCustom.cmake files from the
given directory.
+1 -1
View File
@@ -3,7 +3,7 @@ ctest_run_script
runs a :option:`ctest -S` script
::
.. code-block:: cmake
ctest_run_script([NEW_PROCESS] script_file_name script_file_name1
script_file_name2 ... [RETURN_VALUE var])
+2 -2
View File
@@ -3,13 +3,13 @@ ctest_sleep
sleeps for some amount of time
::
.. code-block:: cmake
ctest_sleep(<seconds>)
Sleep for given number of seconds.
::
.. code-block:: cmake
ctest_sleep(<time1> <duration> <time2>)
+1 -1
View File
@@ -3,7 +3,7 @@ ctest_start
Starts the testing for a given model
::
.. code-block:: cmake
ctest_start(<model> [<source> [<binary>]] [GROUP <group>] [QUIET])
+2 -2
View File
@@ -3,7 +3,7 @@ ctest_submit
Perform the :ref:`CTest Submit Step` as a :ref:`Dashboard Client`.
::
.. code-block:: cmake
ctest_submit([PARTS <part>...] [FILES <file>...]
[SUBMIT_URL <url>]
@@ -96,7 +96,7 @@ Submit to CDash Upload API
.. versionadded:: 3.2
::
.. code-block:: cmake
ctest_submit(CDASH_UPLOAD <file> [CDASH_UPLOAD_TYPE <type>]
[SUBMIT_URL <url>]
+2 -2
View File
@@ -3,7 +3,7 @@ ctest_test
Perform the :ref:`CTest Test Step` as a :ref:`Dashboard Client`.
::
.. code-block:: cmake
ctest_test([BUILD <build-dir>] [APPEND]
[START <start-number>]
@@ -30,7 +30,7 @@ Perform the :ref:`CTest Test Step` as a :ref:`Dashboard Client`.
)
..
_note: If updating the argument list here, please also update the argument
NOTE If updating the argument list here, please also update the argument
list documentation for :command:`ctest_memcheck` as well.
Run tests in the project build tree and store results in
+1 -1
View File
@@ -3,7 +3,7 @@ ctest_update
Perform the :ref:`CTest Update Step` as a :ref:`Dashboard Client`.
::
.. code-block:: cmake
ctest_update([SOURCE <source-dir>]
[RETURN_VALUE <result-var>]
+1 -1
View File
@@ -3,7 +3,7 @@ ctest_upload
Upload files to a dashboard server as a :ref:`Dashboard Client`.
::
.. code-block:: cmake
ctest_upload(FILES <file>... [QUIET] [CAPTURE_CMAKE_ERROR <result-var>])
+6
View File
@@ -73,3 +73,9 @@ project via corresponding options to the :command:`get_property` command.
with ``CMAKE_`` or ``_CMAKE_``. The property name must contain at least one
underscore. It is recommended that the property name have a prefix specific
to the project.
See Also
^^^^^^^^
* :command:`get_property`
* :command:`set_property`
+1 -1
View File
@@ -8,7 +8,7 @@ exec_program
Run an executable program during the processing of the CMakeList.txt
file.
::
.. code-block:: cmake
exec_program(Executable [directory in which to run]
[ARGS <arguments to executable>]
+1 -1
View File
@@ -15,7 +15,7 @@ The old-style library dependencies file does not take into account
per-configuration names of libraries or the
:prop_tgt:`LINK_INTERFACE_LIBRARIES` target property.
::
.. code-block:: cmake
export_library_dependencies(<file> [APPEND])
+7 -6
View File
@@ -526,10 +526,10 @@ from the input content to produce the output content. The options are:
``OUTPUT <output-file>``
Specify the output file name to generate. Use generator expressions
such as ``$<CONFIG>`` to specify a configuration-specific output file
name. Multiple configurations may generate the same output file only
if the generated content is identical. Otherwise, the ``<output-file>``
must evaluate to an unique name for each configuration.
such as :genex:`$<CONFIG>` to specify a configuration-specific
output file name. Multiple configurations may generate the same output
file only if the generated content is identical. Otherwise, the
``<output-file>`` must evaluate to an unique name for each configuration.
.. versionchanged:: 3.10
A relative path (after evaluating generator expressions) is treated
@@ -540,8 +540,9 @@ from the input content to produce the output content. The options are:
.. versionadded:: 3.19
Specify which target to use when evaluating generator expressions that
require a target for evaluation (e.g. ``$<COMPILE_FEATURES:...>``,
``$<TARGET_PROPERTY:prop>``).
require a target for evaluation (e.g.
:genex:`$<COMPILE_FEATURES:...>`,
:genex:`$<TARGET_PROPERTY:prop>`).
``NO_SOURCE_PERMISSIONS``
.. versionadded:: 3.20
+2 -4
View File
@@ -74,8 +74,7 @@ processed:
message(STATUS "X=${X}")
endforeach()
yields
::
yields::
-- X=0
-- X=1
@@ -119,8 +118,7 @@ iteration variables as follows:
message(STATUS "en=${en}, ba=${ba}")
endforeach()
yields
::
yields::
-- num_0=one, num_1=satu
-- num_0=two, num_1=dua
+1
View File
@@ -77,5 +77,6 @@ extra argument.
See Also
^^^^^^^^
* :command:`cmake_parse_arguments`
* :command:`endfunction`
* :command:`return`
+5 -2
View File
@@ -12,9 +12,12 @@ the ``<property>`` is stored in the variable ``<var>``.
If the property is not found, ``<var>`` will be set to ``NOTFOUND``.
See the :manual:`cmake-properties(7)` manual for available properties.
See also the :command:`get_property` command ``GLOBAL`` option.
In addition to global properties, this command (for historical reasons)
also supports the :prop_dir:`VARIABLES` and :prop_dir:`MACROS` directory
properties. It also supports a special ``COMPONENTS`` global property that
lists the components given to the :command:`install` command.
See Also
^^^^^^^^
* the :command:`get_property` command ``GLOBAL`` option
+6 -1
View File
@@ -33,4 +33,9 @@ the search will chain to a parent scope as described for the
Get a variable definition from a directory. This form is useful to
get a variable definition from another directory.
See also the more general :command:`get_property` command.
See Also
^^^^^^^^
* :command:`define_property`
* the more general :command:`get_property` command
+5
View File
@@ -69,3 +69,8 @@ left as a full path. If ``PROGRAM_ARGS`` is present with ``PROGRAM``, then
any command-line arguments present in the ``<FileName>`` string are split
from the program name and stored in ``<arg_var>``. This is used to
separate a program name from its arguments in a command line string.
See Also
^^^^^^^^
* :command:`cmake_path`
+6
View File
@@ -99,3 +99,9 @@ documentation is requested for a property that has not been defined
The :prop_sf:`GENERATED` source file property may be globally visible.
See its documentation for details.
See Also
^^^^^^^^
* :command:`define_property`
* :command:`set_property`
+7 -2
View File
@@ -39,9 +39,14 @@ Use :command:`set_source_files_properties` to set property values. Source
file properties usually control how the file is built. One property that is
always there is :prop_sf:`LOCATION`.
See also the more general :command:`get_property` command.
.. note::
The :prop_sf:`GENERATED` source file property may be globally visible.
See its documentation for details.
See Also
^^^^^^^^
* :command:`define_property`
* the more general :command:`get_property` command
* :command:`set_source_files_properties`
+6 -2
View File
@@ -22,6 +22,10 @@ query the target instead. This command can get properties for any
target so far created. The targets do not need to be in the current
``CMakeLists.txt`` file.
See also the more general :command:`get_property` command.
See Also
^^^^^^^^
See :ref:`Target Properties` for the list of properties known to CMake.
* :command:`define_property`
* the more general :command:`get_property` command
* :command:`set_target_properties`
* :ref:`Target Properties` for the list of properties known to CMake
+5 -1
View File
@@ -19,4 +19,8 @@ an empty string.
For a list of standard properties you can type
:option:`cmake --help-property-list`.
See also the more general :command:`get_property` command.
See Also
^^^^^^^^
* :command:`define_property`
* the more general :command:`get_property` command
+3 -3
View File
@@ -428,6 +428,6 @@ condition syntax accepts ``<variable|string>``.
See also
^^^^^^^^
* :command:`else`
* :command:`elseif`
* :command:`endif`
* :command:`else`
* :command:`elseif`
* :command:`endif`
+7 -4
View File
@@ -29,13 +29,16 @@ Signalling this setting might achieve effects such as the compiler
skipping warnings, or these fixed-install system files not being
considered in dependency calculations - see compiler docs.
Arguments to ``include_directories`` may use "generator expressions" with
the syntax "$<...>". See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
.. |command_name| replace:: ``include_directories``
.. include:: GENEX_NOTE.txt
.. note::
Prefer the :command:`target_include_directories` command to add include
directories to individual targets and optionally propagate/export them
to dependents.
See Also
^^^^^^^^
* :command:`target_include_directories`
+1 -1
View File
@@ -379,7 +379,7 @@ top level:
:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target property of the
``<targets>`` when exported by the `install(EXPORT)`_ command. If a
relative path is specified, it is treated as relative to the
``$<INSTALL_PREFIX>``.
:genex:`$<INSTALL_PREFIX>`.
``RUNTIME_DEPENDENCY_SET``
.. versionadded:: 3.21
+3 -3
View File
@@ -11,7 +11,7 @@ directly replaced by the ``FILES`` form of the :command:`install`
command. The regexp form can be expressed more clearly using the ``GLOB``
form of the :command:`file` command.
::
.. code-block:: cmake
install_files(<dir> extension file file ...)
@@ -23,14 +23,14 @@ removed first. This is useful for providing lists of source files
such as foo.cxx when you want the corresponding foo.h to be installed.
A typical extension is ``.h``.
::
.. code-block:: cmake
install_files(<dir> regexp)
Any files in the current source directory that match the regular
expression will be installed.
::
.. code-block:: cmake
install_files(<dir> FILES file file ...)
+2 -2
View File
@@ -11,7 +11,7 @@ directly replaced by the ``PROGRAMS`` form of the :command:`install`
command. The regexp form can be expressed more clearly using the ``GLOB``
form of the :command:`file` command.
::
.. code-block:: cmake
install_programs(<dir> file1 file2 [file3 ...])
install_programs(<dir> FILES file1 [file2 ...])
@@ -20,7 +20,7 @@ Create rules to install the listed programs into the given directory.
Use the ``FILES`` argument to guarantee that the file list version of the
command will be used even when there is only one argument.
::
.. code-block:: cmake
install_programs(<dir> regexp)
+1 -1
View File
@@ -8,7 +8,7 @@ install_targets
This command has been superseded by the :command:`install` command. It is
provided for compatibility with older CMake code.
::
.. code-block:: cmake
install_targets(<dir> [RUNTIME_DIRECTORY dir] target target)
+6
View File
@@ -53,3 +53,9 @@ The command will apply only to targets created after it is called.
where possible by using the :command:`target_link_directories` command
rather than ``link_directories()``. The target-specific command can also
control how the search directories propagate to other dependent targets.
See Also
^^^^^^^^
* :command:`target_link_directories`
* :command:`target_link_libraries`
+2 -2
View File
@@ -5,7 +5,7 @@ Disallowed since version 3.0. See CMake Policy :policy:`CMP0031`.
Load a command into a running CMake.
::
.. code-block:: cmake
load_command(COMMAND_NAME <loc1> [loc2 ...])
@@ -15,7 +15,7 @@ added to the set of available CMake commands. Usually,
:command:`try_compile` is used before this command to compile the
module. If the command is successfully loaded a variable named
::
.. code-block:: cmake
CMAKE_LOADED_COMMAND_<COMMAND_NAME>
+6
View File
@@ -149,3 +149,9 @@ existing variable instead of the arguments. For example:
Will loop over ``a;b;c`` and not over ``x;y;z`` as one might have expected.
If you want true CMake variables and/or better CMake scope control you
should look at the function command.
See Also
^^^^^^^^
* :command:`cmake_parse_arguments`
* :command:`endmacro`
+1 -1
View File
@@ -5,7 +5,7 @@ make_directory
Use the :command:`file(MAKE_DIRECTORY)` command instead.
::
.. code-block:: cmake
make_directory(directory)
+5
View File
@@ -193,3 +193,8 @@ Output from the above would appear something like the following::
-- Finding partB
-- Finding partB - not found
-- Finding my things - missing components: B
See Also
^^^^^^^^
* :command:`cmake_language(GET_MESSAGE_LOG_LEVEL)`
+1 -1
View File
@@ -9,7 +9,7 @@ This command exists only because ancient CMake versions provided it.
CMake handles preprocessor dependency scanning automatically using a
more advanced scanner.
::
.. code-block:: cmake
output_required_files(srcfile outputfile)
+1 -1
View File
@@ -5,7 +5,7 @@ remove
Use the :command:`list(REMOVE_ITEM)` command instead.
::
.. code-block:: cmake
remove(VAR VALUE VALUE ...)
+2 -1
View File
@@ -88,4 +88,5 @@ command. All arguments are ignored unless that policy is set to ``NEW``.
See Also
^^^^^^^^
* :command:`block`
* :command:`block`
* :command:`function`
+5
View File
@@ -111,3 +111,8 @@ environment variable.
Arguments after ``<value>`` are ignored. If extra arguments are found,
then an author warning is issued.
See Also
^^^^^^^^
* :command:`unset`
@@ -13,3 +13,10 @@ See also the :command:`set_property(DIRECTORY)` command.
See :ref:`Directory Properties` for the list of properties known to CMake
and their individual documentation for the behavior of each property.
See Also
^^^^^^^^
* :command:`define_property`
* :command:`get_directory_property`
* the more general :command:`set_property` command
+8 -3
View File
@@ -107,10 +107,15 @@ finding the initial value to append to. If the property is not already
directly set in the nominated scope, the command will behave as though
``APPEND`` or ``APPEND_STRING`` had not been given.
See the :manual:`cmake-properties(7)` manual for a list of properties
in each scope.
.. note::
The :prop_sf:`GENERATED` source file property may be globally visible.
See its documentation for details.
See Also
^^^^^^^^
* :command:`define_property`
* :command:`get_property`
* The :manual:`cmake-properties(7)` manual for a list of properties
in each scope.
+8 -3
View File
@@ -34,10 +34,15 @@ list.
Use :command:`get_source_file_property` to get property values.
See also the :command:`set_property(SOURCE)` command.
See :ref:`Source File Properties` for the list of properties known
to CMake.
.. note::
The :prop_sf:`GENERATED` source file property may be globally visible.
See its documentation for details.
See Also
^^^^^^^^
* :command:`define_property`
* :command:`get_source_file_property`
* :ref:`Source File Properties` for the list of properties known
to CMake
+6 -2
View File
@@ -15,6 +15,10 @@ 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`
command.
See also the :command:`set_property(TARGET)` command.
See Also
^^^^^^^^
See :ref:`Target Properties` for the list of properties known to CMake.
* :command:`define_property`
* :command:`get_target_property`
* the more general :command:`set_property` command
* :ref:`Target Properties` for the list of properties known to CMake
+6 -2
View File
@@ -14,6 +14,10 @@ Test property values may be specified using
:manual:`generator expressions <cmake-generator-expressions(7)>`
for tests created by the :command:`add_test(NAME)` signature.
See also the :command:`set_property(TEST)` command.
See Also
^^^^^^^^
See :ref:`Test Properties` for the list of properties known to CMake.
* :command:`add_test`
* :command:`define_property`
* the more general :command:`set_property` command
* :ref:`Target Properties` for the list of properties known to CMake
+1 -1
View File
@@ -5,7 +5,7 @@ Disallowed since version 3.0. See CMake Policy :policy:`CMP0029`.
Does nothing.
::
.. code-block:: cmake
subdir_depends(subdir dep1 dep2 ...)
+1 -1
View File
@@ -7,7 +7,7 @@ subdirs
Add a list of subdirectories to the build.
::
.. code-block:: cmake
subdirs(dir1 dir2 ...[EXCLUDE_FROM_ALL exclude_dir1 exclude_dir2 ...]
[PREORDER] )
+15 -4
View File
@@ -25,10 +25,8 @@ same ``<target>`` append items in the order called.
.. versionadded:: 3.11
Allow setting ``INTERFACE`` items on :ref:`IMPORTED targets <Imported Targets>`.
Arguments to ``target_compile_definitions`` may use "generator expressions"
with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
.. |command_name| replace:: ``target_compile_definitions``
.. include:: GENEX_NOTE.txt
Any leading ``-D`` on an item will be removed. Empty items are ignored.
For example, the following are all equivalent:
@@ -48,3 +46,16 @@ Definitions may optionally have values:
Note that many compilers treat ``-DFOO`` as equivalent to ``-DFOO=1``, but
other tools may not recognize this in all circumstances (e.g. IntelliSense).
See Also
^^^^^^^^
* :command:`add_compile_definitions`
* :command:`target_compile_features`
* :command:`target_compile_options`
* :command:`target_include_directories`
* :command:`target_link_libraries`
* :command:`target_link_directories`
* :command:`target_link_options`
* :command:`target_precompile_headers`
* :command:`target_sources`
+17 -5
View File
@@ -30,8 +30,20 @@ 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>`.
Arguments to ``target_compile_features`` may use "generator expressions"
with the syntax ``$<...>``.
See the :manual:`cmake-generator-expressions(7)` manual for available
expressions. See the :manual:`cmake-compile-features(7)` manual for
information on compile features and a list of supported compilers.
.. |command_name| replace:: ``target_compile_features``
.. |more_see_also| replace:: See the :manual:`cmake-compile-features(7)`
manual for information on compile features and a list of supported compilers.
.. include:: GENEX_NOTE.txt
:start-line: 1
See Also
^^^^^^^^
* :command:`target_compile_definitions`
* :command:`target_compile_options`
* :command:`target_include_directories`
* :command:`target_link_libraries`
* :command:`target_link_directories`
* :command:`target_link_options`
* :command:`target_precompile_headers`
* :command:`target_sources`
+15 -10
View File
@@ -32,21 +32,26 @@ The following arguments specify compile options. Repeated calls for the same
.. versionadded:: 3.11
Allow setting ``INTERFACE`` items on :ref:`IMPORTED targets <Imported Targets>`.
Arguments to ``target_compile_options`` may use "generator expressions"
with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
.. |command_name| replace:: ``target_compile_options``
.. include:: GENEX_NOTE.txt
.. include:: OPTIONS_SHELL.txt
See Also
^^^^^^^^
This command can be used to add any options. However, for adding
preprocessor definitions and include directories it is recommended
to use the more specific commands :command:`target_compile_definitions`
and :command:`target_include_directories`.
* This command can be used to add any options. However, for adding
preprocessor definitions and include directories it is recommended
to use the more specific commands :command:`target_compile_definitions`
and :command:`target_include_directories`.
For directory-wide settings, there is the command :command:`add_compile_options`.
* For directory-wide settings, there is the command :command:`add_compile_options`.
For file-specific settings, there is the source file property :prop_sf:`COMPILE_OPTIONS`.
* For file-specific settings, there is the source file property :prop_sf:`COMPILE_OPTIONS`.
* :command:`target_compile_features`
* :command:`target_link_libraries`
* :command:`target_link_directories`
* :command:`target_link_options`
* :command:`target_precompile_headers`
* :command:`target_sources`
+15 -4
View File
@@ -40,10 +40,8 @@ If ``SYSTEM`` is used together with ``PUBLIC`` or ``INTERFACE``, the
:prop_tgt:`INTERFACE_SYSTEM_INCLUDE_DIRECTORIES` target property will be
populated with the specified directories.
Arguments to ``target_include_directories`` may use "generator expressions"
with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
.. |command_name| replace:: ``target_include_directories``
.. include:: GENEX_NOTE.txt
Specified include directories may be absolute paths or relative paths.
A relative path will be interpreted as relative to the current source
@@ -74,3 +72,16 @@ Creating Relocatable Packages
.. |INTERFACE_PROPERTY_LINK| replace:: :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`
.. include:: /include/INTERFACE_INCLUDE_DIRECTORIES_WARNING.txt
See Also
^^^^^^^^
* :command:`include_directories`
* :command:`target_compile_definitions`
* :command:`target_compile_features`
* :command:`target_compile_options`
* :command:`target_link_libraries`
* :command:`target_link_directories`
* :command:`target_link_options`
* :command:`target_precompile_headers`
* :command:`target_sources`
+15 -4
View File
@@ -34,10 +34,8 @@ calls for the same ``<target>`` append items in the order called.
If ``BEFORE`` is specified, the content will be prepended to the relevant
property instead of being appended.
Arguments to ``target_link_directories`` may use "generator expressions"
with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
.. |command_name| replace:: ``target_link_directories``
.. include:: GENEX_NOTE.txt
.. note::
@@ -56,3 +54,16 @@ manual for more on defining buildsystem properties.
that expect to be found via ``RPATH`` mechanisms, but some linkers
are not able to fully decode those paths (e.g. due to the presence
of things like ``$ORIGIN``).
See Also
^^^^^^^^
* :command:`link_directories`
* :command:`target_compile_definitions`
* :command:`target_compile_features`
* :command:`target_compile_options`
* :command:`target_include_directories`
* :command:`target_link_libraries`
* :command:`target_link_options`
* :command:`target_precompile_headers`
* :command:`target_sources`
+14 -2
View File
@@ -293,8 +293,8 @@ will be included in the link too.
.. _`Linking Object Libraries via $<TARGET_OBJECTS>`:
Linking Object Libraries via $<TARGET_OBJECTS>
""""""""""""""""""""""""""""""""""""""""""""""
Linking Object Libraries via ``$<TARGET_OBJECTS>``
""""""""""""""""""""""""""""""""""""""""""""""""""
.. versionadded:: 3.21
@@ -407,3 +407,15 @@ Creating Relocatable Packages
.. |INTERFACE_PROPERTY_LINK| replace:: :prop_tgt:`INTERFACE_LINK_LIBRARIES`
.. include:: /include/INTERFACE_LINK_LIBRARIES_WARNING.txt
See Also
^^^^^^^^
* :command:`target_compile_definitions`
* :command:`target_compile_features`
* :command:`target_compile_options`
* :command:`target_include_directories`
* :command:`target_link_directories`
* :command:`target_link_options`
* :command:`target_precompile_headers`
* :command:`target_sources`
+14 -4
View File
@@ -42,13 +42,23 @@ The following arguments specify link options. Repeated calls for the same
.. note::
:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.
Arguments to ``target_link_options`` may use "generator expressions"
with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
.. |command_name| replace:: ``target_link_options``
.. include:: GENEX_NOTE.txt
.. include:: DEVICE_LINK_OPTIONS.txt
.. include:: OPTIONS_SHELL.txt
.. include:: LINK_OPTIONS_LINKER.txt
See Also
^^^^^^^^
* :command:`target_compile_definitions`
* :command:`target_compile_features`
* :command:`target_compile_options`
* :command:`target_include_directories`
* :command:`target_link_libraries`
* :command:`target_link_directories`
* :command:`target_precompile_headers`
* :command:`target_sources`
+23 -15
View File
@@ -70,17 +70,16 @@ included by absolute path. For example:
<unordered_map>
)
Arguments to ``target_precompile_headers()`` may use "generator expressions"
with the syntax ``$<...>``.
See the :manual:`cmake-generator-expressions(7)` manual for available
expressions.
The :genex:`$<COMPILE_LANGUAGE:...>` generator expression is particularly
useful for specifying a language-specific header to precompile for
only one language (e.g. ``CXX`` and not ``C``). In this case, header
file names that are not explicitly in double quotes or angle brackets
must be specified by absolute path. Also, when specifying angle brackets
inside a generator expression, be sure to encode the closing ``>`` as
``$<ANGLE-R>``. For example:
.. |command_name| replace:: ``target_compile_features``
.. |more_see_also| replace:: The :genex:`$<COMPILE_LANGUAGE:...>` generator
expression is particularly useful for specifying a language-specific header
to precompile for only one language (e.g. ``CXX`` and not ``C``). In this
case, header file names that are not explicitly in double quotes or angle
brackets must be specified by absolute path. Also, when specifying angle
brackets inside a generator expression, be sure to encode the closing
``>`` as :genex:`$<ANGLE-R>`. For example:
.. include:: GENEX_NOTE.txt
:start-line: 1
.. code-block:: cmake
@@ -118,8 +117,17 @@ the ``REUSE_FROM`` form is used.
See Also
^^^^^^^^
To disable precompile headers for specific targets, see the
:prop_tgt:`DISABLE_PRECOMPILE_HEADERS` target property.
* To disable precompile headers for specific targets, see the
:prop_tgt:`DISABLE_PRECOMPILE_HEADERS` target property.
To prevent precompile headers from being used when compiling a specific
source file, see the :prop_sf:`SKIP_PRECOMPILE_HEADERS` source file property.
* To prevent precompile headers from being used when compiling a specific
source file, see the :prop_sf:`SKIP_PRECOMPILE_HEADERS` source file property.
* :command:`target_compile_definitions`
* :command:`target_compile_features`
* :command:`target_compile_options`
* :command:`target_include_directories`
* :command:`target_link_libraries`
* :command:`target_link_directories`
* :command:`target_link_options`
* :command:`target_sources`
+14
View File
@@ -202,3 +202,17 @@ Target properties related to include directories are also modified by
of the file set is ``INTERFACE`` or ``PUBLIC``, all of the ``BASE_DIRS`` of
the file set are wrapped in :genex:`$<BUILD_INTERFACE>` and appended to this
property.
See Also
^^^^^^^^
* :command:`add_executable`
* :command:`add_library`
* :command:`target_compile_definitions`
* :command:`target_compile_features`
* :command:`target_compile_options`
* :command:`target_include_directories`
* :command:`target_link_libraries`
* :command:`target_link_directories`
* :command:`target_link_options`
* :command:`target_precompile_headers`
+8 -3
View File
@@ -105,9 +105,9 @@ contain something like the following:
CMake automatically generates, for each ``try_compile`` operation, a
unique directory under ``${CMAKE_BINARY_DIR}/CMakeFiles/CMakeScratch``
with an unspecified name. These directories are cleaned automatically unless
:option:`--debug-trycompile <cmake --debug-trycompile>` is passed to ``cmake``.
:option:`--debug-trycompile <cmake --debug-trycompile>` is passed to :program:`cmake`.
Such directories from previous runs are also unconditionally cleaned at the
beginning of any ``cmake`` execution.
beginning of any :program:`cmake` execution.
This command also supports an alternate signature
which was present in older versions of CMake:
@@ -130,7 +130,7 @@ which was present in older versions of CMake:
In this version, ``try_compile`` will use ``<bindir>/CMakeFiles/CMakeTmp`` for
its operation, and all such files will be cleaned automatically.
For debugging, :option:`--debug-trycompile <cmake --debug-trycompile>` can be
passed to ``cmake`` to avoid this clean. However, multiple sequential
passed to :program:`cmake` to avoid this clean. However, multiple sequential
``try_compile`` operations, if given the same ``<bindir>``, will reuse this
single output directory, such that you can only debug one such ``try_compile``
call at a time. Use of the newer signature is recommended to simplify
@@ -327,3 +327,8 @@ a build configuration.
If :policy:`CMP0141` is set to ``NEW``, one can use
:variable:`CMAKE_MSVC_DEBUG_INFORMATION_FORMAT` to specify the MSVC debug
information format.
See Also
^^^^^^^^
* :command:`try_run`
+5
View File
@@ -39,3 +39,8 @@ Subsequent calls of ``$ENV{<variable>}`` will return the empty string.
This command affects only the current CMake process, not the process
from which CMake was called, nor the system environment at large,
nor the environment of subsequent build or test processes.
See Also
^^^^^^^^
* :command:`set`
+1 -1
View File
@@ -5,7 +5,7 @@ Disallowed since version 3.0. See CMake Policy :policy:`CMP0030`.
Copy mesa headers for use in combination with system GL.
::
.. code-block:: cmake
use_mangled_mesa(PATH_TO_MESA OUTPUT_DIRECTORY)
+1 -1
View File
@@ -5,7 +5,7 @@ Disallowed since version 3.0. See CMake Policy :policy:`CMP0034`.
Specify the source tree of a third-party utility.
::
.. code-block:: cmake
utility_source(cache_entry executable_name
path_to_source [file1 file2 ...])
+1 -1
View File
@@ -7,7 +7,7 @@ Use the :command:`if` command instead.
Assert satisfaction of an option's required variables.
::
.. code-block:: cmake
variable_requires(TEST_VARIABLE RESULT_VARIABLE
REQUIRED_VARIABLE1
+4 -4
View File
@@ -27,7 +27,7 @@ If used, it must be a verbatim repeat of the argument of the opening
See Also
^^^^^^^^
* :command:`break`
* :command:`continue`
* :command:`foreach`
* :command:`endwhile`
* :command:`break`
* :command:`continue`
* :command:`foreach`
* :command:`endwhile`
+1 -1
View File
@@ -5,7 +5,7 @@ write_file
Use the :command:`file(WRITE)` command instead.
::
.. code-block:: cmake
write_file(filename "message to write"... [APPEND])