Merge topic 'cuda-archs'
92854bf29e CUDA: Update arch selection, restructure for maintainability
a58a572459 CUDA: Add arch selection debug mode to print out CUDA versions
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Raul Tambre <raul@tambre.ee>
Merge-request: !5719
diff --git a/Help/dev/documentation.rst b/Help/dev/documentation.rst
index c302790..29fc880 100644
--- a/Help/dev/documentation.rst
+++ b/Help/dev/documentation.rst
@@ -123,10 +123,23 @@
``command``
A CMake language command.
+``cpack_gen``
+ A CPack package generator.
+ See the `cpack(1)`_ command-line tool's ``-G`` option.
+
+``envvar``
+ An environment variable.
+ See the `cmake-env-variables(7)`_ manual
+ and the `set()`_ command.
+
``generator``
A CMake native build system generator.
See the `cmake(1)`_ command-line tool's ``-G`` option.
+``genex``
+ A CMake generator expression.
+ See the `cmake-generator-expressions(7)`_ manual.
+
``manual``
A CMake manual page, like the `cmake(1)`_ manual.
@@ -160,10 +173,12 @@
-------------
and to appear at or near the top of the ``.rst`` file before any other
-lines starting in a letter, digit, or ``<``. If no such title appears
+lines starting in a letter, digit, ``<``, or ``$``. If no such title appears
literally in the ``.rst`` file, the object name is the ``<file-name>``.
If a title does appear, it is expected that ``<file-name>`` is equal
-to ``<object-name>`` with any ``<`` and ``>`` characters removed.
+to ``<object-name>`` with any ``<`` and ``>`` characters removed,
+or in the case of a ``$<genex-name>`` or ``$<genex-name:...>``, the
+``genex-name``.
Second, the CMake Domain provides directives to define objects inside
other documents:
@@ -174,6 +189,14 @@
This indented block documents <command-name>.
+ .. envvar:: <envvar-name>
+
+ This indented block documents <envvar-name>.
+
+ .. genex:: <genex-name>
+
+ This indented block documents <genex-name>.
+
.. variable:: <variable-name>
This indented block documents <variable-name>.
@@ -183,11 +206,14 @@
.. _`Sphinx Domain`: http://sphinx-doc.org/domains.html
.. _`cmake(1)`: https://cmake.org/cmake/help/latest/manual/cmake.1.html
+.. _`cmake-env-variables(7)`: https://cmake.org/cmake/help/latest/manual/cmake-env-variables.7.html
+.. _`cmake-generator-expressions(7)`: https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html
.. _`cmake-modules(7)`: https://cmake.org/cmake/help/latest/manual/cmake-modules.7.html
.. _`cmake-policies(7)`: https://cmake.org/cmake/help/latest/manual/cmake-policies.7.html
.. _`cmake-properties(7)`: https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html
.. _`cmake-variables(7)`: https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html
.. _`cmake_policy()`: https://cmake.org/cmake/help/latest/command/cmake_policy.html
+.. _`cpack(1)`: https://cmake.org/cmake/help/latest/manual/cpack.1.html
.. _`include()`: https://cmake.org/cmake/help/latest/command/include.html
.. _`set()`: https://cmake.org/cmake/help/latest/command/set.html
.. _`set_property()`: https://cmake.org/cmake/help/latest/command/set_property.html
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index c949ce1..ca4ea3e 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -46,7 +46,8 @@
Logical Operators
-----------------
-``$<BOOL:string>``
+.. genex:: $<BOOL:string>
+
Converts ``string`` to ``0`` or ``1``. Evaluates to ``0`` if any of the
following is true:
@@ -57,23 +58,27 @@
Otherwise evaluates to ``1``.
-``$<AND:conditions>``
+.. genex:: $<AND:conditions>
+
where ``conditions`` is a comma-separated list of boolean expressions.
Evaluates to ``1`` if all conditions are ``1``.
Otherwise evaluates to ``0``.
-``$<OR:conditions>``
+.. genex:: $<OR:conditions>
+
where ``conditions`` is a comma-separated list of boolean expressions.
Evaluates to ``1`` if at least one of the conditions is ``1``.
Otherwise evaluates to ``0``.
-``$<NOT:condition>``
+.. genex:: $<NOT:condition>
+
``0`` if ``condition`` is ``1``, else ``1``.
String Comparisons
------------------
-``$<STREQUAL:string1,string2>``
+.. genex:: $<STREQUAL:string1,string2>
+
``1`` if ``string1`` and ``string2`` are equal, else ``0``.
The comparison is case-sensitive. For a case-insensitive comparison,
combine with a :ref:`string transforming generator expression
@@ -83,101 +88,150 @@
$<STREQUAL:$<UPPER_CASE:${foo}>,"BAR"> # "1" if ${foo} is any of "BAR", "Bar", "bar", ...
-``$<EQUAL:value1,value2>``
+.. genex:: $<EQUAL:value1,value2>
+
``1`` if ``value1`` and ``value2`` are numerically equal, else ``0``.
-``$<IN_LIST:string,list>``
+
+.. genex:: $<IN_LIST:string,list>
+
``1`` if ``string`` is member of the semicolon-separated ``list``, else ``0``.
Uses case-sensitive comparisons.
-``$<VERSION_LESS:v1,v2>``
- ``1`` if ``v1`` is a version less than ``v2``, else ``0``.
-``$<VERSION_GREATER:v1,v2>``
- ``1`` if ``v1`` is a version greater than ``v2``, else ``0``.
-``$<VERSION_EQUAL:v1,v2>``
- ``1`` if ``v1`` is the same version as ``v2``, else ``0``.
-``$<VERSION_LESS_EQUAL:v1,v2>``
- ``1`` if ``v1`` is a version less than or equal to ``v2``, else ``0``.
-``$<VERSION_GREATER_EQUAL:v1,v2>``
- ``1`` if ``v1`` is a version greater than or equal to ``v2``, else ``0``.
+.. genex:: $<VERSION_LESS:v1,v2>
+
+ ``1`` if ``v1`` is a version less than ``v2``, else ``0``.
+
+.. genex:: $<VERSION_GREATER:v1,v2>
+
+ ``1`` if ``v1`` is a version greater than ``v2``, else ``0``.
+
+.. genex:: $<VERSION_EQUAL:v1,v2>
+
+ ``1`` if ``v1`` is the same version as ``v2``, else ``0``.
+
+.. genex:: $<VERSION_LESS_EQUAL:v1,v2>
+
+ ``1`` if ``v1`` is a version less than or equal to ``v2``, else ``0``.
+
+.. genex:: $<VERSION_GREATER_EQUAL:v1,v2>
+
+ ``1`` if ``v1`` is a version greater than or equal to ``v2``, else ``0``.
Variable Queries
----------------
-``$<TARGET_EXISTS:target>``
+.. genex:: $<TARGET_EXISTS:target>
+
``1`` if ``target`` exists, else ``0``.
-``$<CONFIG:cfgs>``
+
+.. genex:: $<CONFIG:cfgs>
+
``1`` if config is any one of the entries in ``cfgs``, else ``0``. This is a
case-insensitive comparison. The mapping in
:prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` is also considered by this
expression when it is evaluated on a property on an :prop_tgt:`IMPORTED`
target.
-``$<PLATFORM_ID:platform_ids>``
+
+.. genex:: $<PLATFORM_ID:platform_ids>
+
where ``platform_ids`` is a comma-separated list.
``1`` if the CMake's platform id matches any one of the entries in
``platform_ids``, otherwise ``0``.
See also the :variable:`CMAKE_SYSTEM_NAME` variable.
-``$<C_COMPILER_ID:compiler_ids>``
+
+.. genex:: $<C_COMPILER_ID:compiler_ids>
+
where ``compiler_ids`` is a comma-separated list.
``1`` if the CMake's compiler id of the C compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-``$<CXX_COMPILER_ID:compiler_ids>``
+
+.. genex:: $<CXX_COMPILER_ID:compiler_ids>
+
where ``compiler_ids`` is a comma-separated list.
``1`` if the CMake's compiler id of the CXX compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-``$<CUDA_COMPILER_ID:compiler_ids>``
+
+.. genex:: $<CUDA_COMPILER_ID:compiler_ids>
+
where ``compiler_ids`` is a comma-separated list.
``1`` if the CMake's compiler id of the CUDA compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-``$<OBJC_COMPILER_ID:compiler_ids>``
+
+.. genex:: $<OBJC_COMPILER_ID:compiler_ids>
+
where ``compiler_ids`` is a comma-separated list.
``1`` if the CMake's compiler id of the Objective-C compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-``$<OBJCXX_COMPILER_ID:compiler_ids>``
+
+.. genex:: $<OBJCXX_COMPILER_ID:compiler_ids>
+
where ``compiler_ids`` is a comma-separated list.
``1`` if the CMake's compiler id of the Objective-C++ compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-``$<Fortran_COMPILER_ID:compiler_ids>``
+
+.. genex:: $<Fortran_COMPILER_ID:compiler_ids>
+
where ``compiler_ids`` is a comma-separated list.
``1`` if the CMake's compiler id of the Fortran compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-``$<ISPC_COMPILER_ID:compiler_ids>``
+
+.. genex:: $<ISPC_COMPILER_ID:compiler_ids>
+
where ``compiler_ids`` is a comma-separated list.
``1`` if the CMake's compiler id of the ISPC compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-``$<C_COMPILER_VERSION:version>``
+
+.. genex:: $<C_COMPILER_VERSION:version>
+
``1`` if the version of the C compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
-``$<CXX_COMPILER_VERSION:version>``
+
+.. genex:: $<CXX_COMPILER_VERSION:version>
+
``1`` if the version of the CXX compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
-``$<CUDA_COMPILER_VERSION:version>``
+
+.. genex:: $<CUDA_COMPILER_VERSION:version>
+
``1`` if the version of the CXX compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
-``$<OBJC_COMPILER_VERSION:version>``
+
+.. genex:: $<OBJC_COMPILER_VERSION:version>
+
``1`` if the version of the OBJC compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
-``$<OBJCXX_COMPILER_VERSION:version>``
+
+.. genex:: $<OBJCXX_COMPILER_VERSION:version>
+
``1`` if the version of the OBJCXX compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
-``$<Fortran_COMPILER_VERSION:version>``
+
+.. genex:: $<Fortran_COMPILER_VERSION:version>
+
``1`` if the version of the Fortran compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
-``$<ISPC_COMPILER_VERSION:version>``
+
+.. genex:: $<ISPC_COMPILER_VERSION:version>
+
``1`` if the version of the ISPC compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
-``$<TARGET_POLICY:policy>``
+
+.. genex:: $<TARGET_POLICY:policy>
+
``1`` if the ``policy`` was NEW when the 'head' target was created,
else ``0``. If the ``policy`` was not set, the warning message for the policy
will be emitted. This generator expression only works for a subset of
policies.
-``$<COMPILE_FEATURES:features>``
+
+.. genex:: $<COMPILE_FEATURES:features>
+
where ``features`` is a comma-spearated list.
Evaluates to ``1`` if all of the ``features`` are available for the 'head'
target, and ``0`` otherwise. If this expression is used while evaluating
@@ -189,7 +243,8 @@
.. _`Boolean COMPILE_LANGUAGE Generator Expression`:
-``$<COMPILE_LANG_AND_ID:language,compiler_ids>``
+.. genex:: $<COMPILE_LANG_AND_ID:language,compiler_ids>
+
``1`` when the language used for compilation unit matches ``language`` and
the CMake's compiler id of the language compiler matches any one of the
entries in ``compiler_ids``, otherwise ``0``. This expression is a short form
@@ -225,7 +280,8 @@
$<$<AND:$<COMPILE_LANGUAGE:C>,$<C_COMPILER_ID:Clang>>:COMPILING_C_WITH_CLANG>
)
-``$<COMPILE_LANGUAGE:languages>``
+.. genex:: $<COMPILE_LANGUAGE:languages>
+
``1`` when the language used for compilation unit matches any of the entries
in ``languages``, otherwise ``0``. This expression may be used to specify
compile options, compile definitions, and include directories for source files of a
@@ -270,7 +326,8 @@
.. _`Boolean LINK_LANGUAGE Generator Expression`:
-``$<LINK_LANG_AND_ID:language,compiler_ids>``
+.. genex:: $<LINK_LANG_AND_ID:language,compiler_ids>
+
``1`` when the language used for link step matches ``language`` and the
CMake's compiler id of the language linker matches any one of the entries
in ``compiler_ids``, otherwise ``0``. This expression is a short form for the
@@ -309,7 +366,8 @@
``$<LINK_LANGUAGE:language>`` for constraints about the usage of this
generator expression.
-``$<LINK_LANGUAGE:languages>``
+.. genex:: $<LINK_LANGUAGE:languages>
+
``1`` when the language used for link step matches any of the entries
in ``languages``, otherwise ``0``. This expression may be used to specify
link libraries, link options, link directories and link dependencies of a
@@ -371,14 +429,16 @@
evaluation will give ``C`` as link language, so the second pass will
correctly add target ``libother`` as link dependency.
-``$<DEVICE_LINK:list>``
+.. genex:: $<DEVICE_LINK:list>
+
Returns the list if it is the device link step, an empty list otherwise.
The device link step is controlled by :prop_tgt:`CUDA_SEPARABLE_COMPILATION`
and :prop_tgt:`CUDA_RESOLVE_DEVICE_SYMBOLS` properties and
policy :policy:`CMP0105`. This expression can only be used to specify link
options.
-``$<HOST_LINK:list>``
+.. genex:: $<HOST_LINK:list>
+
Returns the list if it is the normal link step, an empty list otherwise.
This expression is mainly useful when a device link step is also involved
(see ``$<DEVICE_LINK:list>`` generator expression). This expression can only
@@ -434,11 +494,16 @@
String literals to escape the special meaning a character would otherwise have:
-``$<ANGLE-R>``
+.. genex:: $<ANGLE-R>
+
A literal ``>``. Used for example to compare strings that contain a ``>``.
-``$<COMMA>``
+
+.. genex:: $<COMMA>
+
A literal ``,``. Used for example to compare strings which contain a ``,``.
-``$<SEMICOLON>``
+
+.. genex:: $<SEMICOLON>
+
A literal ``;``. Used to prevent list expansion on an argument with ``;``.
.. _`Conditional Generator Expressions`:
@@ -449,11 +514,13 @@
Conditional generator expressions depend on a boolean condition
that must be ``0`` or ``1``.
-``$<condition:true_string>``
+.. genex:: $<condition:true_string>
+
Evaluates to ``true_string`` if ``condition`` is ``1``.
Otherwise evaluates to the empty string.
-``$<IF:condition,true_string,false_string>``
+.. genex:: $<IF:condition,true_string,false_string>
+
Evaluates to ``true_string`` if ``condition`` is ``1``.
Otherwise evaluates to ``false_string``.
@@ -472,22 +539,34 @@
String Transformations
----------------------
-``$<JOIN:list,string>``
+.. genex:: $<JOIN:list,string>
+
Joins the list with the content of ``string``.
-``$<REMOVE_DUPLICATES:list>``
+
+.. genex:: $<REMOVE_DUPLICATES:list>
+
Removes duplicated items in the given ``list``.
-``$<FILTER:list,INCLUDE|EXCLUDE,regex>``
+
+.. genex:: $<FILTER:list,INCLUDE|EXCLUDE,regex>
+
Includes or removes items from ``list`` that match the regular expression ``regex``.
-``$<LOWER_CASE:string>``
+
+.. genex:: $<LOWER_CASE:string>
+
Content of ``string`` converted to lower case.
-``$<UPPER_CASE:string>``
+
+.. genex:: $<UPPER_CASE:string>
+
Content of ``string`` converted to upper case.
-``$<GENEX_EVAL:expr>``
+.. genex:: $<GENEX_EVAL:expr>
+
Content of ``expr`` evaluated as a generator expression in the current
context. This enables consumption of generator expressions whose
evaluation results itself in generator expressions.
-``$<TARGET_GENEX_EVAL:tgt,expr>``
+
+.. genex:: $<TARGET_GENEX_EVAL:tgt,expr>
+
Content of ``expr`` evaluated as a generator expression in the context of
``tgt`` target. This enables consumption of custom target properties that
themselves contain generator expressions.
@@ -526,62 +605,99 @@
Variable Queries
----------------
-``$<CONFIG>``
+.. genex:: $<CONFIG>
+
Configuration name.
-``$<CONFIGURATION>``
+
+.. genex:: $<CONFIGURATION>
+
Configuration name. Deprecated since CMake 3.0. Use ``CONFIG`` instead.
-``$<PLATFORM_ID>``
+
+.. genex:: $<PLATFORM_ID>
+
The current system's CMake platform id.
See also the :variable:`CMAKE_SYSTEM_NAME` variable.
-``$<C_COMPILER_ID>``
+
+.. genex:: $<C_COMPILER_ID>
+
The CMake's compiler id of the C compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-``$<CXX_COMPILER_ID>``
+
+.. genex:: $<CXX_COMPILER_ID>
+
The CMake's compiler id of the CXX compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-``$<CUDA_COMPILER_ID>``
+
+.. genex:: $<CUDA_COMPILER_ID>
+
The CMake's compiler id of the CUDA compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-``$<OBJC_COMPILER_ID>``
+
+.. genex:: $<OBJC_COMPILER_ID>
+
The CMake's compiler id of the OBJC compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-``$<OBJCXX_COMPILER_ID>``
+
+.. genex:: $<OBJCXX_COMPILER_ID>
+
The CMake's compiler id of the OBJCXX compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-``$<Fortran_COMPILER_ID>``
+
+.. genex:: $<Fortran_COMPILER_ID>
+
The CMake's compiler id of the Fortran compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-``$<ISPC_COMPILER_ID>``
+
+.. genex:: $<ISPC_COMPILER_ID>
+
The CMake's compiler id of the ISPC compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-``$<C_COMPILER_VERSION>``
+
+.. genex:: $<C_COMPILER_VERSION>
+
The version of the C compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
-``$<CXX_COMPILER_VERSION>``
+
+.. genex:: $<CXX_COMPILER_VERSION>
+
The version of the CXX compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
-``$<CUDA_COMPILER_VERSION>``
+
+.. genex:: $<CUDA_COMPILER_VERSION>
+
The version of the CUDA compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
-``$<OBJC_COMPILER_VERSION>``
+
+.. genex:: $<OBJC_COMPILER_VERSION>
+
The version of the OBJC compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
-``$<OBJCXX_COMPILER_VERSION>``
+
+.. genex:: $<OBJCXX_COMPILER_VERSION>
+
The version of the OBJCXX compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
-``$<Fortran_COMPILER_VERSION>``
+
+.. genex:: $<Fortran_COMPILER_VERSION>
+
The version of the Fortran compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
-``$<ISPC_COMPILER_VERSION>``
+
+.. genex:: $<ISPC_COMPILER_VERSION>
+
The version of the ISPC compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
-``$<COMPILE_LANGUAGE>``
+
+.. genex:: $<COMPILE_LANGUAGE>
+
The compile language of source files when evaluating compile options.
See :ref:`the related boolean expression
<Boolean COMPILE_LANGUAGE Generator Expression>`
``$<COMPILE_LANGUAGE:language>``
for notes about the portability of this generator expression.
-``$<LINK_LANGUAGE>``
+
+.. genex:: $<LINK_LANGUAGE>
+
The link language of target when evaluating link options.
See :ref:`the related boolean expression
<Boolean LINK_LANGUAGE Generator Expression>` ``$<LINK_LANGUAGE:language>``
@@ -608,14 +724,19 @@
binary file. This has to be distinguished from "the target name",
which is just the string ``tgt``.
-``$<TARGET_NAME_IF_EXISTS:tgt>``
+.. genex:: $<TARGET_NAME_IF_EXISTS:tgt>
+
The target name ``tgt`` if the target exists, an empty string otherwise.
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on.
-``$<TARGET_FILE:tgt>``
+
+.. genex:: $<TARGET_FILE:tgt>
+
Full path to the ``tgt`` binary file.
-``$<TARGET_FILE_BASE_NAME:tgt>``
+
+.. genex:: $<TARGET_FILE_BASE_NAME:tgt>
+
Base name of ``tgt``, i.e. ``$<TARGET_FILE_NAME:tgt>`` without prefix and
suffix.
For example, if the ``tgt`` filename is ``libbase.so``, the base name is ``base``.
@@ -632,36 +753,48 @@
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on.
-``$<TARGET_FILE_PREFIX:tgt>``
+
+.. genex:: $<TARGET_FILE_PREFIX:tgt>
+
Prefix of the ``tgt`` filename (such as ``lib``).
See also the :prop_tgt:`PREFIX` target property.
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on.
-``$<TARGET_FILE_SUFFIX:tgt>``
+
+.. genex:: $<TARGET_FILE_SUFFIX:tgt>
+
Suffix of the ``tgt`` filename (extension such as ``.so`` or ``.exe``).
See also the :prop_tgt:`SUFFIX` target property.
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on.
-``$<TARGET_FILE_NAME:tgt>``
+
+.. genex:: $<TARGET_FILE_NAME:tgt>
+
The ``tgt`` filename.
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`).
-``$<TARGET_FILE_DIR:tgt>``
+
+.. genex:: $<TARGET_FILE_DIR:tgt>
+
Directory of the ``tgt`` binary file.
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`).
-``$<TARGET_LINKER_FILE:tgt>``
+
+.. genex:: $<TARGET_LINKER_FILE:tgt>
+
File used when linking to the ``tgt`` target. This will usually
be the library that ``tgt`` represents (``.a``, ``.lib``, ``.so``),
but for a shared library on DLL platforms, it would be the ``.lib``
import library associated with the DLL.
-``$<TARGET_LINKER_FILE_BASE_NAME:tgt>``
+
+.. genex:: $<TARGET_LINKER_FILE_BASE_NAME:tgt>
+
Base name of file used to link the target ``tgt``, i.e.
``$<TARGET_LINKER_FILE_NAME:tgt>`` without prefix and suffix. For example,
if target file name is ``libbase.a``, the base name is ``base``.
@@ -677,7 +810,9 @@
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on.
-``$<TARGET_LINKER_FILE_PREFIX:tgt>``
+
+.. genex:: $<TARGET_LINKER_FILE_PREFIX:tgt>
+
Prefix of file used to link target ``tgt``.
See also the :prop_tgt:`PREFIX` and :prop_tgt:`IMPORT_PREFIX` target
@@ -685,7 +820,9 @@
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on.
-``$<TARGET_LINKER_FILE_SUFFIX:tgt>``
+
+.. genex:: $<TARGET_LINKER_FILE_SUFFIX:tgt>
+
Suffix of file used to link where ``tgt`` is the name of a target.
The suffix corresponds to the file extension (such as ".so" or ".lib").
@@ -695,36 +832,49 @@
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on.
-``$<TARGET_LINKER_FILE_NAME:tgt>``
+
+.. genex:: $<TARGET_LINKER_FILE_NAME:tgt>
+
Name of file used to link target ``tgt``.
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`).
-``$<TARGET_LINKER_FILE_DIR:tgt>``
+
+.. genex:: $<TARGET_LINKER_FILE_DIR:tgt>
+
Directory of file used to link target ``tgt``.
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`).
-``$<TARGET_SONAME_FILE:tgt>``
+
+.. genex:: $<TARGET_SONAME_FILE:tgt>
+
File with soname (``.so.3``) where ``tgt`` is the name of a target.
-``$<TARGET_SONAME_FILE_NAME:tgt>``
+.. genex:: $<TARGET_SONAME_FILE_NAME:tgt>
+
Name of file with soname (``.so.3``).
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`).
-``$<TARGET_SONAME_FILE_DIR:tgt>``
+
+.. genex:: $<TARGET_SONAME_FILE_DIR:tgt>
+
Directory of with soname (``.so.3``).
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`).
-``$<TARGET_PDB_FILE:tgt>``
+
+.. genex:: $<TARGET_PDB_FILE:tgt>
+
Full path to the linker generated program database file (.pdb)
where ``tgt`` is the name of a target.
See also the :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY`
target properties and their configuration specific variants
:prop_tgt:`PDB_NAME_<CONFIG>` and :prop_tgt:`PDB_OUTPUT_DIRECTORY_<CONFIG>`.
-``$<TARGET_PDB_FILE_BASE_NAME:tgt>``
+
+.. genex:: $<TARGET_PDB_FILE_BASE_NAME:tgt>
+
Base name of the linker generated program database file (.pdb)
where ``tgt`` is the name of a target.
@@ -740,23 +890,31 @@
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on.
-``$<TARGET_PDB_FILE_NAME:tgt>``
+
+.. genex:: $<TARGET_PDB_FILE_NAME:tgt>
+
Name of the linker generated program database file (.pdb).
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`).
-``$<TARGET_PDB_FILE_DIR:tgt>``
+
+.. genex:: $<TARGET_PDB_FILE_DIR:tgt>
+
Directory of the linker generated program database file (.pdb).
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`).
-``$<TARGET_BUNDLE_DIR:tgt>``
+
+.. genex:: $<TARGET_BUNDLE_DIR:tgt>
+
Full path to the bundle directory (``my.app``, ``my.framework``, or
``my.bundle``) where ``tgt`` is the name of a target.
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`).
-``$<TARGET_BUNDLE_CONTENT_DIR:tgt>``
+
+.. genex:: $<TARGET_BUNDLE_CONTENT_DIR:tgt>
+
Full path to the bundle content directory where ``tgt`` is the name of a
target. For the macOS SDK it leads to ``my.app/Contents``, ``my.framework``,
or ``my.bundle/Contents``. For all other SDKs (e.g. iOS) it leads to
@@ -765,17 +923,23 @@
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`).
-``$<TARGET_PROPERTY:tgt,prop>``
+
+.. genex:: $<TARGET_PROPERTY:tgt,prop>
+
Value of the property ``prop`` on the target ``tgt``.
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on.
-``$<TARGET_PROPERTY:prop>``
+
+.. genex:: $<TARGET_PROPERTY:prop>
+
Value of the property ``prop`` on the target for which the expression
is being evaluated. Note that for generator expressions in
:ref:`Target Usage Requirements` this is the consuming target rather
than the target specifying the requirement.
-``$<INSTALL_PREFIX>``
+
+.. genex:: $<INSTALL_PREFIX>
+
Content of the install prefix when the target is exported via
:command:`install(EXPORT)`, or when evaluated in
:prop_tgt:`INSTALL_NAME_DIR`, and empty otherwise.
@@ -783,30 +947,43 @@
Output-Related Expressions
--------------------------
-``$<TARGET_NAME:...>``
+.. genex:: $<TARGET_NAME:...>
+
Marks ``...`` as being the name of a target. This is required if exporting
targets to multiple dependent export sets. The ``...`` must be a literal
name of a target- it may not contain generator expressions.
-``$<LINK_ONLY:...>``
+
+.. genex:: $<LINK_ONLY:...>
+
Content of ``...`` except when evaluated in a link interface while
propagating :ref:`Target Usage Requirements`, in which case it is the
empty string.
Intended for use only in an :prop_tgt:`INTERFACE_LINK_LIBRARIES` target
property, perhaps via the :command:`target_link_libraries` command,
to specify private link dependencies without other usage requirements.
-``$<INSTALL_INTERFACE:...>``
+
+.. genex:: $<INSTALL_INTERFACE:...>
+
Content of ``...`` when the property is exported using :command:`install(EXPORT)`,
and empty otherwise.
-``$<BUILD_INTERFACE:...>``
+
+.. genex:: $<BUILD_INTERFACE:...>
+
Content of ``...`` when the property is exported using :command:`export`, or
when the target is used by another target in the same buildsystem. Expands to
the empty string otherwise.
-``$<MAKE_C_IDENTIFIER:...>``
+
+.. genex:: $<MAKE_C_IDENTIFIER:...>
+
Content of ``...`` converted to a C identifier. The conversion follows the
same behavior as :command:`string(MAKE_C_IDENTIFIER)`.
-``$<TARGET_OBJECTS:objLib>``
+
+.. genex:: $<TARGET_OBJECTS:objLib>
+
List of objects resulting from build of ``objLib``.
-``$<SHELL_PATH:...>``
+
+.. genex:: $<SHELL_PATH:...>
+
Content of ``...`` converted to shell path style. For example, slashes are
converted to backslashes in Windows shells and drive letters are converted
to posix paths in MSYS shells. The ``...`` must be an absolute path.
@@ -816,7 +993,8 @@
``;`` on Windows). Be sure to enclose the argument containing this genex
in double quotes in CMake source code so that ``;`` does not split arguments.
-``$<OUTPUT_CONFIG:...>``
+.. genex:: $<OUTPUT_CONFIG:...>
+
.. versionadded:: 3.20
Only valid in :command:`add_custom_command` and :command:`add_custom_target`
@@ -825,7 +1003,8 @@
in ``...`` are evaluated using the custom command's "output config".
With other generators, the content of ``...`` is evaluated normally.
-``$<COMMAND_CONFIG:...>``
+.. genex:: $<COMMAND_CONFIG:...>
+
.. versionadded:: 3.20
Only valid in :command:`add_custom_command` and :command:`add_custom_target`
diff --git a/Help/release/3.19.rst b/Help/release/3.19.rst
index 7ad27c8..d819e8c 100644
--- a/Help/release/3.19.rst
+++ b/Help/release/3.19.rst
@@ -400,3 +400,11 @@
* The naming pattern ``cmake-$ver-macos10.10-universal`` is a universal
binary with ``x86_64`` and ``arm64`` architectures. It requires
macOS 10.10 or newer.
+
+3.19.4
+------
+
+* The :variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM`
+ variable introduced in 3.19.0 previously worked only with the
+ :generator:`Visual Studio 14 2015` generator. It has now been fixed to
+ work with :ref:`Visual Studio Generators` for later VS versions too.
diff --git a/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM.rst b/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM.rst
index 591ea91..d9f136c 100644
--- a/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM.rst
+++ b/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM.rst
@@ -3,7 +3,7 @@
.. versionadded:: 3.19
-Override the :ref:`Windows 10 SDK Maximum Version for VS 2015`.
+Override the :ref:`Windows 10 SDK Maximum Version for VS 2015` and beyond.
The :variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM` variable may
be set to a false value (e.g. ``OFF``, ``FALSE``, or ``0``) or the SDK version
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index a69a585..16bf279 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -361,9 +361,11 @@
execute_process(
COMMAND ${HDF5_${language}_COMPILER_EXECUTABLE} ${test_file}
WORKING_DIRECTORY ${scratch_dir}
+ OUTPUT_VARIABLE output
+ ERROR_VARIABLE output
RESULT_VARIABLE return_value
)
- if(return_value)
+ if(return_value AND NOT HDF5_FIND_QUIETLY)
message(STATUS
"HDF5 ${language} compiler wrapper is unable to compile a minimal HDF5 program.")
else()
@@ -375,7 +377,7 @@
RESULT_VARIABLE return_value
OUTPUT_STRIP_TRAILING_WHITESPACE
)
- if(return_value)
+ if(return_value AND NOT HDF5_FIND_QUIETLY)
message(STATUS
"Unable to determine HDF5 ${language} flags from HDF5 wrapper.")
endif()
@@ -386,7 +388,7 @@
RESULT_VARIABLE return_value
OUTPUT_STRIP_TRAILING_WHITESPACE
)
- if(return_value)
+ if(return_value AND NOT HDF5_FIND_QUIETLY)
message(STATUS
"Unable to determine HDF5 ${language} version_var from HDF5 wrapper.")
endif()
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index f325cfb..ed5c38b 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -736,7 +736,7 @@
set(gp_regex_cmp_count 1)
elseif(gp_tool MATCHES "otool$")
set(gp_cmd_args "-L")
- set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$")
+ set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)(, weak)?\\)${eol_char}$")
set(gp_regex_error "")
set(gp_regex_fallback "")
set(gp_regex_cmp_count 3)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index ce9ea6c..184fcf5 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 19)
-set(CMake_VERSION_PATCH 20210119)
+set(CMake_VERSION_PATCH 20210121)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx
index 351d92a..6d97720 100644
--- a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx
+++ b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx
@@ -44,7 +44,7 @@
std::string line;
static const cmsys::RegularExpression rpathRegex("^ *cmd LC_RPATH$");
static const cmsys::RegularExpression loadDylibRegex(
- "^ *cmd LC_LOAD_DYLIB$");
+ "^ *cmd LC_LOAD(_WEAK)?_DYLIB$");
static const cmsys::RegularExpression pathRegex(
"^ *path (.*) \\(offset [0-9]+\\)$");
static const cmsys::RegularExpression nameRegex(
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index c67497a..4329caf 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -200,6 +200,7 @@
argv.push_back(cmSystemTools::GetCMakeCommand());
argv.emplace_back("-E");
argv.emplace_back("cmake_transform_depfile");
+ argv.push_back(this->LG->GetGlobalGenerator()->GetName());
switch (*this->LG->GetGlobalGenerator()->DepfileFormat()) {
case cmDepfileFormat::GccDepfile:
argv.emplace_back("gccdepfile");
@@ -208,15 +209,10 @@
argv.emplace_back("vstlog");
break;
}
- if (this->LG->GetCurrentBinaryDirectory() ==
- this->LG->GetBinaryDirectory()) {
- argv.emplace_back("./");
- } else {
- argv.push_back(cmStrCat(this->LG->MaybeConvertToRelativePath(
- this->LG->GetBinaryDirectory(),
- this->LG->GetCurrentBinaryDirectory()),
- '/'));
- }
+ argv.push_back(this->LG->GetSourceDirectory());
+ argv.push_back(this->LG->GetCurrentSourceDirectory());
+ argv.push_back(this->LG->GetBinaryDirectory());
+ argv.push_back(this->LG->GetCurrentBinaryDirectory());
argv.push_back(this->GetFullDepfile());
argv.push_back(this->GetInternalDepfile());
diff --git a/Source/cmDependsCompiler.cxx b/Source/cmDependsCompiler.cxx
index ec31f68..2b48df9 100644
--- a/Source/cmDependsCompiler.cxx
+++ b/Source/cmDependsCompiler.cxx
@@ -97,17 +97,8 @@
std::vector<std::string> depends;
if (format == "custom"_s) {
- std::string prefix;
- if (this->LocalGenerator->GetCurrentBinaryDirectory() !=
- this->LocalGenerator->GetBinaryDirectory()) {
- prefix =
- cmStrCat(this->LocalGenerator->MaybeConvertToRelativePath(
- this->LocalGenerator->GetBinaryDirectory(),
- this->LocalGenerator->GetCurrentBinaryDirectory()),
- '/');
- }
-
- auto deps = cmReadGccDepfile(depFile.c_str(), prefix);
+ auto deps = cmReadGccDepfile(
+ depFile.c_str(), this->LocalGenerator->GetCurrentBinaryDirectory());
if (!deps) {
continue;
}
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 0b9b183..3c69c50 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -290,6 +290,7 @@
cmSystemTools::Error(e.str());
return false;
}
+ exportFileStream.SetCopyIfDifferent(true);
std::ostream& os = exportFileStream;
// Start with the import file header.
diff --git a/Source/cmGccDepfileReader.cxx b/Source/cmGccDepfileReader.cxx
index 8253375..6436baa 100644
--- a/Source/cmGccDepfileReader.cxx
+++ b/Source/cmGccDepfileReader.cxx
@@ -24,7 +24,7 @@
for (auto& dep : *deps) {
for (auto& rule : dep.rules) {
if (!prefix.empty() && !cmSystemTools::FileIsFullPath(rule)) {
- rule = cmStrCat(prefix, rule);
+ rule = cmStrCat(prefix, '/', rule);
}
if (cmSystemTools::FileIsFullPath(rule)) {
rule = cmSystemTools::CollapseFullPath(rule);
@@ -33,7 +33,7 @@
}
for (auto& path : dep.paths) {
if (!prefix.empty() && !cmSystemTools::FileIsFullPath(path)) {
- path = cmStrCat(prefix, path);
+ path = cmStrCat(prefix, '/', path);
}
if (cmSystemTools::FileIsFullPath(path)) {
path = cmSystemTools::CollapseFullPath(path);
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index e17c6d7..b46f1b9 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -253,6 +253,12 @@
// If value is an invalid pointer, leave result unchanged.
}
+ return this->GetWindows10SDKMaxVersionDefault(mf);
+}
+
+std::string cmGlobalVisualStudio14Generator::GetWindows10SDKMaxVersionDefault(
+ cmMakefile*) const
+{
// The last Windows 10 SDK version that VS 2015 can target is 10.0.14393.0.
//
// "VS 2015 Users: The Windows 10 SDK (15063, 16299, 17134, 17763) is
diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h
index 1ccd4c7..7804b83 100644
--- a/Source/cmGlobalVisualStudio14Generator.h
+++ b/Source/cmGlobalVisualStudio14Generator.h
@@ -40,9 +40,13 @@
// of the toolset is installed
bool IsWindowsStoreToolsetInstalled() const;
+ // Used to adjust the max-SDK-version calculation to accommodate user
+ // configuration.
+ std::string GetWindows10SDKMaxVersion(cmMakefile* mf) const;
+
// Used to make sure that the Windows 10 SDK selected can work with the
// version of the toolset.
- virtual std::string GetWindows10SDKMaxVersion(cmMakefile* mf) const;
+ virtual std::string GetWindows10SDKMaxVersionDefault(cmMakefile* mf) const;
virtual bool SelectWindows10SDK(cmMakefile* mf, bool required);
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index 95357e7..84f870e 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -540,7 +540,8 @@
return false;
}
-std::string cmGlobalVisualStudioVersionedGenerator::GetWindows10SDKMaxVersion(
+std::string
+cmGlobalVisualStudioVersionedGenerator::GetWindows10SDKMaxVersionDefault(
cmMakefile*) const
{
return std::string();
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h
index af09cbd..46a5f40 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.h
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.h
@@ -56,7 +56,7 @@
// Check for a Win 8 SDK known to the registry or VS installer tool.
bool IsWin81SDKInstalled() const;
- std::string GetWindows10SDKMaxVersion(cmMakefile*) const override;
+ std::string GetWindows10SDKMaxVersionDefault(cmMakefile*) const override;
std::string FindMSBuildCommand() override;
std::string FindDevEnvCommand() override;
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 26e93bb..fce6e80 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -25,7 +25,7 @@
, Markup(MarkupNone)
, Directive(DirectiveNone)
, CMakeDirective("^.. (cmake:)?("
- "command|variable"
+ "command|envvar|genex|variable"
")::[ \t]+([^ \t\n]+)$")
, CMakeModuleDirective("^.. cmake-module::[ \t]+([^ \t\n]+)$")
, ParsedLiteralDirective("^.. parsed-literal::[ \t]*(.*)$")
@@ -37,7 +37,8 @@
, NoteDirective("^.. note::[ \t]*(.*)$")
, ModuleRST(R"(^#\[(=*)\[\.rst:$)")
, CMakeRole("(:cmake)?:("
- "command|cpack_gen|generator|variable|envvar|module|policy|"
+ "command|cpack_gen|generator|genex|"
+ "variable|envvar|module|policy|"
"prop_cache|prop_dir|prop_gbl|prop_inst|prop_sf|"
"prop_test|prop_tgt|"
"manual"
diff --git a/Source/cmTransformDepfile.cxx b/Source/cmTransformDepfile.cxx
index b91e1ce..78aa4b2 100644
--- a/Source/cmTransformDepfile.cxx
+++ b/Source/cmTransformDepfile.cxx
@@ -13,6 +13,7 @@
#include "cmGccDepfileReader.h"
#include "cmGccDepfileReaderTypes.h"
+#include "cmLocalGenerator.h"
#include "cmSystemTools.h"
namespace {
@@ -33,8 +34,11 @@
}
}
-void WriteGccDepfile(cmsys::ofstream& fout, const cmGccDepfileContent& content)
+void WriteGccDepfile(cmsys::ofstream& fout, const cmLocalGenerator& lg,
+ const cmGccDepfileContent& content)
{
+ const auto& binDir = lg.GetBinaryDirectory();
+
for (auto const& dep : content) {
bool first = true;
for (auto const& rule : dep.rules) {
@@ -42,19 +46,32 @@
fout << " \\\n ";
}
first = false;
- WriteFilenameGcc(fout, rule);
+ WriteFilenameGcc(fout, lg.MaybeConvertToRelativePath(binDir, rule));
}
fout << ':';
for (auto const& path : dep.paths) {
fout << " \\\n ";
- WriteFilenameGcc(fout, path);
+ WriteFilenameGcc(fout, lg.MaybeConvertToRelativePath(binDir, path));
}
fout << '\n';
}
}
-void WriteVsTlog(cmsys::ofstream& fout, const cmGccDepfileContent& content)
+// tlog format : always windows paths on Windows regardless the generator
+std::string ConvertToTLogOutputPath(const std::string& path)
{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ return cmSystemTools::ConvertToWindowsOutputPath(path);
+#else
+ return cmSystemTools::ConvertToOutputPath(path);
+#endif
+}
+
+void WriteVsTlog(cmsys::ofstream& fout, const cmLocalGenerator& lg,
+ const cmGccDepfileContent& content)
+{
+ const auto& binDir = lg.GetBinaryDirectory();
+
for (auto const& dep : content) {
fout << '^';
bool first = true;
@@ -63,22 +80,26 @@
fout << '|';
}
first = false;
- fout << cmSystemTools::ConvertToOutputPath(rule);
+ fout << ConvertToTLogOutputPath(
+ lg.MaybeConvertToRelativePath(binDir, rule));
}
fout << "\r\n";
for (auto const& path : dep.paths) {
- fout << cmSystemTools::ConvertToOutputPath(path) << "\r\n";
+ fout << ConvertToTLogOutputPath(
+ lg.MaybeConvertToRelativePath(binDir, path))
+ << "\r\n";
}
}
}
}
-bool cmTransformDepfile(cmDepfileFormat format, const std::string& prefix,
+bool cmTransformDepfile(cmDepfileFormat format, const cmLocalGenerator& lg,
const std::string& infile, const std::string& outfile)
{
cmGccDepfileContent content;
if (cmSystemTools::FileExists(infile)) {
- auto result = cmReadGccDepfile(infile.c_str(), prefix);
+ auto result =
+ cmReadGccDepfile(infile.c_str(), lg.GetCurrentBinaryDirectory());
if (!result) {
return false;
}
@@ -91,10 +112,10 @@
}
switch (format) {
case cmDepfileFormat::GccDepfile:
- WriteGccDepfile(fout, content);
+ WriteGccDepfile(fout, lg, content);
break;
case cmDepfileFormat::VsTlog:
- WriteVsTlog(fout, content);
+ WriteVsTlog(fout, lg, content);
break;
}
return true;
diff --git a/Source/cmTransformDepfile.h b/Source/cmTransformDepfile.h
index 792c1aa..c43a45f 100644
--- a/Source/cmTransformDepfile.h
+++ b/Source/cmTransformDepfile.h
@@ -10,5 +10,7 @@
VsTlog,
};
-bool cmTransformDepfile(cmDepfileFormat format, const std::string& prefix,
+class cmLocalGenerator;
+
+bool cmTransformDepfile(cmDepfileFormat format, const cmLocalGenerator& lg,
const std::string& infile, const std::string& outfile);
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 851205e..f6d8901 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1522,20 +1522,42 @@
#endif
// Internal depfile transformation
- if (args[1] == "cmake_transform_depfile" && args.size() == 6) {
+ if (args[1] == "cmake_transform_depfile" && args.size() == 10) {
auto format = cmDepfileFormat::GccDepfile;
- if (args[2] == "gccdepfile") {
+ if (args[3] == "gccdepfile") {
format = cmDepfileFormat::GccDepfile;
- } else if (args[2] == "vstlog") {
+ } else if (args[3] == "vstlog") {
format = cmDepfileFormat::VsTlog;
} else {
return 1;
}
- std::string prefix = args[3];
- if (prefix == "./") {
- prefix.clear();
+ // Create a cmake object instance to process dependencies.
+ // All we need is the `set` command.
+ cmake cm(cmake::RoleScript, cmState::Unknown);
+ std::string homeDir;
+ std::string startDir;
+ std::string homeOutDir;
+ std::string startOutDir;
+ homeDir = cmSystemTools::CollapseFullPath(args[4]);
+ startDir = cmSystemTools::CollapseFullPath(args[5]);
+ homeOutDir = cmSystemTools::CollapseFullPath(args[6]);
+ startOutDir = cmSystemTools::CollapseFullPath(args[7]);
+ cm.SetHomeDirectory(homeDir);
+ cm.SetHomeOutputDirectory(homeOutDir);
+ cm.GetCurrentSnapshot().SetDefaultDefinitions();
+ if (auto ggd = cm.CreateGlobalGenerator(args[2])) {
+ cm.SetGlobalGenerator(std::move(ggd));
+ cmStateSnapshot snapshot = cm.GetCurrentSnapshot();
+ snapshot.GetDirectory().SetCurrentBinary(startOutDir);
+ snapshot.GetDirectory().SetCurrentSource(startDir);
+ snapshot.GetDirectory().SetRelativePathTopSource(homeDir.c_str());
+ snapshot.GetDirectory().SetRelativePathTopBinary(homeOutDir.c_str());
+ cmMakefile mf(cm.GetGlobalGenerator(), snapshot);
+ auto lgd = cm.GetGlobalGenerator()->CreateLocalGenerator(&mf);
+
+ return cmTransformDepfile(format, *lgd, args[8], args[9]) ? 0 : 2;
}
- return cmTransformDepfile(format, prefix, args[4], args[5]) ? 0 : 1;
+ return 1;
}
}
diff --git a/Tests/CMakeLib/testRST.expect b/Tests/CMakeLib/testRST.expect
index 970adaa..4870f65 100644
--- a/Tests/CMakeLib/testRST.expect
+++ b/Tests/CMakeLib/testRST.expect
@@ -20,6 +20,12 @@
Environment variable ``some env var`` with space and target.
Generator ``Some Generator`` with space.
Generator ``Some Generator`` with space.
+Generator expression ``SOME_GENEX``.
+Generator expression ``$<SOME_GENEX>`` with brackets.
+Generator expression ``$<SOME_GENEX:...>`` with brackets and parameter.
+Generator expression ``some genex`` with space and target.
+Generator expression ``$<SOME_GENEX>`` with brackets, space, and target.
+Generator expression ``$<SOME_GENEX:...>`` with brackets, parameter, space, and target.
Inline literal ``~!@#$%^&*( )_+-=\\[]{}'":;,<>.?/``.
Inline link Link Text.
Inline link Link Text <With \-escaped Brackets>.
@@ -48,6 +54,22 @@
Command other_cmd description.
+.. cmake:envvar:: some_var
+
+ Environment variable some_var description.
+
+.. envvar:: other_var
+
+ Environment variable other_var description.
+
+.. cmake:genex:: SOME_GENEX
+
+ Generator expression SOME_GENEX description.
+
+.. genex:: $<OTHER_GENEX>
+
+ Generator expression $<OTHER_GENEX> description.
+
.. cmake:variable:: some_var
Variable some_var description.
diff --git a/Tests/CMakeLib/testRST.rst b/Tests/CMakeLib/testRST.rst
index 6462f1b..44931a7 100644
--- a/Tests/CMakeLib/testRST.rst
+++ b/Tests/CMakeLib/testRST.rst
@@ -27,6 +27,12 @@
Environment variable :envvar:`some env var <SOME_ENV_VAR>` with space and target.
Generator :generator:`Some Generator` with space.
Generator :cpack_gen:`Some Generator` with space.
+Generator expression :genex:`SOME_GENEX`.
+Generator expression :genex:`$<SOME_GENEX>` with brackets.
+Generator expression :genex:`$<SOME_GENEX:...>` with brackets and parameter.
+Generator expression :genex:`some genex <SOME_GENEX>` with space and target.
+Generator expression :genex:`$<SOME_GENEX> <SOME_GENEX>` with brackets, space, and target.
+Generator expression :genex:`$<SOME_GENEX:...> <SOME_GENEX>` with brackets, parameter, space, and target.
Inline literal ``~!@#$%^&*( )_+-=\\[]{}'":;,<>.?/``.
Inline link `Link Text <ExternalDest>`_.
Inline link `Link Text \<With \\-escaped Brackets\> <ExternalDest>`_.
@@ -51,6 +57,22 @@
Command other_cmd description.
+.. cmake:envvar:: some_var
+
+ Environment variable some_var description.
+
+.. envvar:: other_var
+
+ Environment variable other_var description.
+
+.. cmake:genex:: SOME_GENEX
+
+ Generator expression SOME_GENEX description.
+
+.. genex:: $<OTHER_GENEX>
+
+ Generator expression $<OTHER_GENEX> description.
+
.. cmake:variable:: some_var
Variable some_var description.
diff --git a/Tests/RunCMake/BuildDepends/CMakeLists.txt b/Tests/RunCMake/BuildDepends/CMakeLists.txt
index 74b3ff8..99f238b 100644
--- a/Tests/RunCMake/BuildDepends/CMakeLists.txt
+++ b/Tests/RunCMake/BuildDepends/CMakeLists.txt
@@ -1,3 +1,3 @@
cmake_minimum_required(VERSION 3.3)
project(${RunCMake_TEST} NONE)
-include(${RunCMake_TEST}.cmake)
+include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
index 6ac1291..01eac91 100644
--- a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
+++ b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
@@ -4,7 +4,7 @@
add_custom_command(
OUTPUT topcc.c
DEPFILE topcc.c.d
- COMMAND ${CMAKE_COMMAND} -DOUTFILE=topcc.c -DINFILE=topccdep.txt -DDEPFILE=topcc.c.d -P "${CMAKE_CURRENT_LIST_DIR}/WriteDepfile.cmake"
+ COMMAND ${CMAKE_COMMAND} -DOUTFILE=${CMAKE_CURRENT_BINARY_DIR}/topcc.c -DINFILE=topccdep.txt -DDEPFILE=topcc.c.d -P "${CMAKE_CURRENT_LIST_DIR}/WriteDepfile.cmake"
)
add_custom_target(topcc ALL DEPENDS topcc.c)
diff --git a/Tests/RunCMake/BuildDepends/DepfileSubdir/CMakeLists.txt b/Tests/RunCMake/BuildDepends/DepfileSubdir/CMakeLists.txt
index 06db47c..f131751 100644
--- a/Tests/RunCMake/BuildDepends/DepfileSubdir/CMakeLists.txt
+++ b/Tests/RunCMake/BuildDepends/DepfileSubdir/CMakeLists.txt
@@ -3,7 +3,7 @@
add_custom_command(
OUTPUT subcc.c
DEPFILE subcc.c.d
- COMMAND ${CMAKE_COMMAND} -DOUTFILE=subcc.c -DINFILE=subccdep.txt -DDEPFILE=subcc.c.d -P "${CMAKE_CURRENT_LIST_DIR}/../WriteDepfile.cmake"
+ COMMAND ${CMAKE_COMMAND} -DOUTFILE=${CMAKE_CURRENT_BINARY_DIR}/subcc.c -DINFILE=subccdep.txt -DDEPFILE=subcc.c.d -P "${CMAKE_CURRENT_LIST_DIR}/../WriteDepfile.cmake"
)
add_custom_target(subcc ALL DEPENDS subcc.c)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 540a718..d1122d0 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -796,7 +796,10 @@
add_RunCMake_test("UnityBuild")
add_RunCMake_test(CMakePresets -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA})
-add_RunCMake_test(TransformDepfile)
+
+if(${CMAKE_GENERATOR} MATCHES "Make|Ninja")
+ add_RunCMake_test(TransformDepfile)
+endif()
if(WIN32)
add_RunCMake_test(Win32GenEx)
diff --git a/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake b/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake
index cb75eb0..9a38b95 100644
--- a/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake
@@ -3,11 +3,11 @@
function(run_transform_depfile name)
set(RunCMake-check-file gccdepfile.cmake)
run_cmake_command(${name}-gcc
- ${CMAKE_COMMAND} -E cmake_transform_depfile gccdepfile ../ ${CMAKE_CURRENT_LIST_DIR}/${name}.d out.d
+ ${CMAKE_COMMAND} -E cmake_transform_depfile "${RunCMake_GENERATOR}" gccdepfile "${RunCMake_SOURCE_DIR}" "${RunCMake_SOURCE_DIR}/subdir" "${RunCMake_BINARY_DIR}" "${RunCMake_BINARY_DIR}/subdir" "${CMAKE_CURRENT_LIST_DIR}/${name}.d" out.d
)
set(RunCMake-check-file vstlog.cmake)
run_cmake_command(${name}-tlog
- ${CMAKE_COMMAND} -E cmake_transform_depfile vstlog ../ ${CMAKE_CURRENT_LIST_DIR}/${name}.d out.tlog
+ ${CMAKE_COMMAND} -E cmake_transform_depfile "${RunCMake_GENERATOR}" vstlog "${RunCMake_SOURCE_DIR}" "${RunCMake_SOURCE_DIR}/subdir" "${RunCMake_BINARY_DIR}" "${RunCMake_BINARY_DIR}/subdir" "${CMAKE_CURRENT_LIST_DIR}/${name}.d" out.tlog
)
endfunction()
diff --git a/Tests/RunCMake/TransformDepfile/deps-unix.d.txt b/Tests/RunCMake/TransformDepfile/deps-unix.d.txt
index 58770f2..fbdecc0 100644
--- a/Tests/RunCMake/TransformDepfile/deps-unix.d.txt
+++ b/Tests/RunCMake/TransformDepfile/deps-unix.d.txt
@@ -1,8 +1,8 @@
-../out1 \
+subdir/out1 \
/home/build/out2: \
- ../in1 \
+ subdir/in1 \
/home/build/in2
-../out3 \
+subdir/out3 \
/home/build/out4: \
- ../in3 \
+ subdir/in3 \
/home/build/in4
diff --git a/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt b/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt
index 2a26edf..70bac5d 100644
--- a/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt
+++ b/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt
@@ -1,6 +1,6 @@
-^../out1|/home/build/out2
-../in1
+^subdir/out1|/home/build/out2
+subdir/in1
/home/build/in2
-^../out3|/home/build/out4
-../in3
+^subdir/out3|/home/build/out4
+subdir/in3
/home/build/in4
diff --git a/Tests/RunCMake/TransformDepfile/deps-windows.d.txt b/Tests/RunCMake/TransformDepfile/deps-windows.d.txt
index 47b3ebf..e09ae37 100644
--- a/Tests/RunCMake/TransformDepfile/deps-windows.d.txt
+++ b/Tests/RunCMake/TransformDepfile/deps-windows.d.txt
@@ -1,8 +1,8 @@
-../out1 \
+subdir/out1 \
C:/build/out2: \
- ../in1 \
+ subdir/in1 \
C:/build/in2
-../out3 \
+subdir/out3 \
C:/build/out4: \
- ../in3 \
+ subdir/in3 \
C:/build/in4
diff --git a/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt b/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt
index 1e6024d..09f9e97 100644
--- a/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt
+++ b/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt
@@ -1,6 +1,6 @@
-^..\out1|C:\build\out2
-..\in1
+^subdir\out1|C:\build\out2
+subdir\in1
C:\build\in2
-^..\out3|C:\build\out4
-..\in3
+^subdir\out3|C:\build\out4
+subdir\in3
C:\build\in4
diff --git a/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt b/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt
index d00491f..0cfbf08 100644
--- a/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt
+++ b/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt
@@ -1 +1 @@
-1
+2
diff --git a/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt b/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt
index d00491f..0cfbf08 100644
--- a/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt
+++ b/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt
@@ -1 +1 @@
-1
+2
diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake
index e6f2623..e7cdbf6 100644
--- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake
+++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake
@@ -148,6 +148,27 @@
)
check_contents(deps/udeps6.txt "^${_check}$")
+# Weak library reference should have exactly the same dependencies as a regular library reference (test 1)
+set_with_libsystem(_check
+ [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/bin/../lib/executable_path/libexecutable_path\.dylib]]
+ [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/bin/../lib/rpath_executable_path/librpath_executable_path\.dylib]]
+ [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/libtestlib\.dylib]]
+ [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/loader_path/libloader_path\.dylib]]
+ [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/../rpath/librpath\.dylib]]
+ [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/libnormal\.dylib]]
+ [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/rpath_loader_path/librpath_loader_path\.dylib]]
+ )
+check_contents(deps/deps7.txt "^${_check}$")
+
+set(_check
+ [[@executable_path/../lib/executable_path_bundle/libexecutable_path_bundle\.dylib]]
+ [[@loader_path/loader_path_unresolved/libloader_path_unresolved\.dylib]]
+ [[@rpath/librpath_executable_path_bundle\.dylib]]
+ [[@rpath/librpath_loader_path_unresolved\.dylib]]
+ [[@rpath/librpath_unresolved\.dylib]]
+ )
+check_contents(deps/udeps7.txt "^${_check}$")
+
set(_check
"^libconflict\\.dylib:[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/conflict/libconflict\\.dylib;[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/conflict2/libconflict\\.dylib\n$"
)
@@ -157,3 +178,4 @@
check_contents(deps/cdeps4.txt "${_check}")
check_contents(deps/cdeps5.txt "${_check}")
check_contents(deps/cdeps6.txt "${_check}")
+check_contents(deps/cdeps7.txt "${_check}")
diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos.cmake
index c56a14b..aab19b7 100644
--- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos.cmake
+++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos.cmake
@@ -128,16 +128,19 @@
target_link_libraries(testlib PRIVATE ${testlib_names})
add_executable(topexe macos/topexe.c)
+add_executable(topexe_weak macos/topexe.c)
add_library(toplib SHARED macos/toplib.c)
add_library(topmod MODULE macos/toplib.c)
target_link_libraries(topexe PRIVATE testlib)
+target_link_libraries(topexe_weak PRIVATE "-weak_library" testlib)
target_link_libraries(toplib PRIVATE testlib)
target_link_libraries(topmod PRIVATE testlib)
set_property(TARGET topexe toplib topmod PROPERTY INSTALL_RPATH "${CMAKE_BINARY_DIR}/root-all/executable/lib")
+set_property(TARGET topexe_weak toplib topmod PROPERTY INSTALL_RPATH "${CMAKE_BINARY_DIR}/root-all/executable/lib")
-install(TARGETS topexe toplib topmod testlib testlib_conflict RUNTIME DESTINATION executable/bin LIBRARY DESTINATION executable/lib)
-install(TARGETS topexe toplib topmod testlib testlib_conflict RUNTIME DESTINATION bundle_executable/bin LIBRARY DESTINATION bundle_executable/lib)
+install(TARGETS topexe topexe_weak toplib topmod testlib testlib_conflict RUNTIME DESTINATION executable/bin LIBRARY DESTINATION executable/lib)
+install(TARGETS topexe topexe_weak toplib topmod testlib testlib_conflict RUNTIME DESTINATION bundle_executable/bin LIBRARY DESTINATION bundle_executable/lib)
install(CODE [[
function(exec_get_runtime_dependencies depsfile udepsfile cdepsfile)
@@ -213,4 +216,12 @@
"${CMAKE_INSTALL_PREFIX}/executable/lib/$<TARGET_FILE_NAME:testlib_conflict>"
BUNDLE_EXECUTABLE "${CMAKE_INSTALL_PREFIX}/bundle_executable/bin/$<TARGET_FILE_NAME:topexe>"
)
+
+ exec_get_runtime_dependencies(
+ deps7.txt udeps7.txt cdeps7.txt
+ EXECUTABLES
+ "${CMAKE_INSTALL_PREFIX}/executable/bin/$<TARGET_FILE_NAME:topexe_weak>"
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/executable/lib/$<TARGET_FILE_NAME:testlib_conflict>"
+ )
]])
diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py
index e175d0d..ece4bf5 100644
--- a/Utilities/Sphinx/cmake.py
+++ b/Utilities/Sphinx/cmake.py
@@ -191,6 +191,7 @@
'cpack_gen': _cmake_index_entry('cpack generator'),
'envvar': _cmake_index_entry('envvar'),
'generator': _cmake_index_entry('generator'),
+ 'genex': _cmake_index_entry('genex'),
'guide': _cmake_index_entry('guide'),
'manual': _cmake_index_entry('manual'),
'module': _cmake_index_entry('module'),
@@ -224,7 +225,7 @@
self.titles = {}
def parse_title(self, docname):
- """Parse a document title as the first line starting in [A-Za-z0-9<]
+ """Parse a document title as the first line starting in [A-Za-z0-9<$]
or fall back to the document basename if no such line exists.
The cmake --help-*-list commands also depend on this convention.
Return the title or False if the document file does not exist.
@@ -239,7 +240,7 @@
title = False
else:
for line in f:
- if len(line) > 0 and (line[0].isalnum() or line[0] == '<'):
+ if len(line) > 0 and (line[0].isalnum() or line[0] == '<' or line[0] == '$'):
title = line.rstrip()
break
f.close()
@@ -260,6 +261,10 @@
if objtype == 'command':
targetname = title.lower()
else:
+ if objtype == 'genex':
+ m = CMakeXRefRole._re_genex.match(title)
+ if m:
+ title = m.group(1)
targetname = title
targetid = '%s:%s' % (objtype, targetname)
targetnode = nodes.target('', '', ids=[targetid])
@@ -277,6 +282,10 @@
def handle_signature(self, sig, signode):
# called from sphinx.directives.ObjectDescription.run()
signode += addnodes.desc_name(sig, sig)
+ if self.objtype == 'genex':
+ m = CMakeXRefRole._re_genex.match(sig)
+ if m:
+ sig = m.group(1)
return sig
def add_target_and_index(self, name, sig, signode):
@@ -302,6 +311,7 @@
# See sphinx.util.nodes.explicit_title_re; \x00 escapes '<'.
_re = re.compile(r'^(.+?)(\s*)(?<!\x00)<(.*?)>$', re.DOTALL)
_re_sub = re.compile(r'^([^()\s]+)\s*\(([^()]*)\)$', re.DOTALL)
+ _re_genex = re.compile(r'^\$<([^<>:]+)(:[^<>]+)?>$', re.DOTALL)
def __call__(self, typ, rawtext, text, *args, **keys):
# Translate CMake command cross-references of the form:
@@ -312,6 +322,10 @@
m = CMakeXRefRole._re_sub.match(text)
if m:
text = '%s <%s>' % (text, m.group(1))
+ elif typ == 'cmake:genex':
+ m = CMakeXRefRole._re_genex.match(text)
+ if m:
+ text = '%s <%s>' % (text, m.group(1))
# CMake cross-reference targets frequently contain '<' so escape
# any explicit `<target>` with '<' not preceded by whitespace.
while True:
@@ -374,6 +388,7 @@
'cpack_gen': ObjType('cpack_gen', 'cpack_gen'),
'envvar': ObjType('envvar', 'envvar'),
'generator': ObjType('generator', 'generator'),
+ 'genex': ObjType('genex', 'genex'),
'guide': ObjType('guide', 'guide'),
'variable': ObjType('variable', 'variable'),
'module': ObjType('module', 'module'),
@@ -390,6 +405,7 @@
directives = {
'command': CMakeObject,
'envvar': CMakeObject,
+ 'genex': CMakeObject,
'variable': CMakeObject,
# Other object types cannot be created except by the CMakeTransform
# 'generator': CMakeObject,
@@ -409,6 +425,7 @@
'cpack_gen': CMakeXRefRole(),
'envvar': CMakeXRefRole(),
'generator': CMakeXRefRole(),
+ 'genex': CMakeXRefRole(),
'guide': CMakeXRefRole(),
'variable': CMakeXRefRole(),
'module': CMakeXRefRole(),
diff --git a/Utilities/Sphinx/create_identifiers.py b/Utilities/Sphinx/create_identifiers.py
index e35f127..0ff39a0 100755
--- a/Utilities/Sphinx/create_identifiers.py
+++ b/Utilities/Sphinx/create_identifiers.py
@@ -25,6 +25,7 @@
("envvar", "envvar"),
("variable", "variable"),
("generator", "generator"),
+ ("genex", "genex"),
("guide", "guide"),
("target property", "prop_tgt"),
("test property", "prop_test"),