diff options
Diffstat (limited to 'Help')
-rw-r--r-- | Help/command/try_compile.rst | 47 | ||||
-rw-r--r-- | Help/command/try_run.rst | 9 | ||||
-rw-r--r-- | Help/release/dev/genex-LINK_LIBRARY-FRAMEWORK-supports-suffix.rst | 5 | ||||
-rw-r--r-- | Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt | 9 |
4 files changed, 62 insertions, 8 deletions
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst index 97ad481..4632cd9 100644 --- a/Help/command/try_compile.rst +++ b/Help/command/try_compile.rst @@ -55,7 +55,11 @@ Try Compiling Source Files .. code-block:: cmake - try_compile(<resultVar> SOURCES <srcfile...> + try_compile(<resultVar> + <SOURCES <srcfile...>] | + SOURCE_FROM_ARG <name> <content>] | + SOURCE_FROM_VAR <name> <var>] | + SOURCE_FROM_FILE <name> <path> >... [CMAKE_FLAGS <flags>...] [COMPILE_DEFINITIONS <defs>...] [LINK_OPTIONS <options>...] @@ -74,10 +78,12 @@ Try building an executable or static library from one or more source files 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. +In this form, one or more source files must be provided. Additionally, one of +``SOURCES`` and/or ``SOURCE_FROM_*`` must precede other keywords. + +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 @@ -163,6 +169,37 @@ The options are: ``OUTPUT_VARIABLE <var>`` Store the output from the build process in the given variable. +``SOURCE_FROM_ARG <name> <content>`` + .. versionadded:: 3.25 + + Write ``<content>`` to a file named ``<name>`` in the operation directory. + This can be used to bypass the need to separately write a source file when + the contents of the file are dynamically specified. The specified ``<name>`` + is not allowed to contain path components. + + ``SOURCE_FROM_ARG`` may be specified multiple times. + +``SOURCE_FROM_FILE <name> <path>`` + .. versionadded:: 3.25 + + Copy ``<path>`` to a file named ``<name>`` in the operation directory. This + can be used to consolidate files into the operation directory, which may be + useful if a source which already exists (i.e. as a stand-alone file in a + project's source repository) needs to refer to other file(s) created by + ``SOURCE_FROM_*``. (Otherwise, ``SOURCES`` is usually more convenient.) The + specified ``<name>`` is not allowed to contain path components. + +``SOURCE_FROM_VAR <name> <content>`` + .. versionadded:: 3.25 + + Write the contents of ``<var>`` to a file named ``<name>`` in the operation + directory. This is the same as ``SOURCE_FROM_ARG``, but takes the contents + from the specified CMake variable, rather than directly, which may be useful + when passing arguments through a function which wraps ``try_compile``. The + specified ``<name>`` is not allowed to contain path components. + + ``SOURCE_FROM_VAR`` may be specified multiple times. + ``<LANG>_STANDARD <std>`` .. versionadded:: 3.8 diff --git a/Help/command/try_run.rst b/Help/command/try_run.rst index 1dc2355..efc10ec 100644 --- a/Help/command/try_run.rst +++ b/Help/command/try_run.rst @@ -12,7 +12,11 @@ Try Compiling and Running Source Files .. code-block:: cmake - try_run(<runResultVar> <compileResultVar> SOURCES <srcfile...> + try_run(<runResultVar> <compileResultVar> + <SOURCES <srcfile...>] | + SOURCE_FROM_ARG <name> <content>] | + SOURCE_FROM_VAR <name> <var>] | + SOURCE_FROM_FILE <name> <path> >... [CMAKE_FLAGS <flags>...] [COMPILE_DEFINITIONS <defs>...] [LINK_OPTIONS <options>...] @@ -40,6 +44,9 @@ set to ``FAILED_TO_RUN``. See the :command:`try_compile` command for documentation of options common to both commands, and for information on how the test project is constructed to build the source file. +One or more source files must be provided. Additionally, one of ``SOURCES`` +and/or ``SOURCE_FROM_*`` must precede other keywords. + This command also supports an alternate signature which was present in older versions of CMake: diff --git a/Help/release/dev/genex-LINK_LIBRARY-FRAMEWORK-supports-suffix.rst b/Help/release/dev/genex-LINK_LIBRARY-FRAMEWORK-supports-suffix.rst new file mode 100644 index 0000000..e4d82ee --- /dev/null +++ b/Help/release/dev/genex-LINK_LIBRARY-FRAMEWORK-supports-suffix.rst @@ -0,0 +1,5 @@ +genex-LINK_LIBRARY-FRAMEWORK-supports-suffix +-------------------------------------------- + +The :genex:`$<LINK_LIBRARY>` generator expression gains the capability, for the +``FRAMEWORK`` features, to handle the suffix of the framework library name. diff --git a/Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt b/Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt index 8ae6c57..aea1be8 100644 --- a/Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt +++ b/Help/variable/LINK_LIBRARY_PREDEFINED_FEATURES.txt @@ -45,8 +45,8 @@ wildcard, and optional parts are shown as ``[...]``): * ``[/path/to/]FwName[.framework]`` - * ``[/path/to/]FwName.framework/FwName`` - * ``[/path/to/]FwName.framework/Versions/*/FwName`` + * ``[/path/to/]FwName.framework/FwName[suffix]`` + * ``[/path/to/]FwName.framework/Versions/*/FwName[suffix]`` Note that CMake recognizes and automatically handles framework targets, even without using the ``$<LINK_LIBRARY:FRAMEWORK,...>`` expression. @@ -59,6 +59,11 @@ ``$<LINK_LIBRARY:FRAMEWORK,...>`` for file paths so that the expected behavior is clear. + .. versionadded:: 3.25 + The :prop_tgt:`FRAMEWORK_MULTI_CONFIG_POSTFIX_<CONFIG>` target property as + well as the ``suffix`` of the framework library name are now supported by + the ``FRAMEWORK`` features. + ``NEEDED_FRAMEWORK`` This is similar to the ``FRAMEWORK`` feature, except it forces the linker to link with the framework even if no symbols are used from it. It uses |