summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2022-03-05 06:33:18 (GMT)
committerCraig Scott <craig.scott@crascit.com>2022-03-05 06:33:36 (GMT)
commitab1b573f4179d8b04757f1bbd0fc3bc098d69712 (patch)
tree56b0525b061488a3aa6bfb4f97fbc3095a45e383 /Help
parent65da32c924e97ad1e0e0ed0ea59644f87f770c34 (diff)
downloadCMake-ab1b573f4179d8b04757f1bbd0fc3bc098d69712.zip
CMake-ab1b573f4179d8b04757f1bbd0fc3bc098d69712.tar.gz
CMake-ab1b573f4179d8b04757f1bbd0fc3bc098d69712.tar.bz2
Help: Reorganise FILE_SETS and related properties
Reduce duplication and make the docs for target_sources() focus on the functionality rather than the properties it modifies. The properties are a lower level quantity, so put the relevant details for them in the property documentation. The target_sources() command only needs to reference the properties, not reproduce the property documentation. Improve the cross-referencing between the HEADER_... property docs. This helps build the mental picture of how they relate to each other.
Diffstat (limited to 'Help')
-rw-r--r--Help/command/target_sources.rst96
-rw-r--r--Help/prop_tgt/HEADER_DIRS.rst12
-rw-r--r--Help/prop_tgt/HEADER_DIRS_NAME.rst13
-rw-r--r--Help/prop_tgt/HEADER_SET.rst15
-rw-r--r--Help/prop_tgt/HEADER_SETS.rst14
-rw-r--r--Help/prop_tgt/HEADER_SET_NAME.rst15
-rw-r--r--Help/prop_tgt/INTERFACE_HEADER_SETS.rst11
7 files changed, 99 insertions, 77 deletions
diff --git a/Help/command/target_sources.rst b/Help/command/target_sources.rst
index 3f8fdd9..6ad86e3 100644
--- a/Help/command/target_sources.rst
+++ b/Help/command/target_sources.rst
@@ -91,73 +91,59 @@ Each ``target_sources(FILE_SET)`` entry starts with ``INTERFACE``, ``PUBLIC``, o
``FILE_SET <set>``
- A string representing the name of the file set to create or add to. This must
- contain only numbers, letters, and underscores, and must not start with a
- capital letter or underscore, unless its name is ``HEADERS``.
+ The name of the file set to create or add to. It must contain only letters,
+ numbers and underscores. Names starting with a capital letter are reserved
+ for built-in file sets predefined by CMake. The only predefined set name is
+ ``HEADERS``. All other set names must not start with a capital letter or
+ underscore.
``TYPE <type>``
- A string representing the type of the file set. The only acceptable value is
- ``HEADERS``. This may be omitted if the name of the file set is ``HEADERS``.
+ Every file set is associated with a particular type of file. ``HEADERS``
+ is currently the only defined type and it is an error to specify anything
+ else. As a special case, if the name of the file set is ``HEADERS``, the
+ type does not need to be specified and the ``TYPE <type>`` arguments can be
+ omitted. For all other file set names, ``TYPE`` is required.
-``BASE_DIRS <dirs>``
+``BASE_DIRS <dirs>...``
- An optional list of strings representing the base directories of the file
- set. This argument supports
- :manual:`generator expressions <cmake-generator-expressions(7)>`. No two
- ``BASE_DIRS`` may be sub-directories of each other. If no ``BASE_DIRS`` are
+ An optional list of base directories of the file set. Any relative path
+ is treated as relative to the current source directory
+ (i.e. :variable:`CMAKE_CURRENT_SOURCE_DIR`). If no ``BASE_DIRS`` are
specified when the file set is first created, the value of
- :variable:`CMAKE_CURRENT_SOURCE_DIR` is added.
-
-``FILES <files>``
-
- An optional list of strings representing files in the file set. Each file
- must be in one of the ``BASE_DIRS``. This argument supports
- :manual:`generator expressions <cmake-generator-expressions(7)>`. If relative
- paths are specified, they are considered relative to
- :variable:`CMAKE_CURRENT_SOURCE_DIR` at the time ``target_sources()`` is
- called, unless they start with ``$<``, in which case they are computed
- relative to the target's source directory after genex evaluation.
-
-The following target properties are set by ``target_sources(FILE_SET)``:
-
-:prop_tgt:`HEADER_SETS`
-
- List of ``PRIVATE`` and ``PUBLIC`` header sets associated with a target.
- Headers listed in these header sets are treated as source files for the
- purposes of IDE integration, and have their :prop_sf:`HEADER_FILE_ONLY`
- property set to ``TRUE``.
-
-:prop_tgt:`INTERFACE_HEADER_SETS`
-
- List of ``INTERFACE`` and ``PUBLIC`` header sets associated with a target.
- Headers listed in these header sets can be installed with
- :command:`install(TARGETS)` and exported with :command:`install(EXPORT)` and
- :command:`export`.
-
-:prop_tgt:`HEADER_SET`
-
- Headers in the default header set associated with a target. This property
- supports :manual:`generator expressions <cmake-generator-expressions(7)>`.
-
-:prop_tgt:`HEADER_SET_<NAME>`
-
- Headers in the named header set ``<NAME>`` associated with a target. This
- property supports
+ :variable:`CMAKE_CURRENT_SOURCE_DIR` is added. This argument supports
:manual:`generator expressions <cmake-generator-expressions(7)>`.
-:prop_tgt:`HEADER_DIRS`
+ No two base directories for a file set may be sub-directories of each other.
+ This requirement must be met across all base directories added to a file set,
+ not just those within a single call to ``target_sources()``.
- Base directories of the default header set associated with a target. This
- property supports
- :manual:`generator expressions <cmake-generator-expressions(7)>`.
-
-:prop_tgt:`HEADER_DIRS_<NAME>`
+``FILES <files>...``
- Base directories of the header set ``<NAME>`` associated with a target. This
- property supports
+ An optional list of files to add to the file set. Each file must be in
+ one of the base directories, or a subdirectory of one of the base
+ directories. This argument supports
:manual:`generator expressions <cmake-generator-expressions(7)>`.
+ If relative paths are specified, they are considered relative to
+ :variable:`CMAKE_CURRENT_SOURCE_DIR` at the time ``target_sources()`` is
+ called. An exception to this is a path starting with ``$<``. Such paths
+ are treated as relative to the target's source directory after evaluation
+ of generator expressions.
+
+The following target properties are set by ``target_sources(FILE_SET)``,
+but they should not generally be manipulated directly:
+
+* :prop_tgt:`HEADER_SETS`
+* :prop_tgt:`INTERFACE_HEADER_SETS`
+* :prop_tgt:`HEADER_SET`
+* :prop_tgt:`HEADER_SET_<NAME>`
+* :prop_tgt:`HEADER_DIRS`
+* :prop_tgt:`HEADER_DIRS_<NAME>`
+
+Target properties related to include directories are also modified by
+``target_sources(FILE_SET)`` as follows:
+
:prop_tgt:`INCLUDE_DIRECTORIES`
If the ``TYPE`` is ``HEADERS``, and the scope of the file set is ``PRIVATE``
diff --git a/Help/prop_tgt/HEADER_DIRS.rst b/Help/prop_tgt/HEADER_DIRS.rst
index 6cdd4f1..d095345 100644
--- a/Help/prop_tgt/HEADER_DIRS.rst
+++ b/Help/prop_tgt/HEADER_DIRS.rst
@@ -3,6 +3,12 @@ HEADER_DIRS
.. versionadded:: 3.23
-Semicolon-separated list of base directories of the default header set created
-by :command:`target_sources(FILE_SET)`. This property supports
-:manual:`generator expressions <cmake-generator-expressions(7)>`.
+Semicolon-separated list of base directories of the target's default
+header set (i.e. the file set with name and type ``HEADERS``). The property
+supports :manual:`generator expressions <cmake-generator-expressions(7)>`.
+
+This property is normally only set by :command:`target_sources(FILE_SET)`
+rather than being manipulated directly.
+
+See :prop_tgt:`HEADER_DIRS_<NAME>` for the list of base directories in
+other header sets.
diff --git a/Help/prop_tgt/HEADER_DIRS_NAME.rst b/Help/prop_tgt/HEADER_DIRS_NAME.rst
index 7d282e5..dc73df7 100644
--- a/Help/prop_tgt/HEADER_DIRS_NAME.rst
+++ b/Help/prop_tgt/HEADER_DIRS_NAME.rst
@@ -3,6 +3,13 @@ HEADER_DIRS_<NAME>
.. versionadded:: 3.23
-Semicolon-separated list of base directories of the header set with name
-``<NAME>`` created by :command:`target_sources(FILE_SET)`. This property
-supports :manual:`generator expressions <cmake-generator-expressions(7)>`.
+Semicolon-separated list of base directories of the target's ``<NAME>``
+header set, which has the set type ``HEADERS``. The property supports
+:manual:`generator expressions <cmake-generator-expressions(7)>`.
+
+This property is normally only set by :command:`target_sources(FILE_SET)`
+rather than being manipulated directly.
+
+See :prop_tgt:`HEADER_DIRS` for the list of base directories in the
+default header set. See :prop_tgt:`HEADER_SETS` for the file set names of all
+header sets.
diff --git a/Help/prop_tgt/HEADER_SET.rst b/Help/prop_tgt/HEADER_SET.rst
index eee834f..a703fc1 100644
--- a/Help/prop_tgt/HEADER_SET.rst
+++ b/Help/prop_tgt/HEADER_SET.rst
@@ -3,8 +3,13 @@ HEADER_SET
.. versionadded:: 3.23
-Semicolon-separated list of headers in the default header set created by
-:command:`target_sources(FILE_SET)`. This property supports
-:manual:`generator expressions <cmake-generator-expressions(7)>`. If any of the
-headers are relative paths, they are computed relative to the target's source
-directory.
+Semicolon-separated list of files in the target's default header set,
+(i.e. the file set with name and type ``HEADERS``). If any of the paths
+are relative, they are computed relative to the target's source directory.
+The property supports
+:manual:`generator expressions <cmake-generator-expressions(7)>`.
+
+This property is normally only set by :command:`target_sources(FILE_SET)`
+rather than being manipulated directly.
+
+See :prop_tgt:`HEADER_SET_<NAME>` for the list of files in other header sets.
diff --git a/Help/prop_tgt/HEADER_SETS.rst b/Help/prop_tgt/HEADER_SETS.rst
index d07763b..fcf723e 100644
--- a/Help/prop_tgt/HEADER_SETS.rst
+++ b/Help/prop_tgt/HEADER_SETS.rst
@@ -3,6 +3,14 @@ HEADER_SETS
.. versionadded:: 3.23
-List of ``PRIVATE`` and ``PUBLIC`` header sets added by
-:command:`target_sources(FILE_SET)`. Headers listed in these header sets are
-treated as source files for the purposes of IDE integration.
+List of the target's ``PRIVATE`` and ``PUBLIC`` header sets (i.e. all
+file sets with the type ``HEADERS``). Files listed in these file sets
+are treated as source files for the purpose of IDE integration.
+The files also have their :prop_sf:`HEADER_FILE_ONLY` property set to
+``TRUE``.
+
+This property is normally only set by :command:`target_sources(FILE_SET)`
+rather than being manipulated directly.
+
+See also :prop_tgt:`HEADER_SET_<NAME>`, :prop_tgt:`HEADER_SET` and
+:prop_tgt:`INTERFACE_HEADER_SETS`.
diff --git a/Help/prop_tgt/HEADER_SET_NAME.rst b/Help/prop_tgt/HEADER_SET_NAME.rst
index 3405690..e537f5a 100644
--- a/Help/prop_tgt/HEADER_SET_NAME.rst
+++ b/Help/prop_tgt/HEADER_SET_NAME.rst
@@ -3,8 +3,13 @@ HEADER_SET_<NAME>
.. versionadded:: 3.23
-Semicolon-separated list of headers in the named header set ``<NAME>`` created
-by :command:`target_sources(FILE_SET)`. This property supports
-:manual:`generator expressions <cmake-generator-expressions(7)>`. If any of the
-headers are relative paths, they are computed relative to the target's source
-directory.
+Semicolon-separated list of files in the target's ``<NAME>`` header set,
+which has the set type ``HEADERS``. If any of the paths are relative,
+they are computed relative to the target's source directory. The property
+supports :manual:`generator expressions <cmake-generator-expressions(7)>`.
+
+This property is normally only set by :command:`target_sources(FILE_SET)`
+rather than being manipulated directly.
+
+See :prop_tgt:`HEADER_SET` for the list of files in the default header set.
+See :prop_tgt:`HEADER_SETS` for the file set names of all header sets.
diff --git a/Help/prop_tgt/INTERFACE_HEADER_SETS.rst b/Help/prop_tgt/INTERFACE_HEADER_SETS.rst
index 909510d..62db5b3 100644
--- a/Help/prop_tgt/INTERFACE_HEADER_SETS.rst
+++ b/Help/prop_tgt/INTERFACE_HEADER_SETS.rst
@@ -3,7 +3,12 @@ INTERFACE_HEADER_SETS
.. versionadded:: 3.23
-List of ``INTERFACE`` and ``PUBLIC`` header sets added by
-:command:`target_sources(FILE_SET)`. Headers listed in these header sets can be
-installed with :command:`install(TARGETS)` and exported with
+List of the target's ``INTERFACE`` and ``PUBLIC`` header sets (i.e. all
+file sets with the type ``HEADERS``). Files listed in these header sets
+can be installed with :command:`install(TARGETS)` and exported with
:command:`install(EXPORT)` and :command:`export`.
+
+This property is normally only set by :command:`target_sources(FILE_SET)`
+rather than being manipulated directly.
+
+See also :prop_tgt:`HEADER_SETS`.