Help: User-provided variable names for try_* commands

All uppercase is typically used for command keywords. Non-keyword
arguments should generally be shown as `<something>` according
to the CMake documentation guide.
This commit is contained in:
Craig Scott 2019-02-24 17:13:45 +11:00
parent e6897c72e7
commit 7975edeac5
2 changed files with 12 additions and 12 deletions

View File

@ -12,12 +12,12 @@ Try Compiling Whole Projects
.. code-block:: cmake
try_compile(RESULT_VAR <bindir> <srcdir>
try_compile(<resultVar> <bindir> <srcdir>
<projectName> [<targetName>] [CMAKE_FLAGS <flags>...]
[OUTPUT_VARIABLE <var>])
Try building a project. The success or failure of the ``try_compile``,
i.e. ``TRUE`` or ``FALSE`` respectively, is returned in ``RESULT_VAR``.
i.e. ``TRUE`` or ``FALSE`` respectively, is returned in ``<resultVar>``.
In this form, ``<srcdir>`` should contain a complete CMake project with a
``CMakeLists.txt`` file and all sources. The ``<bindir>`` and ``<srcdir>``
@ -30,7 +30,7 @@ Try Compiling Source Files
.. code-block:: cmake
try_compile(RESULT_VAR <bindir> <srcfile|SOURCES srcfile...>
try_compile(<resultVar> <bindir> <srcfile|SOURCES srcfile...>
[CMAKE_FLAGS <flags>...]
[COMPILE_DEFINITIONS <defs>...]
[LINK_OPTIONS <options>...]
@ -44,7 +44,7 @@ Try Compiling Source Files
Try building an executable from one or more source files. The success or
failure of the ``try_compile``, i.e. ``TRUE`` or ``FALSE`` respectively, is
returned in ``RESULT_VAR``.
returned in ``<resultVar>``.
In this form the user need only supply one or more source files that include a
definition for ``main``. CMake will create a ``CMakeLists.txt`` file to build
@ -114,7 +114,7 @@ passed to ``cmake`` to avoid this clean. However, multiple sequential
``try_compile`` operations reuse this single output directory. If you use
``--debug-trycompile``, you can only debug one ``try_compile`` call at a time.
The recommended procedure is to protect all ``try_compile`` calls in your
project by ``if(NOT DEFINED RESULT_VAR)`` logic, configure with cmake
project by ``if(NOT DEFINED <resultVar>)`` logic, configure with cmake
all the way through once, then delete the cache entry associated with
the try_compile call of interest, and then re-run cmake again with
``--debug-trycompile``.

View File

@ -12,8 +12,8 @@ Try Compiling and Running Source Files
.. code-block:: cmake
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
bindir srcfile [CMAKE_FLAGS <flags>...]
try_run(<runResultVar> <compileResultVar>
<bindir> <srcfile> [CMAKE_FLAGS <flags>...]
[COMPILE_DEFINITIONS <defs>...]
[LINK_OPTIONS <options>...]
[LINK_LIBRARIES <libs>...]
@ -23,9 +23,9 @@ Try Compiling and Running Source Files
[ARGS <args>...])
Try compiling a ``<srcfile>``. Returns ``TRUE`` or ``FALSE`` for success
or failure in ``COMPILE_RESULT_VAR``. If the compile succeeded, runs the
executable and returns its exit code in ``RUN_RESULT_VAR``. If the
executable was built, but failed to run, then ``RUN_RESULT_VAR`` will be
or failure in ``<compileResultVar>``. If the compile succeeded, runs the
executable and returns its exit code in ``<runResultVar>``. If the
executable was built, but failed to run, then ``<runResultVar>`` will be
set to ``FAILED_TO_RUN``. See the :command:`try_compile` command for
information on how the test project is constructed to build the source file.
@ -85,10 +85,10 @@ presetting them in some CMake script file to the values the executable
would have produced if it had been run on its actual target platform.
These cache entries are:
``<RUN_RESULT_VAR>``
``<runResultVar>``
Exit code if the executable were to be run on the target platform.
``<RUN_RESULT_VAR>__TRYRUN_OUTPUT``
``<runResultVar>__TRYRUN_OUTPUT``
Output from stdout and stderr if the executable were to be run on
the target platform. This is created only if the
``RUN_OUTPUT_VARIABLE`` or ``OUTPUT_VARIABLE`` option was used.