diff options
author | Craig Scott <craig.scott@crascit.com> | 2019-02-24 06:22:53 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2019-02-24 06:22:53 (GMT) |
commit | 861dbef4e718a8500721f48b617c33088067a3a1 (patch) | |
tree | e9b89ae8dd44adc818cca234b98b7126157e9445 /Help/command | |
parent | df8aa3c8add4de253c8eb80129b0893c16d63f2d (diff) | |
download | CMake-861dbef4e718a8500721f48b617c33088067a3a1.zip CMake-861dbef4e718a8500721f48b617c33088067a3a1.tar.gz CMake-861dbef4e718a8500721f48b617c33088067a3a1.tar.bz2 |
Help: Consistency in try_compile() docs for target type
Diffstat (limited to 'Help/command')
-rw-r--r-- | Help/command/try_compile.rst | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst index 7c6bc65..7e13ab1 100644 --- a/Help/command/try_compile.rst +++ b/Help/command/try_compile.rst @@ -42,13 +42,19 @@ Try Compiling Source Files [<LANG>_EXTENSIONS <bool>] ) -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 ``<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 -the source(s) as an executable that looks something like this: +Try building an executable or static library from one or more source files +(which one is determined by the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` +variable). The success or failure of the ``try_compile``, i.e. ``TRUE`` or +``FALSE`` respectively, is returned in ``<resultVar>``. + +In this form, one or more source files must be provided. If +:variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` is unset or is set to ``EXECUTABLE``, +the sources must include a definition for ``main`` and CMake will create a +``CMakeLists.txt`` file to build the source(s) as an executable. +If :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` is set to ``STATIC_LIBRARY``, +a static library will be built instead and no definition for ``main`` is +required. For an executable, the generated ``CMakeLists.txt`` file would +contain something like the following: .. code-block:: cmake @@ -73,7 +79,7 @@ The options are: in the generated test project. ``COPY_FILE <fileName>`` - Copy the linked executable to the given ``<fileName>``. + Copy the built executable or static library to the given ``<fileName>``. ``COPY_FILE_ERROR <var>`` Use after ``COPY_FILE`` to capture into variable ``<var>`` any error |