diff options
Diffstat (limited to 'Help')
-rw-r--r-- | Help/command/file.rst | 27 | ||||
-rw-r--r-- | Help/manual/cmake-generator-expressions.7.rst | 56 | ||||
-rw-r--r-- | Help/prop_tgt/AUTOGEN_BUILD_DIR.rst | 2 | ||||
-rw-r--r-- | Help/release/dev/file-install-follow-symlink-chain.rst | 6 | ||||
-rw-r--r-- | Help/release/dev/genex-COMPILE_LANG_AND_ID.rst | 7 |
5 files changed, 87 insertions, 11 deletions
diff --git a/Help/command/file.rst b/Help/command/file.rst index 465e567..0664e7c 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -311,6 +311,7 @@ Create the given directories and their parents as needed. [FILE_PERMISSIONS <permissions>...] [DIRECTORY_PERMISSIONS <permissions>...] [NO_SOURCE_PERMISSIONS] [USE_SOURCE_PERMISSIONS] + [FOLLOW_SYMLINK_CHAIN] [FILES_MATCHING] [[PATTERN <pattern> | REGEX <regex>] [EXCLUDE] [PERMISSIONS <permissions>...]] [...]) @@ -324,6 +325,32 @@ at the destination with the same timestamp. Copying preserves input permissions unless explicit permissions or ``NO_SOURCE_PERMISSIONS`` are given (default is ``USE_SOURCE_PERMISSIONS``). +If ``FOLLOW_SYMLINK_CHAIN`` is specified, ``COPY`` will recursively resolve +the symlinks at the paths given until a real file is found, and install +a corresponding symlink in the destination for each symlink encountered. For +each symlink that is installed, the resolution is stripped of the directory, +leaving only the filename, meaning that the new symlink points to a file in +the same directory as the symlink. This feature is useful on some Unix systems, +where libraries are installed as a chain of symlinks with version numbers, with +less specific versions pointing to more specific versions. +``FOLLOW_SYMLINK_CHAIN`` will install all of these symlinks and the library +itself into the destination directory. For example, if you have the following +directory structure: + +* ``/opt/foo/lib/libfoo.so.1.2.3`` +* ``/opt/foo/lib/libfoo.so.1.2 -> libfoo.so.1.2.3`` +* ``/opt/foo/lib/libfoo.so.1 -> libfoo.so.1.2`` +* ``/opt/foo/lib/libfoo.so -> libfoo.so.1`` + +and you do: + +.. code-block:: cmake + + file(COPY /opt/foo/lib/libfoo.so DESTINATION lib FOLLOW_SYMLINK_CHAIN) + +This will install all of the symlinks and ``libfoo.so.1.2.3`` itself into +``lib``. + See the :command:`install(DIRECTORY)` command for documentation of permissions, ``FILES_MATCHING``, ``PATTERN``, ``REGEX``, and ``EXCLUDE`` options. Copying directories preserves the structure diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index ce62893..f2e6597 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -111,22 +111,22 @@ Variable Queries this expression when it is evaluated on a property on an :prop_tgt:`IMPORTED` target. ``$<PLATFORM_ID:platform_id>`` - ``1`` if the CMake-id of the platform matches ``platform_id`` + ``1`` if the CMake's platform id matches ``platform_id`` otherwise ``0``. See also the :variable:`CMAKE_SYSTEM_NAME` variable. ``$<C_COMPILER_ID:compiler_id>`` - ``1`` if the CMake-id of the C compiler matches ``compiler_id``, + ``1`` if the CMake's compiler id of the C compiler matches ``compiler_id``, otherwise ``0``. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. ``$<CXX_COMPILER_ID:compiler_id>`` - ``1`` if the CMake-id of the CXX compiler matches ``compiler_id``, + ``1`` if the CMake's compiler id of the CXX compiler matches ``compiler_id``, otherwise ``0``. ``$<CUDA_COMPILER_ID:compiler_id>`` - ``1`` if the CMake-id of the CUDA compiler matches ``compiler_id``, + ``1`` if the CMake's compiler id of the CUDA compiler matches ``compiler_id``, otherwise ``0``. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. ``$<Fortran_COMPILER_ID:compiler_id>`` - ``1`` if the CMake-id of the Fortran compiler matches ``compiler_id``, + ``1`` if the CMake's compiler id of the Fortran compiler matches ``compiler_id``, otherwise ``0``. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. ``$<C_COMPILER_VERSION:version>`` @@ -158,6 +158,42 @@ Variable Queries .. _`Boolean COMPILE_LANGUAGE Generator Expression`: +``$<COMPILE_LANG_AND_ID:language,compiler_id>`` + ``1`` when the language used for compilation unit matches ``language`` and + the CMake's compiler id of the language compiler matches ``compiler_id``, + otherwise ``0``. This expression is a short form for the combination of + ``$<COMPILE_LANGUAGE:language>`` and ``$<LANG_COMPILER_ID:compiler_id>``. + This expression may be used to specify compile options, + compile definitions, and include directories for source files of a + particular language and compiler combination in a target. For example: + + .. code-block:: cmake + + add_executable(myapp main.cpp foo.c bar.cpp zot.cu) + target_compile_definitions(myapp + PRIVATE $<$<COMPILE_LANG_AND_ID:CXX,Clang>:COMPILING_CXX_WITH_CLANG> + $<$<COMPILE_LANG_AND_ID:CXX,Intel>:COMPILING_CXX_WITH_INTEL> + $<$<COMPILE_LANG_AND_ID:C,Clang>:COMPILING_C_WITH_CLANG> + ) + + This specifies the use of different compile definitions based on both + the compiler id and compilation language. This example will have a + ``COMPILING_CXX_WITH_CLANG`` compile definition when Clang is the CXX + compiler, and ``COMPILING_CXX_WITH_INTEL`` when Intel is the CXX compiler. + Likewise when the C compiler is Clang it will only see the ``COMPILING_C_WITH_CLANG`` + definition. + + Without the ``COMPILE_LANG_AND_ID`` generator expression the same logic + would be expressed as: + + .. code-block:: cmake + + target_compile_definitions(myapp + PRIVATE $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CXX_COMPILER_ID:Clang>>:COMPILING_CXX_WITH_CLANG> + $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CXX_COMPILER_ID:Intel>>:COMPILING_CXX_WITH_INTEL> + $<$<AND:$<COMPILE_LANGUAGE:C>,$<C_COMPILER_ID:Clang>>:COMPILING_C_WITH_CLANG> + ) + ``$<COMPILE_LANGUAGE:language>`` ``1`` when the language used for compilation unit matches ``language``, otherwise ``0``. This expression may be used to specify compile options, @@ -348,19 +384,19 @@ Variable Queries ``$<CONFIGURATION>`` Configuration name. Deprecated since CMake 3.0. Use ``CONFIG`` instead. ``$<PLATFORM_ID>`` - The CMake-id of the platform. + The current system's CMake platform id. See also the :variable:`CMAKE_SYSTEM_NAME` variable. ``$<C_COMPILER_ID>`` - The CMake-id of the C compiler used. + The CMake's compiler id of the C compiler used. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. ``$<CXX_COMPILER_ID>`` - The CMake-id of the CXX compiler used. + The CMake's compiler id of the CXX compiler used. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. ``$<CUDA_COMPILER_ID>`` - The CMake-id of the CUDA compiler used. + The CMake's compiler id of the CUDA compiler used. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. ``$<Fortran_COMPILER_ID>`` - The CMake-id of the Fortran compiler used. + The CMake's compiler id of the Fortran compiler used. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. ``$<C_COMPILER_VERSION>`` The version of the C compiler used. diff --git a/Help/prop_tgt/AUTOGEN_BUILD_DIR.rst b/Help/prop_tgt/AUTOGEN_BUILD_DIR.rst index 8db6ede..909b14c 100644 --- a/Help/prop_tgt/AUTOGEN_BUILD_DIR.rst +++ b/Help/prop_tgt/AUTOGEN_BUILD_DIR.rst @@ -5,7 +5,7 @@ Directory where :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTOUIC` and :prop_tgt:`AUTORCC` generate files for the target. The directory is created on demand and automatically added to the -:prop_dir:`ADDITIONAL_MAKE_CLEAN_FILES`. +:prop_tgt:`ADDITIONAL_CLEAN_FILES` target property. When unset or empty the directory ``<dir>/<target-name>_autogen`` is used where ``<dir>`` is :variable:`CMAKE_CURRENT_BINARY_DIR` and ``<target-name>`` diff --git a/Help/release/dev/file-install-follow-symlink-chain.rst b/Help/release/dev/file-install-follow-symlink-chain.rst new file mode 100644 index 0000000..8d22512 --- /dev/null +++ b/Help/release/dev/file-install-follow-symlink-chain.rst @@ -0,0 +1,6 @@ +file-install-follow-symlink-chain +--------------------------------- + +* The :command:`file(INSTALL)` command learned a new argument, + ``FOLLOW_SYMLINK_CHAIN``, which can be used to recursively resolve and + install symlinks. diff --git a/Help/release/dev/genex-COMPILE_LANG_AND_ID.rst b/Help/release/dev/genex-COMPILE_LANG_AND_ID.rst new file mode 100644 index 0000000..27e0ebd --- /dev/null +++ b/Help/release/dev/genex-COMPILE_LANG_AND_ID.rst @@ -0,0 +1,7 @@ +genex-COMPILE_LANG_AND_ID +-------------------------- + +* A new ``COMPILE_LANG_AND_ID`` generator expression was introduced to + allow specification of compile options for target files based on the + :variable:`CMAKE_<LANG>_COMPILER_ID` and :prop_sf:`LANGUAGE` and of + each source file. |