Selaa lähdekoodia

Merge branch 'master' into ninja-order-depends

Kyle Edwards 5 vuotta sitten
vanhempi
sitoutus
d54f0aa9b7
100 muutettua tiedostoa jossa 1470 lisäystä ja 358 poistoa
  1. 2 2
      Auxiliary/CMakeLists.txt
  2. 16 8
      Auxiliary/bash-completion/CMakeLists.txt
  3. 18 2
      CMakeLists.txt
  4. 2 0
      CTestCustom.cmake.in
  5. 7 2
      Help/command/FIND_XXX.txt
  6. 90 0
      Help/command/cmake_command.rst
  7. 12 1
      Help/command/execute_process.rst
  8. 108 3
      Help/command/file.rst
  9. 4 0
      Help/command/function.rst
  10. 46 20
      Help/command/install.rst
  11. 4 0
      Help/command/macro.rst
  12. 17 4
      Help/command/string.rst
  13. 52 13
      Help/cpack_gen/archive.rst
  14. 5 0
      Help/cpack_gen/cygwin.rst
  15. 5 0
      Help/cpack_gen/freebsd.rst
  16. 95 82
      Help/cpack_gen/ifw.rst
  17. 14 10
      Help/cpack_gen/rpm.rst
  18. 140 4
      Help/dev/source.rst
  19. 11 1
      Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt
  20. 1 1
      Help/guide/tutorial/index.rst
  21. 1 0
      Help/manual/cmake-commands.7.rst
  22. 151 31
      Help/manual/cmake-generator-expressions.7.rst
  23. 8 0
      Help/manual/cmake-policies.7.rst
  24. 5 0
      Help/manual/cmake-properties.7.rst
  25. 3 0
      Help/manual/cmake-variables.7.rst
  26. 14 0
      Help/manual/cmake.1.rst
  27. 6 2
      Help/manual/ctest.1.rst
  28. 22 0
      Help/policy/CMP0103.rst
  29. 18 0
      Help/prop_sf/VS_SETTINGS.rst
  30. 3 0
      Help/prop_tgt/CONFIG_POSTFIX.rst
  31. 25 0
      Help/prop_tgt/FRAMEWORK_MULTI_CONFIG_POSTFIX_CONFIG.rst
  32. 8 0
      Help/prop_tgt/PCH_WARN_INVALID.rst
  33. 29 0
      Help/prop_tgt/VS_SOLUTION_DEPLOY.rst
  34. 19 0
      Help/prop_tgt/VS_SOURCE_SETTINGS_tool.rst
  35. 7 0
      Help/release/dev/0-sample-topic.rst
  36. 7 0
      Help/release/dev/CPackRPM-trans-scripts.rst
  37. 6 0
      Help/release/dev/FindPython-artifacts-interactive.rst
  38. 7 0
      Help/release/dev/FindRuby-variable-case.rst
  39. 7 0
      Help/release/dev/GoogleTest-DISCOVERY_MODE.rst
  40. 6 0
      Help/release/dev/GoogleTest-XML_OUTPUT_DIR.rst
  41. 8 0
      Help/release/dev/cmake-gui-env-platform-defaults.rst
  42. 6 0
      Help/release/dev/cmake_command-command.rst
  43. 6 0
      Help/release/dev/ctest_resource_spec_file-variable.rst
  44. 8 0
      Help/release/dev/curl-http2.rst
  45. 8 0
      Help/release/dev/deprecate-policy-old.rst
  46. 5 0
      Help/release/dev/execute_process.rst
  47. 5 0
      Help/release/dev/export-multiple-calls.rst
  48. 7 0
      Help/release/dev/file_archive.rst
  49. 6 0
      Help/release/dev/file_configure.rst
  50. 5 0
      Help/release/dev/findswig-components.rst
  51. 7 0
      Help/release/dev/framework-multi-config-postfix.rst
  52. 5 0
      Help/release/dev/genex-LINK_LANGUAGE.rst
  53. 6 0
      Help/release/dev/parallel-lzma-compression.rst
  54. 6 0
      Help/release/dev/pch-warn-invalid.rst
  55. 9 0
      Help/release/dev/profiling.rst
  56. 6 0
      Help/release/dev/required_find_commands.rst
  57. 5 0
      Help/release/dev/string-hex.rst
  58. 7 0
      Help/release/dev/useswig-fortran.rst
  59. 10 0
      Help/release/dev/vs-non-built-file-item-metadata.rst
  60. 6 0
      Help/release/dev/vs-sln-deploy.rst
  61. 2 0
      Help/release/index.rst
  62. 8 0
      Help/variable/CMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_CONFIG.rst
  63. 5 0
      Help/variable/CMAKE_PCH_WARN_INVALID.rst
  64. 5 0
      Help/variable/CTEST_RESOURCE_SPEC_FILE.rst
  65. 1 0
      Modules/CMakeASMCompiler.cmake.in
  66. 2 2
      Modules/CMakeASMInformation.cmake
  67. 1 1
      Modules/CMakeASM_MASMInformation.cmake
  68. 3 3
      Modules/CMakeCInformation.cmake
  69. 1 0
      Modules/CMakeCUDACompiler.cmake.in
  70. 6 6
      Modules/CMakeCUDAInformation.cmake
  71. 3 3
      Modules/CMakeCXXInformation.cmake
  72. 7 0
      Modules/CMakeDetermineASMCompiler.cmake
  73. 1 1
      Modules/CMakeDetermineCCompiler.cmake
  74. 29 25
      Modules/CMakeDetermineCUDACompiler.cmake
  75. 1 1
      Modules/CMakeDetermineCXXCompiler.cmake
  76. 14 0
      Modules/CMakeDetermineCompilerId.cmake
  77. 1 1
      Modules/CMakeDetermineFortranCompiler.cmake
  78. 1 1
      Modules/CMakeDetermineOBJCXXCompiler.cmake
  79. 1 0
      Modules/CMakeFindBinUtils.cmake
  80. 19 7
      Modules/CMakeFindFrameworks.cmake
  81. 2 2
      Modules/CMakeFortranInformation.cmake
  82. 3 3
      Modules/CMakeOBJCInformation.cmake
  83. 3 3
      Modules/CMakeOBJCXXInformation.cmake
  84. 12 12
      Modules/CPack.cmake
  85. 50 37
      Modules/CPackComponent.cmake
  86. 2 4
      Modules/CheckFortranSourceCompiles.cmake
  87. 2 4
      Modules/CheckFortranSourceRuns.cmake
  88. 8 8
      Modules/CheckLanguage.cmake
  89. 6 2
      Modules/CheckTypeSize.c.in
  90. 6 0
      Modules/Compiler/GNU-ASM.cmake
  91. 3 2
      Modules/Compiler/GNU.cmake
  92. 3 2
      Modules/Compiler/Intel.cmake
  93. 2 0
      Modules/Compiler/NVIDIA-CUDA.cmake
  94. 1 1
      Modules/Compiler/QCC-CXX.cmake
  95. 6 2
      Modules/Compiler/TI-C.cmake
  96. 1 0
      Modules/Compiler/XL-Fortran.cmake
  97. 26 16
      Modules/ExternalProject.cmake
  98. 27 2
      Modules/FetchContent.cmake
  99. 2 0
      Modules/FetchContent/CMakeLists.cmake.in
  100. 62 21
      Modules/FindArmadillo.cmake

+ 2 - 2
Auxiliary/CMakeLists.txt

@@ -1,4 +1,4 @@
-install(DIRECTORY vim/indent vim/syntax DESTINATION ${CMAKE_DATA_DIR}/editors/vim)
-install(FILES cmake-mode.el DESTINATION ${CMAKE_DATA_DIR}/editors/emacs)
+install(DIRECTORY vim/indent vim/syntax DESTINATION ${CMAKE_XDGDATA_DIR}/vim/vimfiles)
+install(FILES cmake-mode.el DESTINATION ${CMAKE_XDGDATA_DIR}/emacs/site-lisp)
 install(FILES cmake.m4 DESTINATION ${CMAKE_XDGDATA_DIR}/aclocal)
 install(FILES cmake.m4 DESTINATION ${CMAKE_XDGDATA_DIR}/aclocal)
 add_subdirectory (bash-completion)
 add_subdirectory (bash-completion)

+ 16 - 8
Auxiliary/bash-completion/CMakeLists.txt

@@ -1,8 +1,16 @@
-# Always install completion file in local dir
-# in order to be sure to always be able to install
-# in a local user directory rooted in a single directory.
-# packager should either patch that out or
-# add symlinks to the files in appropriate places
-#  /etc/bash_completion.d/
-#  DATADIR/completions (may be /usr/share/<package>/completions
-install(FILES cmake cpack ctest DESTINATION ${CMAKE_DATA_DIR}/completions)
+# We need to integrate into the system install, or this will silently fail to
+# accomplish anything at all, and packagers won't even know it exists. Use the
+# `<sharedir>/bash-completion/completions/` hierarchy by default, rooted in
+# CMake's XDGDATA_DIR definition of the sharedir. This works with installation
+# to `/usr` or `/usr/local` (or any prefix which bash-completion is configured
+# with) as well as a simple installation by a local user into their home
+# directory *if* the prefix is `$HOME/.local` since `.local/share/` is part of
+# the bash-completion search path too.
+# For more complex installations, packagers can set CMAKE_BASH_COMP_DIR to
+# another system location.
+
+set(CMAKE_BASH_COMP_DIR_DEFAULT ${CMAKE_XDGDATA_DIR}/bash-completion/completions)
+if (NOT CMAKE_BASH_COMP_DIR)
+  set(CMAKE_BASH_COMP_DIR "${CMAKE_BASH_COMP_DIR_DEFAULT}")
+endif()
+install(FILES cmake cpack ctest DESTINATION ${CMAKE_BASH_COMP_DIR})

+ 18 - 2
CMakeLists.txt

@@ -154,7 +154,7 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES)
 
 
   # Allow the user to enable/disable all system utility library options by
   # Allow the user to enable/disable all system utility library options by
   # defining CMAKE_USE_SYSTEM_LIBRARIES or CMAKE_USE_SYSTEM_LIBRARY_${util}.
   # defining CMAKE_USE_SYSTEM_LIBRARIES or CMAKE_USE_SYSTEM_LIBRARY_${util}.
-  set(UTILITIES BZIP2 CURL EXPAT FORM JSONCPP LIBARCHIVE LIBLZMA LIBRHASH LIBUV ZLIB ZSTD)
+  set(UTILITIES BZIP2 CURL EXPAT FORM JSONCPP LIBARCHIVE LIBLZMA LIBRHASH LIBUV NGHTTP2 ZLIB ZSTD)
   foreach(util ${UTILITIES})
   foreach(util ${UTILITIES})
     if(NOT DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util}
     if(NOT DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util}
         AND DEFINED CMAKE_USE_SYSTEM_LIBRARIES)
         AND DEFINED CMAKE_USE_SYSTEM_LIBRARIES)
@@ -192,6 +192,8 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES)
     "${CMAKE_USE_SYSTEM_LIBRARY_ZSTD}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
     "${CMAKE_USE_SYSTEM_LIBRARY_ZSTD}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
   CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_LIBLZMA "Use system-installed liblzma"
   CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_LIBLZMA "Use system-installed liblzma"
     "${CMAKE_USE_SYSTEM_LIBRARY_LIBLZMA}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
     "${CMAKE_USE_SYSTEM_LIBRARY_LIBLZMA}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
+  CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_NGHTTP2 "Use system-installed nghttp2"
+    "${CMAKE_USE_SYSTEM_LIBRARY_NGHTTP2}" "NOT CMAKE_USE_SYSTEM_CURL" ON)
   option(CMAKE_USE_SYSTEM_FORM "Use system-installed libform" "${CMAKE_USE_SYSTEM_LIBRARY_FORM}")
   option(CMAKE_USE_SYSTEM_FORM "Use system-installed libform" "${CMAKE_USE_SYSTEM_LIBRARY_FORM}")
   option(CMAKE_USE_SYSTEM_JSONCPP "Use system-installed jsoncpp" "${CMAKE_USE_SYSTEM_LIBRARY_JSONCPP}")
   option(CMAKE_USE_SYSTEM_JSONCPP "Use system-installed jsoncpp" "${CMAKE_USE_SYSTEM_LIBRARY_JSONCPP}")
   option(CMAKE_USE_SYSTEM_LIBRHASH "Use system-installed librhash" "${CMAKE_USE_SYSTEM_LIBRARY_LIBRHASH}")
   option(CMAKE_USE_SYSTEM_LIBRHASH "Use system-installed librhash" "${CMAKE_USE_SYSTEM_LIBRARY_LIBRHASH}")
@@ -465,9 +467,19 @@ macro (CMAKE_BUILD_UTILITIES)
       set(CURL_CA_PATH "" CACHE PATH "Path to SSL CA Certificate Directory")
       set(CURL_CA_PATH "" CACHE PATH "Path to SSL CA Certificate Directory")
       mark_as_advanced(CURL_CA_BUNDLE CURL_CA_PATH)
       mark_as_advanced(CURL_CA_BUNDLE CURL_CA_PATH)
     endif()
     endif()
+    if(NOT CMAKE_USE_SYSTEM_NGHTTP2)
+      # Tell curl's FindNGHTTP2 module to use our library.
+      set(NGHTTP2_LIBRARY cmnghttp2)
+      set(NGHTTP2_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmnghttp2/lib/includes)
+    endif()
     add_subdirectory(Utilities/cmcurl)
     add_subdirectory(Utilities/cmcurl)
     CMAKE_SET_TARGET_FOLDER(cmcurl "Utilities/3rdParty")
     CMAKE_SET_TARGET_FOLDER(cmcurl "Utilities/3rdParty")
     CMAKE_SET_TARGET_FOLDER(LIBCURL "Utilities/3rdParty")
     CMAKE_SET_TARGET_FOLDER(LIBCURL "Utilities/3rdParty")
+    if(NOT CMAKE_USE_SYSTEM_NGHTTP2)
+      # Configure after curl to re-use some check results.
+      add_subdirectory(Utilities/cmnghttp2)
+      CMAKE_SET_TARGET_FOLDER(cmnghttp2 "Utilities/3rdParty")
+    endif()
   endif()
   endif()
 
 
   #---------------------------------------------------------------------
   #---------------------------------------------------------------------
@@ -547,21 +559,25 @@ macro (CMAKE_BUILD_UTILITIES)
     set(ZLIB_INCLUDE_DIR ${CMAKE_ZLIB_INCLUDES})
     set(ZLIB_INCLUDE_DIR ${CMAKE_ZLIB_INCLUDES})
     set(ZLIB_LIBRARY ${CMAKE_ZLIB_LIBRARIES})
     set(ZLIB_LIBRARY ${CMAKE_ZLIB_LIBRARIES})
     add_definitions(-DLIBARCHIVE_STATIC)
     add_definitions(-DLIBARCHIVE_STATIC)
+    set(ENABLE_MBEDTLS OFF CACHE INTERNAL "Enable use of mbed TLS")
     set(ENABLE_NETTLE OFF CACHE INTERNAL "Enable use of Nettle")
     set(ENABLE_NETTLE OFF CACHE INTERNAL "Enable use of Nettle")
     set(ENABLE_OPENSSL ${CMAKE_USE_OPENSSL} CACHE INTERNAL "Enable use of OpenSSL")
     set(ENABLE_OPENSSL ${CMAKE_USE_OPENSSL} CACHE INTERNAL "Enable use of OpenSSL")
+    set(ENABLE_LIBB2 OFF CACHE INTERNAL "Enable the use of the system LIBB2 library if found")
     set(ENABLE_LZMA ON CACHE INTERNAL "Enable the use of the system LZMA library if found")
     set(ENABLE_LZMA ON CACHE INTERNAL "Enable the use of the system LZMA library if found")
     set(ENABLE_LZ4 OFF CACHE INTERNAL "Enable the use of the system LZ4 library if found")
     set(ENABLE_LZ4 OFF CACHE INTERNAL "Enable the use of the system LZ4 library if found")
     set(ENABLE_LZO OFF CACHE INTERNAL "Enable the use of the system LZO library if found")
     set(ENABLE_LZO OFF CACHE INTERNAL "Enable the use of the system LZO library if found")
     set(ENABLE_ZLIB ON CACHE INTERNAL "Enable the use of the system ZLIB library if found")
     set(ENABLE_ZLIB ON CACHE INTERNAL "Enable the use of the system ZLIB library if found")
     set(ENABLE_BZip2 ON CACHE INTERNAL "Enable the use of the system BZip2 library if found")
     set(ENABLE_BZip2 ON CACHE INTERNAL "Enable the use of the system BZip2 library if found")
+    set(ENABLE_ZSTD ON CACHE INTERNAL "Enable the use of the system zstd library if found")
     set(ENABLE_LIBXML2 OFF CACHE INTERNAL "Enable the use of the system libxml2 library if found")
     set(ENABLE_LIBXML2 OFF CACHE INTERNAL "Enable the use of the system libxml2 library if found")
-    set(ENABLE_EXPAT ON CACHE INTERNAL "Enable the use of the system EXPAT library if found")
+    set(ENABLE_EXPAT OFF CACHE INTERNAL "Enable the use of the system EXPAT library if found")
     set(ENABLE_PCREPOSIX OFF CACHE INTERNAL "Enable the use of the system PCREPOSIX library if found")
     set(ENABLE_PCREPOSIX OFF CACHE INTERNAL "Enable the use of the system PCREPOSIX library if found")
     set(ENABLE_LibGCC OFF CACHE INTERNAL "Enable the use of the system LibGCC library if found")
     set(ENABLE_LibGCC OFF CACHE INTERNAL "Enable the use of the system LibGCC library if found")
     set(ENABLE_XATTR OFF CACHE INTERNAL "Enable extended attribute support")
     set(ENABLE_XATTR OFF CACHE INTERNAL "Enable extended attribute support")
     set(ENABLE_ACL OFF CACHE INTERNAL "Enable ACL support")
     set(ENABLE_ACL OFF CACHE INTERNAL "Enable ACL support")
     set(ENABLE_ICONV OFF CACHE INTERNAL "Enable iconv support")
     set(ENABLE_ICONV OFF CACHE INTERNAL "Enable iconv support")
     set(ENABLE_CNG OFF CACHE INTERNAL "Enable the use of CNG(Crypto Next Generation)")
     set(ENABLE_CNG OFF CACHE INTERNAL "Enable the use of CNG(Crypto Next Generation)")
+    SET(POSIX_REGEX_LIB "" CACHE INTERNAL "Choose what library should provide POSIX regular expression support")
     add_subdirectory(Utilities/cmlibarchive)
     add_subdirectory(Utilities/cmlibarchive)
     CMAKE_SET_TARGET_FOLDER(cmlibarchive "Utilities/3rdParty")
     CMAKE_SET_TARGET_FOLDER(cmlibarchive "Utilities/3rdParty")
     set(CMAKE_TAR_LIBRARIES cmlibarchive ${BZIP2_LIBRARIES})
     set(CMAKE_TAR_LIBRARIES cmlibarchive ${BZIP2_LIBRARIES})

+ 2 - 0
CTestCustom.cmake.in

@@ -99,6 +99,8 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
   "liblzma/common/index_encoder.c:[0-9]+:[0-9]+: warning: Value stored to .* during its initialization is never read"
   "liblzma/common/index_encoder.c:[0-9]+:[0-9]+: warning: Value stored to .* during its initialization is never read"
   "libuv/src/.*:[0-9]+:[0-9]+: warning: Dereference of null pointer"
   "libuv/src/.*:[0-9]+:[0-9]+: warning: Dereference of null pointer"
   "libuv/src/.*:[0-9]+:[0-9]+: warning: The left operand of '==' is a garbage value"
   "libuv/src/.*:[0-9]+:[0-9]+: warning: The left operand of '==' is a garbage value"
+  "nghttp2/lib/.*:[0-9]+:[0-9]+: warning: Dereference of null pointer"
+  "nghttp2/lib/.*:[0-9]+:[0-9]+: warning: Value stored to .* is never read"
   )
   )
 
 
 if(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode")
 if(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode")

+ 7 - 2
Help/command/FIND_XXX.txt

@@ -15,6 +15,7 @@ The general signature is:
              [PATHS path1 [path2 ... ENV var]]
              [PATHS path1 [path2 ... ENV var]]
              [PATH_SUFFIXES suffix1 [suffix2 ...]]
              [PATH_SUFFIXES suffix1 [suffix2 ...]]
              [DOC "cache documentation string"]
              [DOC "cache documentation string"]
+             [REQUIRED]
              [NO_DEFAULT_PATH]
              [NO_DEFAULT_PATH]
              [NO_PACKAGE_ROOT_PATH]
              [NO_PACKAGE_ROOT_PATH]
              [NO_CMAKE_PATH]
              [NO_CMAKE_PATH]
@@ -31,8 +32,9 @@ A cache entry named by ``<VAR>`` is created to store the result
 of this command.
 of this command.
 If the |SEARCH_XXX| is found the result is stored in the variable
 If the |SEARCH_XXX| is found the result is stored in the variable
 and the search will not be repeated unless the variable is cleared.
 and the search will not be repeated unless the variable is cleared.
-If nothing is found, the result will be
-``<VAR>-NOTFOUND``, and the search will be attempted again the
+If nothing is found, the result will be ``<VAR>-NOTFOUND``.
+The ``REQUIRED`` option stops processing with an error message if nothing
+is found, otherwise the search will be attempted again the
 next time |FIND_XXX| is invoked with the same variable.
 next time |FIND_XXX| is invoked with the same variable.
 
 
 Options include:
 Options include:
@@ -57,6 +59,9 @@ Options include:
 ``DOC``
 ``DOC``
   Specify the documentation string for the ``<VAR>`` cache entry.
   Specify the documentation string for the ``<VAR>`` cache entry.
 
 
+``REQUIRED``
+  Stop processing with an error message if nothing is found.
+
 If ``NO_DEFAULT_PATH`` is specified, then no additional paths are
 If ``NO_DEFAULT_PATH`` is specified, then no additional paths are
 added to the search.
 added to the search.
 If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
 If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:

+ 90 - 0
Help/command/cmake_command.rst

@@ -0,0 +1,90 @@
+cmake_command
+-------------
+
+Call meta-operations on CMake commands.
+
+Synopsis
+^^^^^^^^
+
+.. parsed-literal::
+
+  cmake_command(`INVOKE`_ <command> [<args>...])
+  cmake_command(`EVAL`_ CODE <code>...)
+
+Introduction
+^^^^^^^^^^^^
+
+This command will call meta-operations on built-in CMake commands or
+those created via the :command:`macro` or :command:`function` commands.
+
+``cmake_command`` does not introduce a new variable or policy scope.
+
+Invoking Commands
+^^^^^^^^^^^^^^^^^
+
+.. _INVOKE:
+
+.. code-block:: cmake
+
+  cmake_command(INVOKE <command> [<args>...])
+
+Invokes the named ``<command>`` with the given arguments (if any).
+For example, the code:
+
+.. code-block:: cmake
+
+  set(message_command "message")
+  cmake_command(INVOKE ${message_command} STATUS "Hello World!")
+
+is equivalent to
+
+.. code-block:: cmake
+
+  message(STATUS "Hello World!")
+
+Evaluating Code
+^^^^^^^^^^^^^^^
+
+.. _EVAL:
+
+.. code-block:: cmake
+
+  cmake_command(EVAL CODE <code>...)
+
+Evaluates the ``<code>...`` as CMake code.
+
+For example, the code:
+
+.. code-block:: cmake
+
+  set(A TRUE)
+  set(B TRUE)
+  set(C TRUE)
+  set(condition "(A AND B) OR C")
+
+  cmake_command(EVAL CODE "
+    if (${condition})
+      message(STATUS TRUE)
+    else()
+      message(STATUS FALSE)
+    endif()"
+  )
+
+is equivalent to
+
+.. code-block:: cmake
+
+  set(A TRUE)
+  set(B TRUE)
+  set(C TRUE)
+  set(condition "(A AND B) OR C")
+
+  file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/eval.cmake "
+    if (${condition})
+      message(STATUS TRUE)
+    else()
+      message(STATUS FALSE)
+    endif()"
+  )
+
+  include(${CMAKE_CURRENT_BINARY_DIR}/eval.cmake)

+ 12 - 1
Help/command/execute_process.rst

@@ -21,7 +21,9 @@ Execute one or more child processes.
                   [COMMAND_ECHO <where>]
                   [COMMAND_ECHO <where>]
                   [OUTPUT_STRIP_TRAILING_WHITESPACE]
                   [OUTPUT_STRIP_TRAILING_WHITESPACE]
                   [ERROR_STRIP_TRAILING_WHITESPACE]
                   [ERROR_STRIP_TRAILING_WHITESPACE]
-                  [ENCODING <name>])
+                  [ENCODING <name>]
+                  [ECHO_OUTPUT_VARIABLE]
+                  [ECHO_ERROR_VARIABLE])
 
 
 Runs the given sequence of one or more commands.
 Runs the given sequence of one or more commands.
 
 
@@ -105,6 +107,15 @@ Options:
    for this encoding. In CMake 3.11.0, ``UTF-8`` was added for consistency with
    for this encoding. In CMake 3.11.0, ``UTF-8`` was added for consistency with
    the `UTF-8 RFC <https://www.ietf.org/rfc/rfc3629>`_ naming convention.
    the `UTF-8 RFC <https://www.ietf.org/rfc/rfc3629>`_ naming convention.
 
 
+``ECHO_OUTPUT_VARIABLE``, ``ECHO_ERROR_VARIABLE``
+  The standard output or standard error will not be exclusively redirected to
+  the configured variables.
+
+  The output will be duplicated, it will be sent into the configured variables
+  and also on standard output or standard error.
+
+  This is analogous to the ``tee`` Unix command.
+
 If more than one ``OUTPUT_*`` or ``ERROR_*`` option is given for the
 If more than one ``OUTPUT_*`` or ``ERROR_*`` option is given for the
 same pipe the precedence is not specified.
 same pipe the precedence is not specified.
 If no ``OUTPUT_*`` or ``ERROR_*`` options are given the output will
 If no ``OUTPUT_*`` or ``ERROR_*`` options are given the output will

+ 108 - 3
Help/command/file.rst

@@ -19,6 +19,7 @@ Synopsis
     file({`WRITE`_ | `APPEND`_} <filename> <content>...)
     file({`WRITE`_ | `APPEND`_} <filename> <content>...)
     file({`TOUCH`_ | `TOUCH_NOCREATE`_} [<file>...])
     file({`TOUCH`_ | `TOUCH_NOCREATE`_} [<file>...])
     file(`GENERATE`_ OUTPUT <output-file> [...])
     file(`GENERATE`_ OUTPUT <output-file> [...])
+    file(`CONFIGURE`_ OUTPUT <output-file> CONTENT <content> [...])
 
 
   `Filesystem`_
   `Filesystem`_
     file({`GLOB`_ | `GLOB_RECURSE`_} <out-var> [...] [<globbing-expr>...])
     file({`GLOB`_ | `GLOB_RECURSE`_} <out-var> [...] [<globbing-expr>...])
@@ -41,6 +42,10 @@ Synopsis
   `Locking`_
   `Locking`_
     file(`LOCK`_ <path> [...])
     file(`LOCK`_ <path> [...])
 
 
+   `Archiving`_
+     file(`ARCHIVE_CREATE`_ OUTPUT <archive> FILES <files> [...])
+     file(`ARCHIVE_EXTRACT`_ INPUT <archive> DESTINATION <dir> [...])
+
 Reading
 Reading
 ^^^^^^^
 ^^^^^^^
 
 
@@ -54,7 +59,9 @@ Reading
 Read content from a file called ``<filename>`` and store it in a
 Read content from a file called ``<filename>`` and store it in a
 ``<variable>``.  Optionally start from the given ``<offset>`` and
 ``<variable>``.  Optionally start from the given ``<offset>`` and
 read at most ``<max-in>`` bytes.  The ``HEX`` option causes data to
 read at most ``<max-in>`` bytes.  The ``HEX`` option causes data to
-be converted to a hexadecimal representation (useful for binary data).
+be converted to a hexadecimal representation (useful for binary data). If the
+``HEX`` option is specified, letters in the output (``a`` through ``f``) are in
+lowercase.
 
 
 .. _STRINGS:
 .. _STRINGS:
 
 
@@ -395,8 +402,8 @@ dependency resolution:
   Determines the path to the tool to use for dependency resolution. This is the
   Determines the path to the tool to use for dependency resolution. This is the
   actual path to ``objdump``, ``dumpbin``, or ``otool``.
   actual path to ``objdump``, ``dumpbin``, or ``otool``.
 
 
-  If this variable is not specified, it is determined automatically by system
-  introspection.
+  If this variable is not specified, it is determined by the value of
+  ``CMAKE_OBJDUMP`` if set, else by system introspection.
 
 
 Writing
 Writing
 ^^^^^^^
 ^^^^^^^
@@ -482,6 +489,45 @@ generation phase. The output file will not yet have been written when the
 ``file(GENERATE)`` command returns, it is written only after processing all
 ``file(GENERATE)`` command returns, it is written only after processing all
 of a project's ``CMakeLists.txt`` files.
 of a project's ``CMakeLists.txt`` files.
 
 
+.. _CONFIGURE:
+
+.. code-block:: cmake
+
+  file(CONFIGURE OUTPUT output-file
+       CONTENT content
+       [ESCAPE_QUOTES] [@ONLY]
+       [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])
+
+Generate an output file using the input given by ``CONTENT`` and substitute
+variable values referenced as ``@VAR@`` or ``${VAR}`` contained therein. The
+substitution rules behave the same as the :command:`configure_file` command.
+In order to match :command:`configure_file`'s behavior, generator expressions
+are not supported for both ``OUTPUT`` and ``CONTENT``.
+
+The arguments are:
+
+``OUTPUT <output-file>``
+  Specify the output file name to generate. A relative path is treated with
+  respect to the value of :variable:`CMAKE_CURRENT_BINARY_DIR`. See policy
+  :policy:`CMP0070`.
+  ``<output-file>`` does not support generator expressions.
+
+``CONTENT <content>``
+  Use the content given explicitly as input.
+  ``<content>`` does not support generator expressions.
+
+``ESCAPE_QUOTES``
+  Escape any substituted quotes with backslashes (C-style).
+
+``@ONLY``
+  Restrict variable replacement to references of the form ``@VAR@``.
+  This is useful for configuring scripts that use ``${VAR}`` syntax.
+
+``NEWLINE_STYLE <style>``
+  Specify the newline style for the output file.  Specify
+  ``UNIX`` or ``LF`` for ``\n`` newlines, or specify
+  ``DOS``, ``WIN32``, or ``CRLF`` for ``\r\n`` newlines.
+
 Filesystem
 Filesystem
 ^^^^^^^^^^
 ^^^^^^^^^^
 
 
@@ -846,3 +892,62 @@ child directory or file.
 Trying to lock file twice is not allowed.  Any intermediate directories and
 Trying to lock file twice is not allowed.  Any intermediate directories and
 file itself will be created if they not exist.  ``GUARD`` and ``TIMEOUT``
 file itself will be created if they not exist.  ``GUARD`` and ``TIMEOUT``
 options ignored on ``RELEASE`` operation.
 options ignored on ``RELEASE`` operation.
+
+Archiving
+^^^^^^^^^
+
+.. _ARCHIVE_CREATE:
+
+.. code-block:: cmake
+
+  file(ARCHIVE_CREATE OUTPUT <archive>
+    [FILES <files>]
+    [DIRECTORY <dirs>]
+    [FORMAT <format>]
+    [TYPE <type>]
+    [MTIME <mtime>]
+    [VERBOSE])
+
+Creates an archive specifed by ``OUTPUT`` with the content of ``FILES`` and
+``DIRECTORY``.
+
+To specify the format of the archive set the ``FORMAT`` option.
+Supported formats are: ``7zip``, ``gnutar``, ``pax``, ``paxr``, ``raw``,
+(restricted pax, default), and ``zip``.
+
+To specify the type of compression set the ``TYPE`` option.
+Supported compression types are: ``None``, ``BZip2``, ``GZip``, ``XZ``,
+and ``Zstd``.
+
+.. note::
+  With ``FORMAT`` set to ``raw`` only one file will be compressed with the
+  compression type specified by ``TYPE``.
+
+With ``VERBOSE`` the command will produce verbose output.
+
+To specify the modification time recorded in tarball entries use
+the ``MTIME`` option.
+
+.. _ARCHIVE_EXTRACT:
+
+.. code-block:: cmake
+
+  file(ARCHIVE_EXTRACT INPUT <archive>
+    [FILES <files>]
+    [DIRECTORY <dirs>]
+    [DESTINATION <dir>]
+    [LIST_ONLY]
+    [VERBOSE])
+
+Extracts or lists the content of an archive specified by ``INPUT``.
+
+The directory where the content of the archive will be extracted can
+be specified via ``DESTINATION``. If the directory does not exit, it
+will be created.
+
+To select which files and directories will be extracted or listed
+use  ``FILES`` and ``DIRECTORY`` options.
+
+``LIST_ONLY`` will only list the files in the archive.
+
+With ``VERBOSE`` the command will produce verbose output.

+ 4 - 0
Help/command/function.rst

@@ -44,11 +44,15 @@ can be invoked through any of
   foo()
   foo()
   Foo()
   Foo()
   FOO()
   FOO()
+  cmake_command(INVOKE foo)
 
 
 and so on. However, it is strongly recommended to stay with the
 and so on. However, it is strongly recommended to stay with the
 case chosen in the function definition. Typically functions use
 case chosen in the function definition. Typically functions use
 all-lowercase names.
 all-lowercase names.
 
 
+The :command:`cmake_command(INVOKE ...)` command can also be used to invoke the
+function.
+
 Arguments
 Arguments
 ^^^^^^^^^
 ^^^^^^^^^
 
 

+ 46 - 20
Help/command/install.rst

@@ -30,13 +30,20 @@ signatures that specify them.  The common options are:
 
 
 ``DESTINATION``
 ``DESTINATION``
   Specify the directory on disk to which a file will be installed.
   Specify the directory on disk to which a file will be installed.
-  If a full path (with a leading slash or drive letter) is given
-  it is used directly.  If a relative path is given it is interpreted
-  relative to the value of the :variable:`CMAKE_INSTALL_PREFIX` variable.
+  Arguments can be relative or absolute paths.
+
+  If a relative path is given it is interpreted relative to the value
+  of the :variable:`CMAKE_INSTALL_PREFIX` variable.
   The prefix can be relocated at install time using the ``DESTDIR``
   The prefix can be relocated at install time using the ``DESTDIR``
   mechanism explained in the :variable:`CMAKE_INSTALL_PREFIX` variable
   mechanism explained in the :variable:`CMAKE_INSTALL_PREFIX` variable
   documentation.
   documentation.
 
 
+  If an absolute path (with a leading slash or drive letter) is given
+  it is used verbatim.
+
+  As absolute paths are not supported by :manual:`cpack <cpack(1)>` installer
+  generators, it is preferable to use relative paths throughout.
+
 ``PERMISSIONS``
 ``PERMISSIONS``
   Specify permissions for installed files.  Valid permissions are
   Specify permissions for installed files.  Valid permissions are
   ``OWNER_READ``, ``OWNER_WRITE``, ``OWNER_EXECUTE``, ``GROUP_READ``,
   ``OWNER_READ``, ``OWNER_WRITE``, ``OWNER_EXECUTE``, ``GROUP_READ``,
@@ -119,31 +126,38 @@ Installing Targets
           )
           )
 
 
 The ``TARGETS`` form specifies rules for installing targets from a
 The ``TARGETS`` form specifies rules for installing targets from a
-project.  There are several kinds of target files that may be installed:
+project.  There are several kinds of target :ref:`Output Artifacts`
+that may be installed:
 
 
 ``ARCHIVE``
 ``ARCHIVE``
-  Static libraries are treated as ``ARCHIVE`` targets, except those
-  marked with the ``FRAMEWORK`` property on macOS (see ``FRAMEWORK``
-  below.) For DLL platforms (all Windows-based systems including
-  Cygwin), the DLL import library is treated as an ``ARCHIVE`` target.
-  On AIX, the linker import file created for executables with
-  :prop_tgt:`ENABLE_EXPORTS` is treated as an ``ARCHIVE`` target.
+  Target artifacts of this kind include:
+
+  * *Static libraries*
+    (except on macOS when marked as ``FRAMEWORK``, see below);
+  * *DLL import libraries*
+    (on all Windows-based systems including Cygwin; they have extension
+    ``.lib``, in contrast to the ``.dll`` libraries that go to ``RUNTIME``);
+  * On AIX, the *linker import file* created for executables with
+    :prop_tgt:`ENABLE_EXPORTS` enabled.
 
 
 ``LIBRARY``
 ``LIBRARY``
-  Module libraries are always treated as ``LIBRARY`` targets. For non-
-  DLL platforms shared libraries are treated as ``LIBRARY`` targets,
-  except those marked with the ``FRAMEWORK`` property on macOS (see
-  ``FRAMEWORK`` below.)
+  Target artifacts of this kind include:
+
+  * *Shared libraries*, except
+
+    - DLLs (these go to ``RUNTIME``, see below),
+    - on macOS when marked as ``FRAMEWORK`` (see below).
 
 
 ``RUNTIME``
 ``RUNTIME``
-  Executables are treated as ``RUNTIME`` objects, except those marked
-  with the ``MACOSX_BUNDLE`` property on macOS (see ``BUNDLE`` below.)
-  For DLL platforms (all Windows-based systems including Cygwin), the
-  DLL part of a shared library is treated as a ``RUNTIME`` target.
+  Target artifacts of this kind include:
+
+  * *Executables*
+    (except on macOS when marked as ``MACOSX_BUNDLE``, see ``BUNDLE`` below);
+  * DLLs (on all Windows-based systems including Cygwin; note that the
+    accompanying import libraries are of kind ``ARCHIVE``).
 
 
 ``OBJECTS``
 ``OBJECTS``
-  Object libraries (a simple group of object files) are always treated
-  as ``OBJECTS`` targets.
+  Object files associated with *object libraries*.
 
 
 ``FRAMEWORK``
 ``FRAMEWORK``
   Both static and shared libraries marked with the ``FRAMEWORK``
   Both static and shared libraries marked with the ``FRAMEWORK``
@@ -630,6 +644,13 @@ present, causes the contents of the properties matching
 ``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?`` to be exported, when
 ``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?`` to be exported, when
 policy :policy:`CMP0022` is ``NEW``.
 policy :policy:`CMP0022` is ``NEW``.
 
 
+.. note::
+  The installed ``<export-name>.cmake`` file may come with additional
+  per-configuration ``<export-name>-*.cmake`` files to be loaded by
+  globbing.  Do not use an export name that is the same as the package
+  name in combination with installing a ``<package-name>-config.cmake``
+  file or the latter may be incorrectly matched by the glob and loaded.
+
 When a ``COMPONENT`` option is given, the listed ``<component>`` implicitly
 When a ``COMPONENT`` option is given, the listed ``<component>`` implicitly
 depends on all components mentioned in the export set. The exported
 depends on all components mentioned in the export set. The exported
 ``<name>.cmake`` file will require each of the exported components to be
 ``<name>.cmake`` file will require each of the exported components to be
@@ -684,6 +705,11 @@ executable from the installation tree using the imported target name
 Generated Installation Script
 Generated Installation Script
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 
+.. note::
+
+  Use of this feature is not recommended. Please consider using the
+  ``--install`` argument of :manual:`cmake(1)` instead.
+
 The ``install()`` command generates a file, ``cmake_install.cmake``, inside
 The ``install()`` command generates a file, ``cmake_install.cmake``, inside
 the build directory, which is used internally by the generated install target
 the build directory, which is used internally by the generated install target
 and by CPack. You can also invoke this script manually with ``cmake -P``. This
 and by CPack. You can also invoke this script manually with ``cmake -P``. This

+ 4 - 0
Help/command/macro.rst

@@ -42,11 +42,15 @@ can be invoked through any of
   foo()
   foo()
   Foo()
   Foo()
   FOO()
   FOO()
+  cmake_command(INVOKE foo)
 
 
 and so on. However, it is strongly recommended to stay with the
 and so on. However, it is strongly recommended to stay with the
 case chosen in the macro definition.  Typically macros use
 case chosen in the macro definition.  Typically macros use
 all-lowercase names.
 all-lowercase names.
 
 
+The :command:`cmake_command(INVOKE ...)` command can also be used to invoke the
+macro.
+
 Arguments
 Arguments
 ^^^^^^^^^
 ^^^^^^^^^
 
 

+ 17 - 4
Help/command/string.rst

@@ -11,8 +11,6 @@ Synopsis
   `Search and Replace`_
   `Search and Replace`_
     string(`FIND`_ <string> <substring> <out-var> [...])
     string(`FIND`_ <string> <substring> <out-var> [...])
     string(`REPLACE`_ <match-string> <replace-string> <out-var> <input>...)
     string(`REPLACE`_ <match-string> <replace-string> <out-var> <input>...)
-
-  `Regular Expressions`_
     string(`REGEX MATCH`_ <match-regex> <out-var> <input>...)
     string(`REGEX MATCH`_ <match-regex> <out-var> <input>...)
     string(`REGEX MATCHALL`_ <match-regex> <out-var> <input>...)
     string(`REGEX MATCHALL`_ <match-regex> <out-var> <input>...)
     string(`REGEX REPLACE`_ <match-regex> <replace-expr> <out-var> <input>...)
     string(`REGEX REPLACE`_ <match-regex> <replace-expr> <out-var> <input>...)
@@ -38,6 +36,7 @@ Synopsis
 
 
   `Generation`_
   `Generation`_
     string(`ASCII`_ <number>... <out-var>)
     string(`ASCII`_ <number>... <out-var>)
+    string(`HEX`_ <string> <out-var>)
     string(`CONFIGURE`_ <string> <out-var> [...])
     string(`CONFIGURE`_ <string> <out-var> [...])
     string(`MAKE_C_IDENTIFIER`_ <string> <out-var>)
     string(`MAKE_C_IDENTIFIER`_ <string> <out-var>)
     string(`RANDOM`_ [<option>...] <out-var>)
     string(`RANDOM`_ [<option>...] <out-var>)
@@ -47,6 +46,9 @@ Synopsis
 Search and Replace
 Search and Replace
 ^^^^^^^^^^^^^^^^^^
 ^^^^^^^^^^^^^^^^^^
 
 
+Search and Replace With Plain Strings
+"""""""""""""""""""""""""""""""""""""
+
 .. _FIND:
 .. _FIND:
 
 
 .. code-block:: cmake
 .. code-block:: cmake
@@ -74,8 +76,8 @@ so strings containing multi-byte characters may lead to unexpected results.
 Replace all occurrences of ``<match_string>`` in the ``<input>``
 Replace all occurrences of ``<match_string>`` in the ``<input>``
 with ``<replace_string>`` and store the result in the ``<output_variable>``.
 with ``<replace_string>`` and store the result in the ``<output_variable>``.
 
 
-Regular Expressions
-^^^^^^^^^^^^^^^^^^^
+Search and Replace With Regular Expressions
+"""""""""""""""""""""""""""""""""""""""""""
 
 
 .. _`REGEX MATCH`:
 .. _`REGEX MATCH`:
 
 
@@ -87,6 +89,7 @@ Regular Expressions
 Match the ``<regular_expression>`` once and store the match in the
 Match the ``<regular_expression>`` once and store the match in the
 ``<output_variable>``.
 ``<output_variable>``.
 All ``<input>`` arguments are concatenated before matching.
 All ``<input>`` arguments are concatenated before matching.
+Regular expressions are specified in the subsection just below.
 
 
 .. _`REGEX MATCHALL`:
 .. _`REGEX MATCHALL`:
 
 
@@ -353,6 +356,16 @@ Generation
 
 
 Convert all numbers into corresponding ASCII characters.
 Convert all numbers into corresponding ASCII characters.
 
 
+.. _HEX:
+
+.. code-block:: cmake
+
+  string(HEX <string> <output_variable>)
+
+Convert each byte in the input ``<string>`` to its hexadecimal representation
+and store the concatenated hex digits in the ``<output_variable>``. Letters in
+the output (``a`` through ``f``) are in lowercase.
+
 .. _CONFIGURE:
 .. _CONFIGURE:
 
 
 .. code-block:: cmake
 .. code-block:: cmake

+ 52 - 13
Help/cpack_gen/archive.rst

@@ -1,8 +1,8 @@
 CPack Archive Generator
 CPack Archive Generator
 -----------------------
 -----------------------
 
 
-Archive CPack generator that supports packaging of sources and binaries in
-different formats:
+CPack generator for packaging files into an archive, which can have
+any of the following formats:
 
 
   - 7Z - 7zip - (.7z)
   - 7Z - 7zip - (.7z)
   - TBZ2 (.tar.bz2)
   - TBZ2 (.tar.bz2)
@@ -12,25 +12,64 @@ different formats:
   - TZST (.tar.zst)
   - TZST (.tar.zst)
   - ZIP (.zip)
   - ZIP (.zip)
 
 
+When this generator is called from ``CPackSourceConfig.cmake`` (or through
+the ``package_source`` target), then the generated archive will contain all
+files in the project directory, except those specified in
+:variable:`CPACK_SOURCE_IGNORE_FILES`.  The following is one example of
+packaging all source files of a project:
+
+.. code-block:: cmake
+
+  set(CPACK_SOURCE_GENERATOR "TGZ")
+  set(CPACK_SOURCE_IGNORE_FILES
+    \\.git/
+    build/
+    ".*~$"
+  )
+  set(CPACK_VERBATIM_VARIABLES YES)
+  include(CPack)
+
+When this generator is called from ``CPackConfig.cmake`` (or through the
+``package`` target), then the generated archive will contain all files
+that have been installed via CMake's :command:`install` command (and the
+deprecated commands :command:`install_files`, :command:`install_programs`,
+and :command:`install_targets`).
+
 Variables specific to CPack Archive generator
 Variables specific to CPack Archive generator
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 
 .. variable:: CPACK_ARCHIVE_FILE_NAME
 .. variable:: CPACK_ARCHIVE_FILE_NAME
               CPACK_ARCHIVE_<component>_FILE_NAME
               CPACK_ARCHIVE_<component>_FILE_NAME
 
 
- Package file name without extension which is added automatically depending
- on the archive format.
-
- * Mandatory : YES
- * Default   : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].<extension>`` with
-               spaces replaced by '-'
+  Package file name without extension. The extension is determined from the
+  archive format (see list above) and automatically appended to the file name.
+  The default is ``<CPACK_PACKAGE_FILE_NAME>[-<component>]``, with spaces
+  replaced by '-'.
 
 
 .. variable:: CPACK_ARCHIVE_COMPONENT_INSTALL
 .. variable:: CPACK_ARCHIVE_COMPONENT_INSTALL
 
 
- Enable component packaging for CPackArchive
+  Enable component packaging. If enabled (ON), then the archive generator
+  creates  multiple packages. The default is OFF, which means that a single
+  package containing files of all components is generated.
+
+Variables used by CPack Archive generator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+These variables are used by the Archive generator, but are also available to
+CPack generators which are essentially archives at their core. These include:
+
+  - :cpack_gen:`CPack Cygwin Generator`
+  - :cpack_gen:`CPack FreeBSD Generator`
+
+.. variable:: CPACK_ARCHIVE_THREADS
+
+  The number of threads to use when performing the compression. If set to
+  ``0``, the number of available cores on the machine will be used instead.
+  The default is ``1`` which limits compression to a single thread. Note that
+  not all compression modes support threading in all environments. Currently,
+  only the XZ compression may support it.
 
 
- * Mandatory : NO
- * Default   : OFF
+.. note::
 
 
- If enabled (ON) multiple packages are generated. By default a single package
- containing files of all components is generated.
+    Official CMake binaries available on ``cmake.org`` ship with a ``liblzma``
+    that does not support parallel compression.

+ 5 - 0
Help/cpack_gen/cygwin.rst

@@ -3,6 +3,11 @@ CPack Cygwin Generator
 
 
 Cygwin CPack generator (Cygwin).
 Cygwin CPack generator (Cygwin).
 
 
+Variables affecting the CPack Cygwin generator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+  - :variable:`CPACK_ARCHIVE_THREADS`
+
 Variables specific to CPack Cygwin generator
 Variables specific to CPack Cygwin generator
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 

+ 5 - 0
Help/cpack_gen/freebsd.rst

@@ -3,6 +3,11 @@ CPack FreeBSD Generator
 
 
 The built in (binary) CPack FreeBSD (pkg) generator (Unix only)
 The built in (binary) CPack FreeBSD (pkg) generator (Unix only)
 
 
+Variables affecting the CPack FreeBSD (pkg) generator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+  - :variable:`CPACK_ARCHIVE_THREADS`
+
 Variables specific to CPack FreeBSD (pkg) generator
 Variables specific to CPack FreeBSD (pkg) generator
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 

+ 95 - 82
Help/cpack_gen/ifw.rst

@@ -1,73 +1,28 @@
 CPack IFW Generator
 CPack IFW Generator
 -------------------
 -------------------
 
 
+Configure and run the Qt Installer Framework to generate a Qt installer.
+
+.. only:: html
+
+  .. contents::
+
 Overview
 Overview
 ^^^^^^^^
 ^^^^^^^^
 
 
 This :manual:`cpack generator <cpack-generators(7)>` generates
 This :manual:`cpack generator <cpack-generators(7)>` generates
 configuration and meta information for the `Qt Installer Framework
 configuration and meta information for the `Qt Installer Framework
-<http://doc.qt.io/qtinstallerframework/index.html>`_ (QtIFW).
+<http://doc.qt.io/qtinstallerframework/index.html>`_ (QtIFW),
+and runs QtIFW tools to generate a Qt installer.
 
 
 QtIFW provides tools and utilities to create installers for
 QtIFW provides tools and utilities to create installers for
 the platforms supported by `Qt <https://www.qt.io>`_: Linux,
 the platforms supported by `Qt <https://www.qt.io>`_: Linux,
 Microsoft Windows, and macOS.
 Microsoft Windows, and macOS.
 
 
-To make use of this generator, QtIFW should also be installed.
-The module :module:`CPackIFW` looks for the location of the
-QtIFW command-line utilities.
-
-Hints
-^^^^^
-
-Generally, the CPack ``IFW`` generator automatically finds QtIFW tools,
-but if you don't use a default path for installation of the QtIFW tools,
-the path may be specified in either a CMake or an environment variable:
-
-.. variable:: CPACK_IFW_ROOT
-
- An CMake variable which specifies the location of the QtIFW tool suite.
-
- The variable will be cached in the ``CPackConfig.cmake`` file and used at
- CPack runtime.
-
-.. variable:: QTIFWDIR
-
- An environment variable which specifies the location of the QtIFW tool
- suite.
-
-.. note::
-  The specified path should not contain "bin" at the end
-  (for example: "D:\\DevTools\\QtIFW2.0.5").
-
-The :variable:`CPACK_IFW_ROOT` variable has a higher priority and overrides
-the value of the :variable:`QTIFWDIR` variable.
-
-Internationalization
-^^^^^^^^^^^^^^^^^^^^
-
-Some variables and command arguments support internationalization via
-CMake script. This is an optional feature.
-
-Installers created by QtIFW tools have built-in support for
-internationalization and many phrases are localized to many languages,
-but this does not apply to the description of the your components and groups
-that will be distributed.
-
-Localization of the description of your components and groups is useful for
-users of your installers.
-
-A localized variable or argument can contain a single default value, and a
-set of pairs the name of the locale and the localized value.
-
-For example:
-
-.. code-block:: cmake
-
-   set(LOCALIZABLE_VARIABLE "Default value"
-     en "English value"
-     en_US "American value"
-     en_GB "Great Britain value"
-     )
+To make use of this generator, QtIFW needs to be installed.
+The :module:`CPackIFW` module looks for the location of the
+QtIFW command-line utilities, and defines several commands to
+control the behavior of this generator.
 
 
 Variables
 Variables
 ^^^^^^^^^
 ^^^^^^^^^
@@ -157,6 +112,8 @@ Package
  Default target directory for installation.
  Default target directory for installation.
  By default used
  By default used
  "@ApplicationsDir@/:variable:`CPACK_PACKAGE_INSTALL_DIRECTORY`"
  "@ApplicationsDir@/:variable:`CPACK_PACKAGE_INSTALL_DIRECTORY`"
+ (variables embedded in '@' are expanded by the
+ `QtIFW scripting engine <https://doc.qt.io/qtinstallerframework/scripting.html>`_).
 
 
  You can use predefined variables.
  You can use predefined variables.
 
 
@@ -263,55 +220,111 @@ Components
  repack dependent components. This feature available only
  repack dependent components. This feature available only
  since QtIFW 3.1.
  since QtIFW 3.1.
 
 
-Tools
-"""""
+QtIFW Tools
+"""""""""""
 
 
 .. variable:: CPACK_IFW_FRAMEWORK_VERSION
 .. variable:: CPACK_IFW_FRAMEWORK_VERSION
 
 
  The version of used QtIFW tools.
  The version of used QtIFW tools.
 
 
-.. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE
+The following variables provide the locations of the QtIFW
+command-line tools as discovered by the module :module:`CPackIFW`.
+These variables are cached, and may be configured if needed.
 
 
- The path to "binarycreator" command line client.
+.. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE
 
 
- This variable is cached and may be configured if needed.
+ The path to ``binarycreator``.
 
 
 .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE
 .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE
 
 
- The path to "repogen" command line client.
-
- This variable is cached and may be configured if needed.
+ The path to ``repogen``.
 
 
 .. variable:: CPACK_IFW_INSTALLERBASE_EXECUTABLE
 .. variable:: CPACK_IFW_INSTALLERBASE_EXECUTABLE
 
 
- The path to "installerbase" installer executable base.
-
- This variable is cached and may be configured if needed.
+ The path to ``installerbase``.
 
 
 .. variable:: CPACK_IFW_DEVTOOL_EXECUTABLE
 .. variable:: CPACK_IFW_DEVTOOL_EXECUTABLE
 
 
- The path to "devtool" command line client.
+ The path to ``devtool``.
+
+Hints for Finding QtIFW
+"""""""""""""""""""""""
+
+Generally, the CPack ``IFW`` generator automatically finds QtIFW tools,
+but if you don't use a default path for installation of the QtIFW tools,
+the path may be specified in either a CMake or an environment variable:
+
+.. variable:: CPACK_IFW_ROOT
 
 
- This variable is cached and may be configured if needed.
+ An CMake variable which specifies the location of the QtIFW tool suite.
+
+ The variable will be cached in the ``CPackConfig.cmake`` file and used at
+ CPack runtime.
+
+.. variable:: QTIFWDIR
+
+ An environment variable which specifies the location of the QtIFW tool
+ suite.
+
+.. note::
+  The specified path should not contain "bin" at the end
+  (for example: "D:\\DevTools\\QtIFW2.0.5").
+
+The :variable:`CPACK_IFW_ROOT` variable has a higher priority and overrides
+the value of the :variable:`QTIFWDIR` variable.
 
 
+Other Settings
+^^^^^^^^^^^^^^
 
 
 Online installer
 Online installer
-^^^^^^^^^^^^^^^^
+""""""""""""""""
 
 
-By default CPack IFW generator makes offline installer. This means that all
-components will be packaged into a binary file.
+By default, this generator generates an *offline installer*. This means that
+that all packaged files are fully contained in the installer executable.
 
 
-To make a component downloaded, you must set the ``DOWNLOADED`` option in
-:command:`cpack_add_component`.
+In contrast, an *online installer* will download some or all components from
+a remote server.
 
 
-Then you would use the command :command:`cpack_configure_downloads`.
-If you set ``ALL`` option all components will be downloaded.
+The ``DOWNLOADED`` option in the :command:`cpack_add_component` command
+specifies that a component is to be downloaded. Alternatively, the ``ALL``
+option in the :command:`cpack_configure_downloads` command specifies that
+`all` components are to be be downloaded.
 
 
-You also can use command :command:`cpack_ifw_add_repository` and
-variable :variable:`CPACK_IFW_DOWNLOAD_ALL` for more specific configuration.
+The :command:`cpack_ifw_add_repository` command and the
+:variable:`CPACK_IFW_DOWNLOAD_ALL` variable allow for more specific
+configuration.
 
 
-CPack IFW generator creates "repository" dir in current binary dir. You
-would copy content of this dir to specified ``site`` (``url``).
+When there are online components, CPack will write them to archive files.
+The help page of the :module:`CPackComponent` module, especially the section
+on the :command:`cpack_configure_downloads` function, explains how to make
+these files accessible from a download URL.
+
+Internationalization
+""""""""""""""""""""
+
+Some variables and command arguments support internationalization via
+CMake script. This is an optional feature.
+
+Installers created by QtIFW tools have built-in support for
+internationalization and many phrases are localized to many languages,
+but this does not apply to the description of the your components and groups
+that will be distributed.
+
+Localization of the description of your components and groups is useful for
+users of your installers.
+
+A localized variable or argument can contain a single default value, and a
+set of pairs the name of the locale and the localized value.
+
+For example:
+
+.. code-block:: cmake
+
+   set(LOCALIZABLE_VARIABLE "Default value"
+     en "English value"
+     en_US "American value"
+     en_GB "Great Britain value"
+     )
 
 
 See Also
 See Also
 ^^^^^^^^
 ^^^^^^^^
@@ -330,5 +343,5 @@ Qt Installer Framework Manual:
 * Promoting Updates:
 * Promoting Updates:
   http://doc.qt.io/qtinstallerframework/ifw-updates.html
   http://doc.qt.io/qtinstallerframework/ifw-updates.html
 
 
-Download Qt Installer Framework for you platform from Qt site:
+Download Qt Installer Framework for your platform from Qt site:
  http://download.qt.io/official_releases/qt-installer-framework
  http://download.qt.io/official_releases/qt-installer-framework

+ 14 - 10
Help/cpack_gen/rpm.rst

@@ -473,38 +473,42 @@ List of CPack RPM generator specific variables:
 
 
 .. variable:: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
 .. variable:: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
               CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
               CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
+              CPACK_RPM_PRE_TRANS_SCRIPT_FILE
 
 
- Path to file containing pre (un)install script.
+ Path to file containing pre install/uninstall/transaction script.
 
 
  * Mandatory : NO
  * Mandatory : NO
  * Default   : -
  * Default   : -
 
 
- May be used to embed a pre (un)installation script in the spec file.
+ May be used to embed a pre installation/uninstallation/transaction script in the spec file.
  The referred script file (or both) will be read and directly
  The referred script file (or both) will be read and directly
  put after the ``%pre`` or ``%preun`` section
  put after the ``%pre`` or ``%preun`` section
- If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the (un)install
+ If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the install/uninstall/transaction
  script for each component can be overridden with
  script for each component can be overridden with
- ``CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE`` and
- ``CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE``.
+ ``CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE``,
+ ``CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE``, and
+ ``CPACK_RPM_<COMPONENT>_PRE_TRANS_SCRIPT_FILE``
  One may verify which scriptlet has been included with::
  One may verify which scriptlet has been included with::
 
 
   rpm -qp --scripts  package.rpm
   rpm -qp --scripts  package.rpm
 
 
 .. variable:: CPACK_RPM_POST_INSTALL_SCRIPT_FILE
 .. variable:: CPACK_RPM_POST_INSTALL_SCRIPT_FILE
               CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
               CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
+              CPACK_RPM_POST_TRANS_SCRIPT_FILE
 
 
- Path to file containing post (un)install script.
+ Path to file containing post install/uninstall/transaction script.
 
 
  * Mandatory : NO
  * Mandatory : NO
  * Default   : -
  * Default   : -
 
 
- May be used to embed a post (un)installation script in the spec file.
+ May be used to embed a post installation/uninstallation/transaction script in the spec file.
  The referred script file (or both) will be read and directly
  The referred script file (or both) will be read and directly
  put after the ``%post`` or ``%postun`` section.
  put after the ``%post`` or ``%postun`` section.
- If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the (un)install
+ If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the install/uninstall/transaction
  script for each component can be overridden with
  script for each component can be overridden with
- ``CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE`` and
- ``CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE``.
+ ``CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE``,
+ ``CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE``, and
+ ``CPACK_RPM_<COMPONENT>_POST_TRANS_SCRIPT_FILE``
  One may verify which scriptlet has been included with::
  One may verify which scriptlet has been included with::
 
 
   rpm -qp --scripts  package.rpm
   rpm -qp --scripts  package.rpm

+ 140 - 4
Help/dev/source.rst

@@ -23,12 +23,142 @@ format only a subset of files, such as those that are locally modified.
 C++ Subset Permitted
 C++ Subset Permitted
 ====================
 ====================
 
 
-CMake requires compiling as C++11 or above.  However, in order to support
-building on older toolchains some constructs need to be handled with care:
+CMake requires compiling as C++11 in order to support building on older
+toolchains.  However, to facilitate development, some standard library
+features from more recent C++ standards are supported through a compatibility
+layer.  These features are defined under the namespace ``cm`` and headers
+are accessible under the ``cm/`` directory.  The headers under ``cm/`` can
+be used in place of the standard ones when extended features are needed.
+For example ``<cm/memory>`` can be used in place of ``<memory>``.
 
 
-* Do not use ``std::auto_ptr``.
+Available features are:
 
 
-  The ``std::auto_ptr`` template is deprecated in C++11. Use ``std::unique_ptr``.
+* From ``C++14``:
+
+  * ``<cm/iterator>``:
+    ``cm::make_reverse_iterator``, ``cm::cbegin``, ``cm::cend``,
+    ``cm::rbegin``, ``cm::rend``, ``cm::crbegin``, ``cm::crend``
+
+  * ``<cm/memory>``:
+    ``cm::make_unique``
+
+  * ``<cm/shared_mutex>``:
+    ``cm::shared_lock``
+
+  * ``<cm/type_traits>``:
+    ``cm::enable_if_t``
+
+* From ``C++17``:
+
+  * ``<cm/algorithm>``:
+    ``cm::clamp``
+
+  * ``<cm/iterator>``:
+    ``cm::size``, ``cm::empty``, ``cm::data``
+
+  * ``<cm/optional>``:
+    ``cm::nullopt_t``, ``cm::nullopt``, ``cm::optional``,
+    ``cm::make_optional``, ``cm::bad_optional_access``
+
+  * ``<cm/shared_mutex>``:
+    ``cm::shared_mutex``
+
+  * ``<cm/string_view>``:
+    ``cm::string_view``
+
+  * ``<cm/type_traits>``:
+    ``cm::bool_constant``, ``cm::invoke_result_t``, ``cm::invoke_result``,
+    ``cm::void_t``
+
+  * ``<cm/utility>``:
+    ``cm::in_place_t``, ``cm::in_place``
+
+* From ``C++20``:
+
+  * ``<cm/deque>``:
+    ``cm::erase``, ``cm::erase_if``
+
+  * ``<cm/list>``:
+    ``cm::erase``, ``cm::erase_if``
+
+  * ``<cm/map>`` :
+    ``cm::erase_if``
+
+  * ``<cm/set>`` :
+    ``cm::erase_if``
+
+  * ``<cm/string>``:
+    ``cm::erase``, ``cm::erase_if``
+
+  * ``<cm/unordered_map>``:
+    ``cm::erase_if``
+
+  * ``<cm/unordered_set>``:
+    ``cm::erase_if``
+
+  * ``<cm/vector>``:
+    ``cm::erase``, ``cm::erase_if``
+
+Additionally, some useful non-standard extensions to the C++ standard library
+are available in headers under the directory ``cmext/`` in namespace ``cm``.
+These are:
+
+* ``<cmext/algorithm>``:
+
+  * ``cm::append``:
+    Append elements to a sequential container.
+
+* ``<cmext/iterator>``:
+
+  * ``cm::is_terator``:
+    Checks if a type is an iterator type.
+
+  * ``cm::is_input_iterator``:
+    Checks if a type is an input iterator type.
+
+  * ``cm::is_range``:
+    Checks if a type is a range type: must have methods ``begin()`` and
+    ``end()`` returning an iterator.
+
+  * ``cm::is_input_range``:
+    Checks if a type is an input range type: must have methods ``begin()`` and
+    ``end()`` returning an input iterator.
+
+* ``<cmext/memory>``:
+
+  * ``cm::static_reference_cast``:
+    Apply a ``static_cast`` to a smart pointer.
+
+  * ``cm::dynamic_reference_cast``:
+    Apply a ``dynamic_cast`` to a smart pointer.
+
+* ``<cmext/type_traits>``:
+
+  * ``cm::is_container``:
+    Checks if a type is a container type.
+
+  * ``cm::is_associative_container``:
+    Checks if a type is an associative container type.
+
+  * ``cm::is_unordered_associative_container``:
+    Checks if a type is an unordered associative container type.
+
+  * ``cm::is_sequence_container``:
+    Checks if a type is a sequence container type.
+
+  * ``cm::is_unique_ptr``:
+    Checks if a type is a ``std::unique_ptr`` type.
+
+Dynamic Memory Management
+=========================
+
+To ensure efficient memory management, i.e. no memory leaks, it is required
+to use smart pointers.  Any dynamic memory allocation must be handled by a
+smart pointer such as ``std::unique_ptr`` or ``std::shared_ptr``.
+
+It is allowed to pass raw pointers between objects to enable objects sharing.
+A raw pointer **must** not be deleted. Only the object(s) owning the smart
+pointer are allowed to delete dynamically allocated memory.
 
 
 Source Tree Layout
 Source Tree Layout
 ==================
 ==================
@@ -69,6 +199,12 @@ The CMake source tree is organized as follows.
 * ``Utilities/``:
 * ``Utilities/``:
   Scripts, third-party source code.
   Scripts, third-party source code.
 
 
+  * ``Utilities/std/cm``:
+    Support files for various C++ standards.
+
+  * ``Utilities/std/cmext``:
+    Extensions to the C++ STL.
+
   * ``Utilities/Sphinx/``:
   * ``Utilities/Sphinx/``:
     Sphinx configuration to build CMake user documentation.
     Sphinx configuration to build CMake user documentation.
 
 

+ 11 - 1
Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt

@@ -8,10 +8,20 @@ target_include_directories(MathFunctions
 
 
 # does this system provide the log and exp functions?
 # does this system provide the log and exp functions?
 include(CheckSymbolExists)
 include(CheckSymbolExists)
-set(CMAKE_REQUIRED_LIBRARIES "m")
 check_symbol_exists(log "math.h" HAVE_LOG)
 check_symbol_exists(log "math.h" HAVE_LOG)
 check_symbol_exists(exp "math.h" HAVE_EXP)
 check_symbol_exists(exp "math.h" HAVE_EXP)
+if(NOT (HAVE_LOG AND HAVE_EXP))
+  unset(HAVE_LOG CACHE)
+  unset(HAVE_EXP CACHE)
+  set(CMAKE_REQUIRED_LIBRARIES "m")
+  check_symbol_exists(log "math.h" HAVE_LOG)
+  check_symbol_exists(exp "math.h" HAVE_EXP)
+  if(HAVE_LOG AND HAVE_EXP)
+    target_link_libraries(MathFunctions PRIVATE m)
+  endif()
+endif()
 
 
+# add compile definitions
 if(HAVE_LOG AND HAVE_EXP)
 if(HAVE_LOG AND HAVE_EXP)
   target_compile_definitions(MathFunctions
   target_compile_definitions(MathFunctions
                              PRIVATE "HAVE_LOG" "HAVE_EXP")
                              PRIVATE "HAVE_LOG" "HAVE_EXP")

+ 1 - 1
Help/guide/tutorial/index.rst

@@ -386,7 +386,7 @@ these functions using the :module:`CheckSymbolExists` module in the top-level
 .. literalinclude:: Step6/MathFunctions/CMakeLists.txt
 .. literalinclude:: Step6/MathFunctions/CMakeLists.txt
   :language: cmake
   :language: cmake
   :start-after: # does this system provide the log and exp functions?
   :start-after: # does this system provide the log and exp functions?
-  :end-before: if(HAVE_LOG AND HAVE_EXP)
+  :end-before: # add compile definitions
 
 
 Now let's add these defines to ``TutorialConfig.h.in`` so that we can use them
 Now let's add these defines to ``TutorialConfig.h.in`` so that we can use them
 from ``mysqrt.cxx``:
 from ``mysqrt.cxx``:

+ 1 - 0
Help/manual/cmake-commands.7.rst

@@ -16,6 +16,7 @@ These commands are always available.
    :maxdepth: 1
    :maxdepth: 1
 
 
    /command/break
    /command/break
+   /command/cmake_command
    /command/cmake_host_system_information
    /command/cmake_host_system_information
    /command/cmake_minimum_required
    /command/cmake_minimum_required
    /command/cmake_parse_arguments
    /command/cmake_parse_arguments

+ 151 - 31
Help/manual/cmake-generator-expressions.7.rst

@@ -259,6 +259,109 @@ Variable Queries
     add_executable(myapp main.cpp)
     add_executable(myapp main.cpp)
     target_link_libraries(myapp myapp_c myapp_cxx)
     target_link_libraries(myapp myapp_c myapp_cxx)
 
 
+.. _`Boolean LINK_LANGUAGE Generator Expression`:
+
+``$<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
+  combination of ``$<LINK_LANGUAGE:language>`` and
+  ``$<LANG_COMPILER_ID:compiler_ids>``. This expression may be used to specify
+  link libraries, link options, link directories and link dependencies of a
+  particular language and linker combination in a target. For example:
+
+  .. code-block:: cmake
+
+    add_library(libC_Clang ...)
+    add_library(libCXX_Clang ...)
+    add_library(libC_Intel ...)
+    add_library(libCXX_Intel ...)
+
+    add_executable(myapp main.c)
+    if (CXX_CONFIG)
+      target_sources(myapp PRIVATE file.cxx)
+    endif()
+    target_link_libraries(myapp
+      PRIVATE $<$<LINK_LANG_AND_ID:CXX,Clang,AppleClang>:libCXX_Clang>
+              $<$<LINK_LANG_AND_ID:C,Clang,AppleClang>:libC_Clang>
+              $<$<LINK_LANG_AND_ID:CXX,Intel>:libCXX_Intel>
+              $<$<LINK_LANG_AND_ID:C,Intel>:libC_Intel>)
+
+  This specifies the use of different link libraries based on both the
+  compiler id and link language. This example will have target ``libCXX_Clang``
+  as link dependency when ``Clang`` or ``AppleClang`` is the ``CXX``
+  linker, and ``libCXX_Intel`` when ``Intel`` is the ``CXX`` linker.
+  Likewise when the ``C`` linker is ``Clang`` or ``AppleClang``, target
+  ``libC_Clang`` will be added as link dependency and ``libC_Intel`` when
+  ``Intel`` is the ``C`` linker.
+
+  See :ref:`the note related to
+  <Constraints LINK_LANGUAGE Generator Expression>`
+  ``$<LINK_LANGUAGE:language>`` for constraints about the usage of this
+  generator expression.
+
+``$<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
+  particular language in a target. For example:
+
+  .. code-block:: cmake
+
+    add_library(api_C ...)
+    add_library(api_CXX ...)
+    add_library(api INTERFACE)
+    target_link_options(api INTERFACE $<$<LINK_LANGUAGE:C>:-opt_c>
+                                        $<$<LINK_LANGUAGE:CXX>:-opt_cxx>)
+    target_link_libraries(api INTERFACE $<$<LINK_LANGUAGE:C>:api_C>
+                                        $<$<LINK_LANGUAGE:CXX>:api_CXX>)
+
+    add_executable(myapp1 main.c)
+    target_link_options(myapp1 PRIVATE api)
+
+    add_executable(myapp2 main.cpp)
+    target_link_options(myapp2 PRIVATE api)
+
+  This specifies to use the ``api`` target for linking targets ``myapp1`` and
+  ``myapp2``. In practice, ``myapp1`` will link with target ``api_C`` and
+  option ``-opt_c`` because it will use ``C`` as link language. And ``myapp2``
+  will link with ``api_CXX`` and option ``-opt_cxx`` because ``CXX`` will be
+  the link language.
+
+  .. _`Constraints LINK_LANGUAGE Generator Expression`:
+
+  .. note::
+
+    To determine the link language of a target, it is required to collect,
+    transitively, all the targets which will be linked to it. So, for link
+    libraries properties, a double evaluation will be done. During the first
+    evaluation, ``$<LINK_LANGUAGE:..>`` expressions will always return ``0``.
+    The link language computed after this first pass will be used to do the
+    second pass. To avoid inconsistency, it is required that the second pass
+    do not change the link language. Moreover, to avoid unexpected
+    side-effects, it is required to specify complete entities as part of the
+    ``$<LINK_LANGUAGE:..>`` expression. For example:
+
+    .. code-block:: cmake
+
+      add_library(lib STATIC file.cxx)
+      add_library(libother STATIC file.c)
+
+      # bad usage
+      add_executable(myapp1 main.c)
+      target_link_libraries(myapp1 PRIVATE lib$<$<LINK_LANGUAGE:C>:other>)
+
+      # correct usage
+      add_executable(myapp2 main.c)
+      target_link_libraries(myapp2 PRIVATE $<$<LINK_LANGUAGE:C>:libother>)
+
+    In this example, for ``myapp1``, the first pass will, unexpectedly,
+    determine that the link language is ``CXX`` because the evaluation of the
+    generator expression will be an empty string so ``myapp1`` will depends on
+    target ``lib`` which is ``C++``. On the contrary, for ``myapp2``, the first
+    evaluation will give ``C`` as link language, so the second pass will
+    correctly add target ``libother`` as link dependency.
+
 String-Valued Generator Expressions
 String-Valued Generator Expressions
 ===================================
 ===================================
 
 
@@ -450,22 +553,41 @@ Variable Queries
   <Boolean COMPILE_LANGUAGE Generator Expression>`
   <Boolean COMPILE_LANGUAGE Generator Expression>`
   ``$<COMPILE_LANGUAGE:language>``
   ``$<COMPILE_LANGUAGE:language>``
   for notes about the portability of this generator expression.
   for notes about the portability of this generator expression.
+``$<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>``
+  for notes about the portability of this generator expression.
+
+  .. note::
+
+    This generator expression is not supported by the link libraries
+    properties to avoid side-effects due to the double evaluation of
+    these properties.
 
 
 Target-Dependent Queries
 Target-Dependent Queries
 ------------------------
 ------------------------
 
 
+These queries refer to a target ``tgt``. This can be any runtime artifact,
+namely:
+
+* an executable target created by :command:`add_executable`
+* a shared library target (``.so``, ``.dll`` but not their ``.lib`` import library)
+  created by :command:`add_library`
+* a static library target created by :command:`add_library`
+
+In the following, "the ``tgt`` filename" means the name of the ``tgt``
+binary file. This has to be distinguished from "the target name",
+which is just the string ``tgt``.
+
 ``$<TARGET_NAME_IF_EXISTS:tgt>``
 ``$<TARGET_NAME_IF_EXISTS:tgt>``
-  Expands to the ``tgt`` if the given target exists, an empty string
-  otherwise.
+  The target name ``tgt`` if the target exists, an empty string otherwise.
 ``$<TARGET_FILE:tgt>``
 ``$<TARGET_FILE:tgt>``
-  Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a
-  target.
+  Full path to the ``tgt`` binary file.
 ``$<TARGET_FILE_BASE_NAME:tgt>``
 ``$<TARGET_FILE_BASE_NAME:tgt>``
-  Base name of main file where ``tgt`` is the name of a target.
-
-  The base name corresponds to the target file name (see
-  ``$<TARGET_FILE_NAME:tgt>``) without prefix and suffix. For example, if
-  target file name is ``libbase.so``, the base name is ``base``.
+  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``.
 
 
   See also the :prop_tgt:`OUTPUT_NAME`, :prop_tgt:`ARCHIVE_OUTPUT_NAME`,
   See also the :prop_tgt:`OUTPUT_NAME`, :prop_tgt:`ARCHIVE_OUTPUT_NAME`,
   :prop_tgt:`LIBRARY_OUTPUT_NAME` and :prop_tgt:`RUNTIME_OUTPUT_NAME`
   :prop_tgt:`LIBRARY_OUTPUT_NAME` and :prop_tgt:`RUNTIME_OUTPUT_NAME`
@@ -480,32 +602,31 @@ Target-Dependent Queries
   Note that ``tgt`` is not added as a dependency of the target this
   Note that ``tgt`` is not added as a dependency of the target this
   expression is evaluated on.
   expression is evaluated on.
 ``$<TARGET_FILE_PREFIX:tgt>``
 ``$<TARGET_FILE_PREFIX:tgt>``
-  Prefix of main file where ``tgt`` is the name of a target.
+  Prefix of the ``tgt`` filename (such as ``lib``).
 
 
   See also the :prop_tgt:`PREFIX` target property.
   See also the :prop_tgt:`PREFIX` target property.
 
 
   Note that ``tgt`` is not added as a dependency of the target this
   Note that ``tgt`` is not added as a dependency of the target this
   expression is evaluated on.
   expression is evaluated on.
 ``$<TARGET_FILE_SUFFIX:tgt>``
 ``$<TARGET_FILE_SUFFIX:tgt>``
-  Suffix of main file where ``tgt`` is the name of a target.
-
-  The suffix corresponds to the file extension (such as ".so" or ".exe").
+  Suffix of the ``tgt`` filename (extension such as ``.so`` or ``.exe``).
 
 
   See also the :prop_tgt:`SUFFIX` target property.
   See also the :prop_tgt:`SUFFIX` target property.
 
 
   Note that ``tgt`` is not added as a dependency of the target this
   Note that ``tgt`` is not added as a dependency of the target this
   expression is evaluated on.
   expression is evaluated on.
 ``$<TARGET_FILE_NAME:tgt>``
 ``$<TARGET_FILE_NAME:tgt>``
-  Name of main file (.exe, .so.1.2, .a).
+  The ``tgt`` filename.
 ``$<TARGET_FILE_DIR:tgt>``
 ``$<TARGET_FILE_DIR:tgt>``
-  Directory of main file (.exe, .so.1.2, .a).
+  Directory of the ``tgt`` binary file.
 ``$<TARGET_LINKER_FILE:tgt>``
 ``$<TARGET_LINKER_FILE:tgt>``
-  File used to link (.a, .lib, .so) where ``tgt`` is the name of a target.
+  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>``
 ``$<TARGET_LINKER_FILE_BASE_NAME:tgt>``
-  Base name of file used to link where ``tgt`` is the name of a target.
-
-  The base name corresponds to the target linker file name (see
-  ``$<TARGET_LINKER_FILE_NAME:tgt>``) without prefix and suffix. For example,
+  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``.
   if target file name is ``libbase.a``, the base name is ``base``.
 
 
   See also the :prop_tgt:`OUTPUT_NAME`, :prop_tgt:`ARCHIVE_OUTPUT_NAME`,
   See also the :prop_tgt:`OUTPUT_NAME`, :prop_tgt:`ARCHIVE_OUTPUT_NAME`,
@@ -520,7 +641,7 @@ Target-Dependent Queries
   Note that ``tgt`` is not added as a dependency of the target this
   Note that ``tgt`` is not added as a dependency of the target this
   expression is evaluated on.
   expression is evaluated on.
 ``$<TARGET_LINKER_FILE_PREFIX:tgt>``
 ``$<TARGET_LINKER_FILE_PREFIX:tgt>``
-  Prefix of file used to link where ``tgt`` is the name of a target.
+  Prefix of file used to link target ``tgt``.
 
 
   See also the :prop_tgt:`PREFIX` and :prop_tgt:`IMPORT_PREFIX` target
   See also the :prop_tgt:`PREFIX` and :prop_tgt:`IMPORT_PREFIX` target
   properties.
   properties.
@@ -538,15 +659,15 @@ Target-Dependent Queries
   Note that ``tgt`` is not added as a dependency of the target this
   Note that ``tgt`` is not added as a dependency of the target this
   expression is evaluated on.
   expression is evaluated on.
 ``$<TARGET_LINKER_FILE_NAME:tgt>``
 ``$<TARGET_LINKER_FILE_NAME:tgt>``
-  Name of file used to link (.a, .lib, .so).
+  Name of file used to link target ``tgt``.
 ``$<TARGET_LINKER_FILE_DIR:tgt>``
 ``$<TARGET_LINKER_FILE_DIR:tgt>``
-  Directory of file used to link (.a, .lib, .so).
+  Directory of file used to link target ``tgt``.
 ``$<TARGET_SONAME_FILE:tgt>``
 ``$<TARGET_SONAME_FILE:tgt>``
-  File with soname (.so.3) where ``tgt`` is the name of a target.
+  File with soname (``.so.3``) where ``tgt`` is the name of a target.
 ``$<TARGET_SONAME_FILE_NAME:tgt>``
 ``$<TARGET_SONAME_FILE_NAME:tgt>``
-  Name of file with soname (.so.3).
+  Name of file with soname (``.so.3``).
 ``$<TARGET_SONAME_FILE_DIR:tgt>``
 ``$<TARGET_SONAME_FILE_DIR:tgt>``
-  Directory of with soname (.so.3).
+  Directory of with soname (``.so.3``).
 ``$<TARGET_PDB_FILE:tgt>``
 ``$<TARGET_PDB_FILE:tgt>``
   Full path to the linker generated program database file (.pdb)
   Full path to the linker generated program database file (.pdb)
   where ``tgt`` is the name of a target.
   where ``tgt`` is the name of a target.
@@ -589,11 +710,10 @@ Target-Dependent Queries
   Note that ``tgt`` is not added as a dependency of the target this
   Note that ``tgt`` is not added as a dependency of the target this
   expression is evaluated on.
   expression is evaluated on.
 ``$<TARGET_PROPERTY:prop>``
 ``$<TARGET_PROPERTY:prop>``
-  Value of the property ``prop`` on the target on which the generator
-  expression is evaluated. Note that for generator expressions in
-  :ref:`Target Usage Requirements` this is the value of the property
-  on the consuming target rather than the target specifying the
-  requirement.
+  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>``
 ``$<INSTALL_PREFIX>``
   Content of the install prefix when the target is exported via
   Content of the install prefix when the target is exported via
   :command:`install(EXPORT)`, or when evaluated in
   :command:`install(EXPORT)`, or when evaluated in

+ 8 - 0
Help/manual/cmake-policies.7.rst

@@ -51,6 +51,14 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used
 to determine whether to report an error on use of deprecated macros or
 to determine whether to report an error on use of deprecated macros or
 functions.
 functions.
 
 
+Policies Introduced by CMake 3.18
+=================================
+
+.. toctree::
+   :maxdepth: 1
+
+   CMP0103: Multiple export() with same FILE without APPEND is not allowed. </policy/CMP0103>
+
 Policies Introduced by CMake 3.17
 Policies Introduced by CMake 3.17
 =================================
 =================================
 
 

+ 5 - 0
Help/manual/cmake-properties.7.rst

@@ -127,6 +127,7 @@ Properties on Targets
    /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY
    /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY
    /prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG
    /prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG
    /prop_tgt/ARCHIVE_OUTPUT_NAME
    /prop_tgt/ARCHIVE_OUTPUT_NAME
+   /prop_tgt/PCH_WARN_INVALID
    /prop_tgt/AUTOGEN_BUILD_DIR
    /prop_tgt/AUTOGEN_BUILD_DIR
    /prop_tgt/AUTOGEN_ORIGIN_DEPENDS
    /prop_tgt/AUTOGEN_ORIGIN_DEPENDS
    /prop_tgt/AUTOGEN_PARALLEL
    /prop_tgt/AUTOGEN_PARALLEL
@@ -200,6 +201,7 @@ Properties on Targets
    /prop_tgt/Fortran_FORMAT
    /prop_tgt/Fortran_FORMAT
    /prop_tgt/Fortran_MODULE_DIRECTORY
    /prop_tgt/Fortran_MODULE_DIRECTORY
    /prop_tgt/FRAMEWORK
    /prop_tgt/FRAMEWORK
+   /prop_tgt/FRAMEWORK_MULTI_CONFIG_POSTFIX_CONFIG
    /prop_tgt/FRAMEWORK_VERSION
    /prop_tgt/FRAMEWORK_VERSION
    /prop_tgt/GENERATOR_FILE_NAME
    /prop_tgt/GENERATOR_FILE_NAME
    /prop_tgt/GHS_INTEGRITY_APP
    /prop_tgt/GHS_INTEGRITY_APP
@@ -375,6 +377,8 @@ Properties on Targets
    /prop_tgt/VS_SCC_PROJECTNAME
    /prop_tgt/VS_SCC_PROJECTNAME
    /prop_tgt/VS_SCC_PROVIDER
    /prop_tgt/VS_SCC_PROVIDER
    /prop_tgt/VS_SDK_REFERENCES
    /prop_tgt/VS_SDK_REFERENCES
+   /prop_tgt/VS_SOLUTION_DEPLOY
+   /prop_tgt/VS_SOURCE_SETTINGS_tool
    /prop_tgt/VS_USER_PROPS
    /prop_tgt/VS_USER_PROPS
    /prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION
    /prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION
    /prop_tgt/VS_WINRT_COMPONENT
    /prop_tgt/VS_WINRT_COMPONENT
@@ -484,6 +488,7 @@ Properties on Source Files
    /prop_sf/VS_DEPLOYMENT_LOCATION
    /prop_sf/VS_DEPLOYMENT_LOCATION
    /prop_sf/VS_INCLUDE_IN_VSIX
    /prop_sf/VS_INCLUDE_IN_VSIX
    /prop_sf/VS_RESOURCE_GENERATOR
    /prop_sf/VS_RESOURCE_GENERATOR
+   /prop_sf/VS_SETTINGS
    /prop_sf/VS_SHADER_DISABLE_OPTIMIZATIONS
    /prop_sf/VS_SHADER_DISABLE_OPTIMIZATIONS
    /prop_sf/VS_SHADER_ENABLE_DEBUG
    /prop_sf/VS_SHADER_ENABLE_DEBUG
    /prop_sf/VS_SHADER_ENTRYPOINT
    /prop_sf/VS_SHADER_ENTRYPOINT

+ 3 - 0
Help/manual/cmake-variables.7.rst

@@ -388,6 +388,7 @@ Variables that Control the Build
    /variable/CMAKE_EXE_LINKER_FLAGS_INIT
    /variable/CMAKE_EXE_LINKER_FLAGS_INIT
    /variable/CMAKE_FOLDER
    /variable/CMAKE_FOLDER
    /variable/CMAKE_FRAMEWORK
    /variable/CMAKE_FRAMEWORK
+   /variable/CMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_CONFIG
    /variable/CMAKE_Fortran_FORMAT
    /variable/CMAKE_Fortran_FORMAT
    /variable/CMAKE_Fortran_MODULE_DIRECTORY
    /variable/CMAKE_Fortran_MODULE_DIRECTORY
    /variable/CMAKE_GHS_NO_SOURCE_GROUP_FILE
    /variable/CMAKE_GHS_NO_SOURCE_GROUP_FILE
@@ -437,6 +438,7 @@ Variables that Control the Build
    /variable/CMAKE_OSX_ARCHITECTURES
    /variable/CMAKE_OSX_ARCHITECTURES
    /variable/CMAKE_OSX_DEPLOYMENT_TARGET
    /variable/CMAKE_OSX_DEPLOYMENT_TARGET
    /variable/CMAKE_OSX_SYSROOT
    /variable/CMAKE_OSX_SYSROOT
+   /variable/CMAKE_PCH_WARN_INVALID
    /variable/CMAKE_PDB_OUTPUT_DIRECTORY
    /variable/CMAKE_PDB_OUTPUT_DIRECTORY
    /variable/CMAKE_PDB_OUTPUT_DIRECTORY_CONFIG
    /variable/CMAKE_PDB_OUTPUT_DIRECTORY_CONFIG
    /variable/CMAKE_POSITION_INDEPENDENT_CODE
    /variable/CMAKE_POSITION_INDEPENDENT_CODE
@@ -621,6 +623,7 @@ Variables for CTest
    /variable/CTEST_P4_COMMAND
    /variable/CTEST_P4_COMMAND
    /variable/CTEST_P4_OPTIONS
    /variable/CTEST_P4_OPTIONS
    /variable/CTEST_P4_UPDATE_OPTIONS
    /variable/CTEST_P4_UPDATE_OPTIONS
+   /variable/CTEST_RESOURCE_SPEC_FILE
    /variable/CTEST_RUN_CURRENT_SCRIPT
    /variable/CTEST_RUN_CURRENT_SCRIPT
    /variable/CTEST_SCP_COMMAND
    /variable/CTEST_SCP_COMMAND
    /variable/CTEST_SITE
    /variable/CTEST_SITE

+ 14 - 0
Help/manual/cmake.1.rst

@@ -358,6 +358,20 @@ Options
  in :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR`.
  in :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR`.
  This flag tells CMake to warn about other files as well.
  This flag tells CMake to warn about other files as well.
 
 
+``--profiling-output=<path>``
+ Used in conjuction with ``--profiling-format`` to output to a given path.
+
+``--profiling-format=<file>``
+ Enable the output of profiling data of CMake script in the given format.
+
+ This can aid performance analysis of CMake scripts executed. Third party
+ applications should be used to process the output into human readable format.
+
+ Currently supported values are:
+ ``google-trace`` Outputs in Google Trace Format, which can be parsed by the
+ about:tracing tab of Google Chrome or using a plugin for a tool like Trace
+ Compass.
+
 .. _`Build Tool Mode`:
 .. _`Build Tool Mode`:
 
 
 Build a Project
 Build a Project

+ 6 - 2
Help/manual/ctest.1.rst

@@ -994,8 +994,12 @@ Configuration settings include:
 
 
 ``ResourceSpecFile``
 ``ResourceSpecFile``
   Specify a
   Specify a
-  :ref:`resource specification file <ctest-resource-specification-file>`. See
-  :ref:`ctest-resource-allocation` for more information.
+  :ref:`resource specification file <ctest-resource-specification-file>`.
+
+  * `CTest Script`_ variable: :variable:`CTEST_RESOURCE_SPEC_FILE`
+  * :module:`CTest` module variable: ``CTEST_RESOURCE_SPEC_FILE``
+
+  See :ref:`ctest-resource-allocation` for more information.
 
 
 ``LabelsForSubprojects``
 ``LabelsForSubprojects``
   Specify a semicolon-separated list of labels that will be treated as
   Specify a semicolon-separated list of labels that will be treated as

+ 22 - 0
Help/policy/CMP0103.rst

@@ -0,0 +1,22 @@
+CMP0103
+-------
+
+Multiple calls to :command:`export` command with same ``FILE`` without
+``APPEND`` is no longer allowed.
+
+In CMake 3.17 and below, multiple calls to :command:`export` command with the
+same ``FILE`` without ``APPEND`` are accepted silently but only the last
+occurrence is taken into account during the generation.
+
+The ``OLD`` behavior for this policy is to ignore the multiple occurrences of
+ :command:`export` command except the last one.
+
+The ``NEW`` behavior of this policy is to raise an error on second call to
+:command:`export` command with same ``FILE`` without ``APPEND``.
+
+This policy was introduced in CMake version 3.18.  CMake version
+|release| warns when the policy is not set and uses ``OLD`` behavior.
+Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW``
+explicitly.
+
+.. include:: DEPRECATED.txt

+ 18 - 0
Help/prop_sf/VS_SETTINGS.rst

@@ -0,0 +1,18 @@
+VS_SETTINGS
+-----------
+
+Set any item metadata on a non-built file.
+
+Takes a list of ``Key=Value`` pairs. Tells the Visual Studio generator to set
+``Key`` to ``Value`` as item metadata on the file.
+
+For example:
+
+.. code-block:: cmake
+
+  set_property(SOURCE file.hlsl PROPERTY VS_SETTINGS "Key=Value" "Key2=Value2")
+
+will set ``Key`` to ``Value`` and ``Key2`` to ``Value2`` on the
+``file.hlsl`` item as metadata.
+
+Generator expressions are supported.

+ 3 - 0
Help/prop_tgt/CONFIG_POSTFIX.rst

@@ -8,3 +8,6 @@ is appended to the target file name built on disk.  For non-executable
 targets, this property is initialized by the value of the variable
 targets, this property is initialized by the value of the variable
 CMAKE_<CONFIG>_POSTFIX if it is set when a target is created.  This
 CMAKE_<CONFIG>_POSTFIX if it is set when a target is created.  This
 property is ignored on the Mac for Frameworks and App Bundles.
 property is ignored on the Mac for Frameworks and App Bundles.
+
+For macOS see also the :prop_tgt:`FRAMEWORK_MULTI_CONFIG_POSTFIX_<CONFIG>`
+target property.

+ 25 - 0
Help/prop_tgt/FRAMEWORK_MULTI_CONFIG_POSTFIX_CONFIG.rst

@@ -0,0 +1,25 @@
+FRAMEWORK_MULTI_CONFIG_POSTFIX_<CONFIG>
+---------------------------------------
+
+Postfix to append to the framework file name for configuration <CONFIG>,
+when using a multi-config generator (like Xcode and Ninja Multi-Config).
+
+When building with configuration <CONFIG> the value of this property
+is appended to the framework file name built on disk.
+
+For example given a framework called ``my_fw``, a value of ``_debug``
+for the :prop_tgt:`FRAMEWORK_MULTI_CONFIG_POSTFIX_<CONFIG>` property, and
+``Debug;Release`` in `CMAKE_CONFIGURATION_TYPES`, the following relevant
+files would be created for the ``Debug`` and ``Release`` configurations:
+
+- Release/my_fw.framework/my_fw
+- Release/my_fw.framework/Versions/A/my_fw
+- Debug/my_fw.framework/my_fw_debug
+- Debug/my_fw.framework/Versions/A/my_fw_debug
+
+For framework targets, this property is initialized by the value of the
+variable :variable:`CMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_<CONFIG>` if it
+is set when a target is created.
+
+This property is ignored for non-framework targets, and when using single
+config generators.

+ 8 - 0
Help/prop_tgt/PCH_WARN_INVALID.rst

@@ -0,0 +1,8 @@
+PCH_WARN_INVALID
+----------------
+
+When this property is set to true, the precompile header compiler options
+will contain a compiler flag wich should warn about invalid precompiled
+headers e.g. ``-Winvalid-pch`` for GNU compiler.
+
+The defalut value is ``ON``.

+ 29 - 0
Help/prop_tgt/VS_SOLUTION_DEPLOY.rst

@@ -0,0 +1,29 @@
+VS_SOLUTION_DEPLOY
+------------------
+
+Specify that the target should be marked for deployment when not targeting
+Windows CE, Windows Phone or a Windows Store application.
+
+If the target platform doesn't support deployment, this property won't have any effect.
+
+Generator expressions are supported.
+
+Example 1
+^^^^^^^^^
+
+This shows setting the variable for the target foo.
+
+.. code-block:: cmake
+
+  add_executable(foo SHARED foo.cpp)
+  set_property(TARGET foo PROPERTY VS_SOLUTION_DEPLOY ON)
+
+Example 2
+^^^^^^^^^
+
+This shows setting the variable for the Release configuration only.
+
+.. code-block:: cmake
+
+  add_executable(foo SHARED foo.cpp)
+  set_property(TARGET foo PROPERTY VS_SOLUTION_DEPLOY "$<NOT:$<CONFIG:Release>>")

+ 19 - 0
Help/prop_tgt/VS_SOURCE_SETTINGS_tool.rst

@@ -0,0 +1,19 @@
+VS_SOURCE_SETTINGS_<tool>
+-------------------------
+
+Set any item metadata on all non-built files that use <tool>.
+
+Takes a list of ``Key=Value`` pairs. Tells the Visual Studio generator
+to set ``Key`` to ``Value`` as item metadata on all non-built files
+that use ``<tool>``.
+
+For example:
+
+.. code-block:: cmake
+
+  set_property(TARGET main PROPERTY VS_SOURCE_SETTINGS_FXCompile "Key=Value" "Key2=Value2")
+
+will set ``Key`` to ``Value`` and ``Key2`` to ``Value2`` for all
+non-built files that use ``FXCompile``.
+
+Generator expressions are supported.

+ 7 - 0
Help/release/dev/0-sample-topic.rst

@@ -0,0 +1,7 @@
+0-sample-topic
+--------------
+
+* This is a sample release note for the change in a topic.
+  Developers should add similar notes for each topic branch
+  making a noteworthy change.  Each document should be named
+  and titled to match the topic name to avoid merge conflicts.

+ 7 - 0
Help/release/dev/CPackRPM-trans-scripts.rst

@@ -0,0 +1,7 @@
+CPackRPM-trans-scripts
+----------------------
+
+* The :cpack_gen:`CPack RPM Generator` gained
+  :variable:`CPACK_RPM_PRE_TRANS_SCRIPT_FILE`
+  :variable:`CPACK_RPM_POST_TRANS_SCRIPT_FILE`
+  variables to specify pre- and post-trans scripts.

+ 6 - 0
Help/release/dev/FindPython-artifacts-interactive.rst

@@ -0,0 +1,6 @@
+FindPython-artifacts-interactive
+--------------------------------
+
+* The :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython`
+  modules gained the possibility to create artifacts cache variables for
+  interactive edition.

+ 7 - 0
Help/release/dev/FindRuby-variable-case.rst

@@ -0,0 +1,7 @@
+FindRuby-variable-case
+----------------------
+
+* The :module:`FindRuby` module input and output variables were all renamed
+  from ``RUBY_`` to ``Ruby_`` for consistency with other find modules.
+  Input variables of the old case will be honored if provided, and output
+  variables of the old case are always provided.

+ 7 - 0
Help/release/dev/GoogleTest-DISCOVERY_MODE.rst

@@ -0,0 +1,7 @@
+GoogleTest-DISCOVERY_MODE
+-------------------------
+
+* The :module:`GoogleTest` module :command:`gtest_discover_tests` command
+  gained a new ``DISCOVERY_MODE`` option to control when the test
+  discovery step is run.  It offers a new ``PRE_TEST`` setting to
+  run the discovery at test time instead of build time.

+ 6 - 0
Help/release/dev/GoogleTest-XML_OUTPUT_DIR.rst

@@ -0,0 +1,6 @@
+GoogleTest-XML_OUTPUT_DIR
+-------------------------
+
+* The :module:`GoogleTest` module :command:`gtest_discover_tests` command
+  gained a new optional parameter ``XML_OUTPUT_DIR``. When set the JUnit XML
+  test results are stored in that directory.

+ 8 - 0
Help/release/dev/cmake-gui-env-platform-defaults.rst

@@ -0,0 +1,8 @@
+cmake-gui-env-platform-defaults
+-------------------------------
+
+* :manual:`cmake-gui(1)` now populates its generator selection
+  widget default value from the :envvar:`CMAKE_GENERATOR` environment
+  variable.  Additionally, environment variables
+  :envvar:`CMAKE_GENERATOR_PLATFORM` and :envvar:`CMAKE_GENERATOR_TOOLSET`
+  are used to populate their respective widget defaults.

+ 6 - 0
Help/release/dev/cmake_command-command.rst

@@ -0,0 +1,6 @@
+cmake_command
+-------------
+
+* The :command:`cmake_command()` command was added for meta-operations on
+  scripted or built-in commands, starting with a mode to ``INVOKE`` other
+  commands, and ``EVAL CODE`` to inplace evaluate a CMake script.

+ 6 - 0
Help/release/dev/ctest_resource_spec_file-variable.rst

@@ -0,0 +1,6 @@
+ctest_resource_spec_file-variable
+---------------------------------
+
+* :manual:`ctest(1)` gained a new :variable:`CTEST_RESOURCE_SPEC_FILE`
+  variable, which can be used to specify a
+  :ref:`resource specification file <ctest-resource-specification-file>`.

+ 8 - 0
Help/release/dev/curl-http2.rst

@@ -0,0 +1,8 @@
+curl-http2
+----------
+
+* When building CMake itself from source and not using a system-provided
+  libcurl, HTTP/2 support is now enabled for commands supporting
+  network communication via ``http(s)``, such as :command:`file(DOWNLOAD)`,
+  :command:`file(UPLOAD)`, and :command:`ctest_submit`.
+  The precompiled binaries provided on ``cmake.org`` now support HTTP/2.

+ 8 - 0
Help/release/dev/deprecate-policy-old.rst

@@ -0,0 +1,8 @@
+deprecate-policy-old
+--------------------
+
+* An explicit deprecation diagnostic was added for policy ``CMP0070``
+  and policy ``CMP0071`` (``CMP0069`` and below were already deprecated).
+  The :manual:`cmake-policies(7)` manual explains that the OLD behaviors
+  of all policies are deprecated and that projects should port to the
+  NEW behaviors.

+ 5 - 0
Help/release/dev/execute_process.rst

@@ -0,0 +1,5 @@
+execute_process
+---------------
+
+* The :command:`execute_process` command gained the ``ECHO_OUTPUT_VARIABLE``
+  and ``ECHO_ERROR_VARIABLE`` options.

+ 5 - 0
Help/release/dev/export-multiple-calls.rst

@@ -0,0 +1,5 @@
+export-multiple-calls
+---------------------
+
+* The :command:`export` command now raise an error if used multiple times with
+  same ``FILE`` without ``APPEND``. See policy :policy:`CMP0103`.

+ 7 - 0
Help/release/dev/file_archive.rst

@@ -0,0 +1,7 @@
+file_archive
+------------
+
+* The :command:`file` command gained the ``ARCHIVE_{CREATE|EXTRACT}`` subcommands.
+
+  These subcommands will replicate the :manual:`cmake(1)` ``-E tar`` functionality in
+  CMake scripting code.

+ 6 - 0
Help/release/dev/file_configure.rst

@@ -0,0 +1,6 @@
+file_configure
+--------------
+
+* The :command:`file(CONFIGURE)` subcommand was created in order replicate the
+  :command:`configure_file` functionality without resorting to a pre-existing
+  file on disk as input. The content is instead passed as a string.

+ 5 - 0
Help/release/dev/findswig-components.rst

@@ -0,0 +1,5 @@
+findswig-components
+-------------------
+
+* The :module:`FindSWIG` module now accepts target languages as  ``COMPONENTS``
+  and ``OPTIONAL_COMPONENTS`` arguments to ``find_package``.

+ 7 - 0
Help/release/dev/framework-multi-config-postfix.rst

@@ -0,0 +1,7 @@
+framework-multi-config-postfix
+------------------------------
+
+* The :prop_tgt:`FRAMEWORK_MULTI_CONFIG_POSTFIX_<CONFIG>` target property
+  and associated :variable:`CMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_<CONFIG>`
+  variable were created to allow adding a postfix to the name of a
+  framework file name when using a multi-config generator.

+ 5 - 0
Help/release/dev/genex-LINK_LANGUAGE.rst

@@ -0,0 +1,5 @@
+genex-LINK_LANGUAGE
+===================
+
+* The ``$<LINK_LANGUAGE:...>`` and ``$<LINK_LANG_AND_ID:...>``
+  :manual:`generator expressions <cmake-generator-expressions(7)>` were added.

+ 6 - 0
Help/release/dev/parallel-lzma-compression.rst

@@ -0,0 +1,6 @@
+parallel-lzma-compression
+-------------------------
+
+* The :cpack_gen:`CPack Archive Generator`'s ``TXZ`` format learned the
+  :variable:`CPACK_ARCHIVE_THREADS` variable to enable parallel compression.
+  Requires support in the ``liblzma`` used by CMake.

+ 6 - 0
Help/release/dev/pch-warn-invalid.rst

@@ -0,0 +1,6 @@
+pch-warn-invalid
+----------------
+
+* The :variable:`CMAKE_PCH_WARN_INVALID` variable was added to initialize the
+  :prop_tgt:`PCH_WARN_INVALID` target property to allow the removal of the
+  precompiled header invalid warning.

+ 9 - 0
Help/release/dev/profiling.rst

@@ -0,0 +1,9 @@
+cmake-profiling
+---------------
+
+* Add support for profiling of CMake scripts through the parameters
+  ``--profiling-output`` and ``--profiling-format``. These options can
+  be used by users to gain insight into the performance of their scripts.
+
+  The first supported output format is ``google-trace`` which is a format
+  supported by Google Chrome's ``about:tracing`` tab.

+ 6 - 0
Help/release/dev/required_find_commands.rst

@@ -0,0 +1,6 @@
+required_find_commands
+----------------------
+
+* The :command:`find_program`, :command:`find_library`, :command:`find_path`
+  and :command:`find_file` commands gained a new ``REQUIRED`` option that will
+  stop processing with an error message if nothing is found.

+ 5 - 0
Help/release/dev/string-hex.rst

@@ -0,0 +1,5 @@
+string-hex
+----------
+
+* The :command:`string` command learned a new ``HEX`` sub-command, which
+  converts strings into their hexadecimal representation.

+ 7 - 0
Help/release/dev/useswig-fortran.rst

@@ -0,0 +1,7 @@
+useswig-fortran
+---------------
+
+* The :module:`UseSWIG` module now supports Fortran as a target language if
+  the ``SWIG_EXECUTABLE`` is SWIG-Fortran_.
+
+.. _`SWIG-Fortran`: https://github.com/swig-fortran/swig

+ 10 - 0
Help/release/dev/vs-non-built-file-item-metadata.rst

@@ -0,0 +1,10 @@
+vs-non-built-file-item-metadata
+-------------------------------
+
+* The :prop_tgt:`VS_SOURCE_SETTINGS_<tool>` target property was added
+  to tell :ref:`Visual Studio Generators` for VS 2010 and above to add
+  metadata to non-built source files using ``<tool>``.
+
+* The :prop_sf:`VS_SETTINGS` source file property was added to tell
+  :ref:`Visual Studio Generators` for VS 2010 and above to add
+  metadata to a non-built source file.

+ 6 - 0
Help/release/dev/vs-sln-deploy.rst

@@ -0,0 +1,6 @@
+vs-sln-deploy
+-------------
+
+* The :prop_tgt:`VS_SOLUTION_DEPLOY` target property was added to tell
+  :ref:`Visual Studio Generators` for VS 2010 and above to mark a
+  target for deployment even when not building for Windows Phone/Store/CE.

+ 2 - 0
Help/release/index.rst

@@ -7,6 +7,8 @@ CMake Release Notes
   This file should include the adjacent "dev.txt" file
   This file should include the adjacent "dev.txt" file
   in development versions but not in release versions.
   in development versions but not in release versions.
 
 
+.. include:: dev.txt
+
 Releases
 Releases
 ========
 ========
 
 

+ 8 - 0
Help/variable/CMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_CONFIG.rst

@@ -0,0 +1,8 @@
+CMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_<CONFIG>
+---------------------------------------------
+
+Default framework filename postfix under configuration ``<CONFIG>`` when
+using a multi-config generator.
+
+When a framework target is created its :prop_tgt:`FRAMEWORK_MULTI_CONFIG_POSTFIX_<CONFIG>`
+target property is initialized with the value of this variable if it is set.

+ 5 - 0
Help/variable/CMAKE_PCH_WARN_INVALID.rst

@@ -0,0 +1,5 @@
+CMAKE_PCH_WARN_INVALID
+----------------------
+
+This variable is used to initialize the :prop_tgt:`PCH_WARN_INVALID`
+property of targets when they are created.

+ 5 - 0
Help/variable/CTEST_RESOURCE_SPEC_FILE.rst

@@ -0,0 +1,5 @@
+CTEST_RESOURCE_SPEC_FILE
+------------------------
+
+Specify the CTest ``ResourceSpecFile`` setting in a :manual:`ctest(1)`
+dashboard client script.

+ 1 - 0
Modules/CMakeASMCompiler.cmake.in

@@ -10,6 +10,7 @@ set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1)
 set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ID "@_CMAKE_ASM_COMPILER_ID@")
 set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ID "@_CMAKE_ASM_COMPILER_ID@")
 set(CMAKE_ASM@ASM_DIALECT@_COMPILER_VERSION "@_CMAKE_ASM_COMPILER_VERSION@")
 set(CMAKE_ASM@ASM_DIALECT@_COMPILER_VERSION "@_CMAKE_ASM_COMPILER_VERSION@")
 set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ENV_VAR "@_CMAKE_ASM_COMPILER_ENV_VAR@")
 set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ENV_VAR "@_CMAKE_ASM_COMPILER_ENV_VAR@")
+@_SET_CMAKE_ASM_COMPILER_ID_VENDOR_MATCH@
 @_SET_CMAKE_ASM_COMPILER_ARCHITECTURE_ID@
 @_SET_CMAKE_ASM_COMPILER_ARCHITECTURE_ID@
 
 
 set(CMAKE_ASM@ASM_DIALECT@_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
 set(CMAKE_ASM@ASM_DIALECT@_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)

+ 2 - 2
Modules/CMakeASMInformation.cmake

@@ -76,12 +76,12 @@ endif()
 if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY)
 if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY)
   set(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY
   set(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY
       "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
       "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
-      "<CMAKE_RANLIB> <TARGET> ")
+      "<CMAKE_RANLIB> <TARGET>")
 endif()
 endif()
 
 
 if(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE)
 if(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE)
   set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
   set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
-    "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS>  -o <TARGET> <LINK_LIBRARIES>")
+    "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
 endif()
 endif()
 
 
 if(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG)
 if(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG)

+ 1 - 1
Modules/CMakeASM_MASMInformation.cmake

@@ -8,7 +8,7 @@ set(ASM_DIALECT "_MASM")
 
 
 set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)
 set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)
 
 
-set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> /c  /Fo <OBJECT> <SOURCE>")
+set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> /c /Fo <OBJECT> <SOURCE>")
 
 
 # The ASM_MASM compiler id for this compiler is "MSVC", so fill out the runtime library table.
 # The ASM_MASM compiler id for this compiler is "MSVC", so fill out the runtime library table.
 set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded         "")
 set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded         "")

+ 3 - 3
Modules/CMakeCInformation.cmake

@@ -161,7 +161,7 @@ if(NOT DEFINED CMAKE_C_ARCHIVE_CREATE)
   set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
   set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
 endif()
 endif()
 if(NOT DEFINED CMAKE_C_ARCHIVE_APPEND)
 if(NOT DEFINED CMAKE_C_ARCHIVE_APPEND)
-  set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> q  <TARGET> <LINK_FLAGS> <OBJECTS>")
+  set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
 endif()
 endif()
 if(NOT DEFINED CMAKE_C_ARCHIVE_FINISH)
 if(NOT DEFINED CMAKE_C_ARCHIVE_FINISH)
   set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
   set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
@@ -170,12 +170,12 @@ endif()
 # compile a C file into an object file
 # compile a C file into an object file
 if(NOT CMAKE_C_COMPILE_OBJECT)
 if(NOT CMAKE_C_COMPILE_OBJECT)
   set(CMAKE_C_COMPILE_OBJECT
   set(CMAKE_C_COMPILE_OBJECT
-    "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>   -c <SOURCE>")
+    "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
 endif()
 endif()
 
 
 if(NOT CMAKE_C_LINK_EXECUTABLE)
 if(NOT CMAKE_C_LINK_EXECUTABLE)
   set(CMAKE_C_LINK_EXECUTABLE
   set(CMAKE_C_LINK_EXECUTABLE
-    "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS>  -o <TARGET> <LINK_LIBRARIES>")
+    "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
 endif()
 endif()
 
 
 if(NOT CMAKE_EXECUTABLE_RUNTIME_C_FLAG)
 if(NOT CMAKE_EXECUTABLE_RUNTIME_C_FLAG)

+ 1 - 0
Modules/CMakeCUDACompiler.cmake.in

@@ -54,4 +54,5 @@ set(CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES@
 set(CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
 set(CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
 
 
 set(CMAKE_LINKER "@CMAKE_LINKER@")
 set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_AR "@CMAKE_AR@")
 set(CMAKE_MT "@CMAKE_MT@")
 set(CMAKE_MT "@CMAKE_MT@")

+ 6 - 6
Modules/CMakeCUDAInformation.cmake

@@ -129,7 +129,7 @@ if(NOT DEFINED CMAKE_CUDA_ARCHIVE_CREATE)
   set(CMAKE_CUDA_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
   set(CMAKE_CUDA_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
 endif()
 endif()
 if(NOT DEFINED CMAKE_CUDA_ARCHIVE_APPEND)
 if(NOT DEFINED CMAKE_CUDA_ARCHIVE_APPEND)
-  set(CMAKE_CUDA_ARCHIVE_APPEND "<CMAKE_AR> q  <TARGET> <LINK_FLAGS> <OBJECTS>")
+  set(CMAKE_CUDA_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
 endif()
 endif()
 if(NOT DEFINED CMAKE_CUDA_ARCHIVE_FINISH)
 if(NOT DEFINED CMAKE_CUDA_ARCHIVE_FINISH)
   set(CMAKE_CUDA_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
   set(CMAKE_CUDA_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
@@ -138,24 +138,24 @@ endif()
 #Specify how to compile when ptx has been requested
 #Specify how to compile when ptx has been requested
 if(NOT CMAKE_CUDA_COMPILE_PTX_COMPILATION)
 if(NOT CMAKE_CUDA_COMPILE_PTX_COMPILATION)
   set(CMAKE_CUDA_COMPILE_PTX_COMPILATION
   set(CMAKE_CUDA_COMPILE_PTX_COMPILATION
-    "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -ptx <SOURCE> -o <OBJECT>")
+    "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -ptx <SOURCE> -o <OBJECT>")
 endif()
 endif()
 
 
 #Specify how to compile when separable compilation has been requested
 #Specify how to compile when separable compilation has been requested
 if(NOT CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION)
 if(NOT CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION)
   set(CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION
   set(CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION
-    "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -dc <SOURCE> -o <OBJECT>")
+    "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -dc <SOURCE> -o <OBJECT>")
 endif()
 endif()
 
 
 #Specify how to compile when whole compilation has been requested
 #Specify how to compile when whole compilation has been requested
 if(NOT CMAKE_CUDA_COMPILE_WHOLE_COMPILATION)
 if(NOT CMAKE_CUDA_COMPILE_WHOLE_COMPILATION)
   set(CMAKE_CUDA_COMPILE_WHOLE_COMPILATION
   set(CMAKE_CUDA_COMPILE_WHOLE_COMPILATION
-    "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -c <SOURCE> -o <OBJECT>")
+    "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c <SOURCE> -o <OBJECT>")
 endif()
 endif()
 
 
-if(CMAKE_GENERATOR STREQUAL "Ninja" AND NOT CMAKE_DEPFILE_FLAGS_CUDA )
+if(CMAKE_GENERATOR STREQUAL "Ninja" AND NOT CMAKE_DEPFILE_FLAGS_CUDA)
   set(CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION
   set(CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION
-    "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -M <SOURCE> -MT <OBJECT> -o $DEP_FILE")
+    "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M <SOURCE> -MT <OBJECT> -o $DEP_FILE")
   #The Ninja generator uses the make file dependency files to determine what
   #The Ninja generator uses the make file dependency files to determine what
   #files need to be recompiled. Unfortunately, nvcc < 10.2 doesn't support building
   #files need to be recompiled. Unfortunately, nvcc < 10.2 doesn't support building
   #a source file and generating the dependencies of said file in a single
   #a source file and generating the dependencies of said file in a single

+ 3 - 3
Modules/CMakeCXXInformation.cmake

@@ -258,7 +258,7 @@ if(NOT DEFINED CMAKE_CXX_ARCHIVE_CREATE)
   set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
   set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
 endif()
 endif()
 if(NOT DEFINED CMAKE_CXX_ARCHIVE_APPEND)
 if(NOT DEFINED CMAKE_CXX_ARCHIVE_APPEND)
-  set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> q  <TARGET> <LINK_FLAGS> <OBJECTS>")
+  set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
 endif()
 endif()
 if(NOT DEFINED CMAKE_CXX_ARCHIVE_FINISH)
 if(NOT DEFINED CMAKE_CXX_ARCHIVE_FINISH)
   set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
   set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
@@ -267,12 +267,12 @@ endif()
 # compile a C++ file into an object file
 # compile a C++ file into an object file
 if(NOT CMAKE_CXX_COMPILE_OBJECT)
 if(NOT CMAKE_CXX_COMPILE_OBJECT)
   set(CMAKE_CXX_COMPILE_OBJECT
   set(CMAKE_CXX_COMPILE_OBJECT
-    "<CMAKE_CXX_COMPILER>  <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
+    "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
 endif()
 endif()
 
 
 if(NOT CMAKE_CXX_LINK_EXECUTABLE)
 if(NOT CMAKE_CXX_LINK_EXECUTABLE)
   set(CMAKE_CXX_LINK_EXECUTABLE
   set(CMAKE_CXX_LINK_EXECUTABLE
-    "<CMAKE_CXX_COMPILER>  <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS>  -o <TARGET> <LINK_LIBRARIES>")
+    "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
 endif()
 endif()
 
 
 mark_as_advanced(
 mark_as_advanced(

+ 7 - 0
Modules/CMakeDetermineASMCompiler.cmake

@@ -211,6 +211,13 @@ foreach(_var
   set(_CMAKE_ASM_${_var} "${CMAKE_ASM${ASM_DIALECT}_${_var}}")
   set(_CMAKE_ASM_${_var} "${CMAKE_ASM${ASM_DIALECT}_${_var}}")
 endforeach()
 endforeach()
 
 
+if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH)
+  set(_SET_CMAKE_ASM_COMPILER_ID_VENDOR_MATCH
+    "set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH [==[${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH}]==])")
+else()
+  set(_SET_CMAKE_ASM_COMPILER_ID_VENDOR_MATCH "")
+endif()
+
 if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID)
 if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID)
   set(_SET_CMAKE_ASM_COMPILER_ARCHITECTURE_ID
   set(_SET_CMAKE_ASM_COMPILER_ARCHITECTURE_ID
     "set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID})")
     "set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID})")

+ 1 - 1
Modules/CMakeDetermineCCompiler.cmake

@@ -153,7 +153,7 @@ endif ()
 # NAME_WE cannot be used since then this test will fail for names like
 # NAME_WE cannot be used since then this test will fail for names like
 # "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
 # "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
 # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
 # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
-if (CMAKE_CROSSCOMPILING  AND NOT _CMAKE_TOOLCHAIN_PREFIX)
+if (NOT _CMAKE_TOOLCHAIN_PREFIX)
 
 
   if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|QCC")
   if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|QCC")
     get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
     get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)

+ 29 - 25
Modules/CMakeDetermineCUDACompiler.cmake

@@ -74,6 +74,7 @@ endif()
 
 
 set(_CMAKE_PROCESSING_LANGUAGE "CUDA")
 set(_CMAKE_PROCESSING_LANGUAGE "CUDA")
 include(CMakeFindBinUtils)
 include(CMakeFindBinUtils)
+include(Compiler/${CMAKE_CUDA_COMPILER_ID}-FindBinUtils OPTIONAL)
 unset(_CMAKE_PROCESSING_LANGUAGE)
 unset(_CMAKE_PROCESSING_LANGUAGE)
 
 
 if(MSVC_CUDA_ARCHITECTURE_ID)
 if(MSVC_CUDA_ARCHITECTURE_ID)
@@ -86,7 +87,7 @@ if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
   set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "")
   set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "")
   set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "")
   set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "")
   set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
   set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
-elseif(CMAKE_CUDA_COMPILER_ID STREQUAL NVIDIA)
+elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
   set(_nvcc_log "")
   set(_nvcc_log "")
   string(REPLACE "\r" "" _nvcc_output_orig "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
   string(REPLACE "\r" "" _nvcc_output_orig "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
   if(_nvcc_output_orig MATCHES "#\\\$ +PATH= *([^\n]*)\n")
   if(_nvcc_output_orig MATCHES "#\\\$ +PATH= *([^\n]*)\n")
@@ -188,30 +189,33 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL NVIDIA)
   endif()
   endif()
 endif()
 endif()
 
 
-set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES )
-string(REPLACE "\r" "" _nvcc_output_orig "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
-if(_nvcc_output_orig MATCHES "#\\\$ +INCLUDES= *([^\n]*)\n")
-  set(_nvcc_includes "${CMAKE_MATCH_1}")
-  string(APPEND _nvcc_log "  found 'INCLUDES=' string: [${_nvcc_includes}]\n")
-else()
-  set(_nvcc_includes "")
-  string(REPLACE "\n" "\n    " _nvcc_output_log "\n${_nvcc_output_orig}")
-  string(APPEND _nvcc_log "  no 'INCLUDES=' string found in nvcc output:${_nvcc_output_log}\n")
-endif()
-if(_nvcc_includes)
-  # across all operating system each include directory is prefixed with -I
-  separate_arguments(_nvcc_output NATIVE_COMMAND "${_nvcc_includes}")
-  foreach(line IN LISTS _nvcc_output)
-    string(REGEX REPLACE "^-I" "" line "${line}")
-    get_filename_component(line "${line}" ABSOLUTE)
-    list(APPEND CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "${line}")
-  endforeach()
-
-  file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
-    "Parsed CUDA nvcc include information from above output:\n${_nvcc_log}\n${log}\n\n")
-else()
-  file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
-    "Failed to detect CUDA nvcc include information:\n${_nvcc_log}\n\n")
+# Determine CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES
+if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
+  set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES)
+  string(REPLACE "\r" "" _nvcc_output_orig "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
+  if(_nvcc_output_orig MATCHES "#\\\$ +INCLUDES= *([^\n]*)\n")
+    set(_nvcc_includes "${CMAKE_MATCH_1}")
+    string(APPEND _nvcc_log "  found 'INCLUDES=' string: [${_nvcc_includes}]\n")
+  else()
+    set(_nvcc_includes "")
+    string(REPLACE "\n" "\n    " _nvcc_output_log "\n${_nvcc_output_orig}")
+    string(APPEND _nvcc_log "  no 'INCLUDES=' string found in nvcc output:${_nvcc_output_log}\n")
+  endif()
+  if(_nvcc_includes)
+    # across all operating system each include directory is prefixed with -I
+    separate_arguments(_nvcc_output NATIVE_COMMAND "${_nvcc_includes}")
+    foreach(line IN LISTS _nvcc_output)
+      string(REGEX REPLACE "^-I" "" line "${line}")
+      get_filename_component(line "${line}" ABSOLUTE)
+      list(APPEND CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "${line}")
+    endforeach()
+
+    file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+      "Parsed CUDA nvcc include information from above output:\n${_nvcc_log}\n${log}\n\n")
+  else()
+    file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+      "Failed to detect CUDA nvcc include information:\n${_nvcc_log}\n\n")
+  endif()
 endif()
 endif()
 
 
 # configure all variables set in this file
 # configure all variables set in this file

+ 1 - 1
Modules/CMakeDetermineCXXCompiler.cmake

@@ -150,7 +150,7 @@ endif ()
 # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
 # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
 
 
 
 
-if (CMAKE_CROSSCOMPILING  AND NOT  _CMAKE_TOOLCHAIN_PREFIX)
+if (NOT _CMAKE_TOOLCHAIN_PREFIX)
 
 
   if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|QCC")
   if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|QCC")
     get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
     get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)

+ 14 - 0
Modules/CMakeDetermineCompilerId.cmake

@@ -870,6 +870,14 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang userflags)
     file(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR})
     file(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR})
   endif()
   endif()
 
 
+  # Save the current LC_ALL, LC_MESSAGES, and LANG environment variables
+  # and set them to "C" so we get the expected output to match.
+  set(_orig_lc_all      $ENV{LC_ALL})
+  set(_orig_lc_messages $ENV{LC_MESSAGES})
+  set(_orig_lang        $ENV{LANG})
+  set(ENV{LC_ALL}      C)
+  set(ENV{LC_MESSAGES} C)
+  set(ENV{LANG}        C)
 
 
   foreach(vendor ${CMAKE_${lang}_COMPILER_ID_VENDORS})
   foreach(vendor ${CMAKE_${lang}_COMPILER_ID_VENDORS})
     set(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}})
     set(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}})
@@ -891,6 +899,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang userflags)
         "matched \"${regex}\":\n${output}")
         "matched \"${regex}\":\n${output}")
       set(CMAKE_${lang}_COMPILER_ID "${vendor}" PARENT_SCOPE)
       set(CMAKE_${lang}_COMPILER_ID "${vendor}" PARENT_SCOPE)
       set(CMAKE_${lang}_COMPILER_ID_OUTPUT "${output}" PARENT_SCOPE)
       set(CMAKE_${lang}_COMPILER_ID_OUTPUT "${output}" PARENT_SCOPE)
+      set(CMAKE_${lang}_COMPILER_ID_VENDOR_MATCH "${CMAKE_MATCH_1}" PARENT_SCOPE)
       break()
       break()
     else()
     else()
       if("${result}" MATCHES  "timeout")
       if("${result}" MATCHES  "timeout")
@@ -904,6 +913,11 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang userflags)
        endif()
        endif()
     endif()
     endif()
   endforeach()
   endforeach()
+
+  # Restore original LC_ALL, LC_MESSAGES, and LANG
+  set(ENV{LC_ALL}      ${_orig_lc_all})
+  set(ENV{LC_MESSAGES} ${_orig_lc_messages})
+  set(ENV{LANG}        ${_orig_lang})
 endfunction()
 endfunction()
 
 
 function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang userflags)
 function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang userflags)

+ 1 - 1
Modules/CMakeDetermineFortranCompiler.cmake

@@ -249,7 +249,7 @@ endif ()
 # NAME_WE cannot be used since then this test will fail for names like
 # NAME_WE cannot be used since then this test will fail for names like
 # "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
 # "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
 # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
 # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
-if (CMAKE_CROSSCOMPILING  AND NOT _CMAKE_TOOLCHAIN_PREFIX)
+if (NOT _CMAKE_TOOLCHAIN_PREFIX)
 
 
   if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
   if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
     get_filename_component(COMPILER_BASENAME "${CMAKE_Fortran_COMPILER}" NAME)
     get_filename_component(COMPILER_BASENAME "${CMAKE_Fortran_COMPILER}" NAME)

+ 1 - 1
Modules/CMakeDetermineOBJCXXCompiler.cmake

@@ -145,7 +145,7 @@ endif ()
 # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
 # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
 
 
 
 
-if (CMAKE_CROSSCOMPILING  AND NOT  _CMAKE_TOOLCHAIN_PREFIX)
+if (NOT _CMAKE_TOOLCHAIN_PREFIX)
 
 
   if("${CMAKE_OBJCXX_COMPILER_ID}" MATCHES "GNU|Clang|QCC")
   if("${CMAKE_OBJCXX_COMPILER_ID}" MATCHES "GNU|Clang|QCC")
     get_filename_component(COMPILER_BASENAME "${CMAKE_OBJCXX_COMPILER}" NAME)
     get_filename_component(COMPILER_BASENAME "${CMAKE_OBJCXX_COMPILER}" NAME)

+ 1 - 0
Modules/CMakeFindBinUtils.cmake

@@ -75,6 +75,7 @@ if(("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC" AND
   endif()
   endif()
 
 
   find_program(CMAKE_LINKER NAMES ${_CMAKE_ADDITIONAL_LINKER_NAMES} link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
   find_program(CMAKE_LINKER NAMES ${_CMAKE_ADDITIONAL_LINKER_NAMES} link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+  find_program(CMAKE_AR     NAMES lib  HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
   find_program(CMAKE_MT     NAMES mt   HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
   find_program(CMAKE_MT     NAMES mt   HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
 
 
   list(APPEND _CMAKE_TOOL_VARS LINKER MT)
   list(APPEND _CMAKE_TOOL_VARS LINKER MT)

+ 19 - 7
Modules/CMakeFindFrameworks.cmake

@@ -17,13 +17,25 @@ if(NOT CMAKE_FIND_FRAMEWORKS_INCLUDED)
   macro(CMAKE_FIND_FRAMEWORKS fwk)
   macro(CMAKE_FIND_FRAMEWORKS fwk)
     set(${fwk}_FRAMEWORKS)
     set(${fwk}_FRAMEWORKS)
     if(APPLE)
     if(APPLE)
-      foreach(dir
-          ~/Library/Frameworks/${fwk}.framework
-          /usr/local/Frameworks/${fwk}.framework
-          /Library/Frameworks/${fwk}.framework
-          /System/Library/Frameworks/${fwk}.framework
-          /Network/Library/Frameworks/${fwk}.framework
-          ${CMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS})
+      file(TO_CMAKE_PATH "$ENV{CMAKE_FRAMEWORK_PATH}" _cmff_CMAKE_FRAMEWORK_PATH)
+      set(_cmff_search_paths
+            ${CMAKE_FRAMEWORK_PATH}
+            ${_cmff_CMAKE_FRAMEWORK_PATH}
+            ~/Library/Frameworks
+            /usr/local/Frameworks
+            /Library/Frameworks
+            /System/Library/Frameworks
+            /Network/Library/Frameworks
+            ${CMAKE_SYSTEM_FRAMEWORK_PATH})
+
+      # For backwards compatibility reasons,
+      # CMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS includes ${fwk}.framework
+      list(TRANSFORM _cmff_search_paths APPEND /${fwk}.framework)
+      list(APPEND _cmff_search_paths ${CMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS})
+
+      list(REMOVE_DUPLICATES _cmff_search_paths)
+
+      foreach(dir IN LISTS _cmff_search_paths)
         if(EXISTS ${dir})
         if(EXISTS ${dir})
           set(${fwk}_FRAMEWORKS ${${fwk}_FRAMEWORKS} ${dir})
           set(${fwk}_FRAMEWORKS ${${fwk}_FRAMEWORKS} ${dir})
         endif()
         endif()

+ 2 - 2
Modules/CMakeFortranInformation.cmake

@@ -193,7 +193,7 @@ if(NOT DEFINED CMAKE_Fortran_ARCHIVE_CREATE)
   set(CMAKE_Fortran_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
   set(CMAKE_Fortran_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
 endif()
 endif()
 if(NOT DEFINED CMAKE_Fortran_ARCHIVE_APPEND)
 if(NOT DEFINED CMAKE_Fortran_ARCHIVE_APPEND)
-  set(CMAKE_Fortran_ARCHIVE_APPEND "<CMAKE_AR> q  <TARGET> <LINK_FLAGS> <OBJECTS>")
+  set(CMAKE_Fortran_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
 endif()
 endif()
 if(NOT DEFINED CMAKE_Fortran_ARCHIVE_FINISH)
 if(NOT DEFINED CMAKE_Fortran_ARCHIVE_FINISH)
   set(CMAKE_Fortran_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
   set(CMAKE_Fortran_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
@@ -209,7 +209,7 @@ endif()
 # link a fortran program
 # link a fortran program
 if(NOT CMAKE_Fortran_LINK_EXECUTABLE)
 if(NOT CMAKE_Fortran_LINK_EXECUTABLE)
   set(CMAKE_Fortran_LINK_EXECUTABLE
   set(CMAKE_Fortran_LINK_EXECUTABLE
-    "<CMAKE_Fortran_COMPILER> <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <FLAGS> <OBJECTS>  -o <TARGET> <LINK_LIBRARIES>")
+    "<CMAKE_Fortran_COMPILER> <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
 endif()
 endif()
 
 
 if(CMAKE_Fortran_STANDARD_LIBRARIES_INIT)
 if(CMAKE_Fortran_STANDARD_LIBRARIES_INIT)

+ 3 - 3
Modules/CMakeOBJCInformation.cmake

@@ -161,7 +161,7 @@ if(NOT DEFINED CMAKE_OBJC_ARCHIVE_CREATE)
   set(CMAKE_OBJC_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
   set(CMAKE_OBJC_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
 endif()
 endif()
 if(NOT DEFINED CMAKE_OBJC_ARCHIVE_APPEND)
 if(NOT DEFINED CMAKE_OBJC_ARCHIVE_APPEND)
-  set(CMAKE_OBJC_ARCHIVE_APPEND "<CMAKE_AR> q  <TARGET> <LINK_FLAGS> <OBJECTS>")
+  set(CMAKE_OBJC_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
 endif()
 endif()
 if(NOT DEFINED CMAKE_OBJC_ARCHIVE_FINISH)
 if(NOT DEFINED CMAKE_OBJC_ARCHIVE_FINISH)
   set(CMAKE_OBJC_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
   set(CMAKE_OBJC_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
@@ -170,12 +170,12 @@ endif()
 # compile an Objective-C file into an object file
 # compile an Objective-C file into an object file
 if(NOT CMAKE_OBJC_COMPILE_OBJECT)
 if(NOT CMAKE_OBJC_COMPILE_OBJECT)
   set(CMAKE_OBJC_COMPILE_OBJECT
   set(CMAKE_OBJC_COMPILE_OBJECT
-    "<CMAKE_OBJC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x objective-c -o <OBJECT>   -c <SOURCE>")
+    "<CMAKE_OBJC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x objective-c -o <OBJECT> -c <SOURCE>")
 endif()
 endif()
 
 
 if(NOT CMAKE_OBJC_LINK_EXECUTABLE)
 if(NOT CMAKE_OBJC_LINK_EXECUTABLE)
   set(CMAKE_OBJC_LINK_EXECUTABLE
   set(CMAKE_OBJC_LINK_EXECUTABLE
-    "<CMAKE_OBJC_COMPILER> <FLAGS> <CMAKE_OBJC_LINK_FLAGS> <LINK_FLAGS> <OBJECTS>  -o <TARGET> <LINK_LIBRARIES>")
+    "<CMAKE_OBJC_COMPILER> <FLAGS> <CMAKE_OBJC_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
 endif()
 endif()
 
 
 if(NOT CMAKE_EXECUTABLE_RUNTIME_OBJC_FLAG)
 if(NOT CMAKE_EXECUTABLE_RUNTIME_OBJC_FLAG)

+ 3 - 3
Modules/CMakeOBJCXXInformation.cmake

@@ -254,7 +254,7 @@ if(NOT DEFINED CMAKE_OBJCXX_ARCHIVE_CREATE)
   set(CMAKE_OBJCXX_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
   set(CMAKE_OBJCXX_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
 endif()
 endif()
 if(NOT DEFINED CMAKE_OBJCXX_ARCHIVE_APPEND)
 if(NOT DEFINED CMAKE_OBJCXX_ARCHIVE_APPEND)
-  set(CMAKE_OBJCXX_ARCHIVE_APPEND "<CMAKE_AR> q  <TARGET> <LINK_FLAGS> <OBJECTS>")
+  set(CMAKE_OBJCXX_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
 endif()
 endif()
 if(NOT DEFINED CMAKE_OBJCXX_ARCHIVE_FINISH)
 if(NOT DEFINED CMAKE_OBJCXX_ARCHIVE_FINISH)
   set(CMAKE_OBJCXX_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
   set(CMAKE_OBJCXX_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
@@ -263,12 +263,12 @@ endif()
 # compile an Objective-C++ file into an object file
 # compile an Objective-C++ file into an object file
 if(NOT CMAKE_OBJCXX_COMPILE_OBJECT)
 if(NOT CMAKE_OBJCXX_COMPILE_OBJECT)
   set(CMAKE_OBJCXX_COMPILE_OBJECT
   set(CMAKE_OBJCXX_COMPILE_OBJECT
-    "<CMAKE_OBJCXX_COMPILER>  <DEFINES> <INCLUDES> <FLAGS> -x objective-c++ -o <OBJECT> -c <SOURCE>")
+    "<CMAKE_OBJCXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x objective-c++ -o <OBJECT> -c <SOURCE>")
 endif()
 endif()
 
 
 if(NOT CMAKE_OBJCXX_LINK_EXECUTABLE)
 if(NOT CMAKE_OBJCXX_LINK_EXECUTABLE)
   set(CMAKE_OBJCXX_LINK_EXECUTABLE
   set(CMAKE_OBJCXX_LINK_EXECUTABLE
-    "<CMAKE_OBJCXX_COMPILER>  <FLAGS> <CMAKE_OBJCXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS>  -o <TARGET> <LINK_LIBRARIES>")
+    "<CMAKE_OBJCXX_COMPILER> <FLAGS> <CMAKE_OBJCXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
 endif()
 endif()
 
 
 mark_as_advanced(
 mark_as_advanced(

+ 12 - 12
Modules/CPack.cmake

@@ -5,7 +5,7 @@
 CPack
 CPack
 -----
 -----
 
 
-Configure the binary and source package installers.
+Configure generators for binary installers and source packages.
 
 
 Introduction
 Introduction
 ^^^^^^^^^^^^
 ^^^^^^^^^^^^
@@ -19,13 +19,17 @@ Depending on the CMake generator, the CPack module may also add two new build
 targets, ``package`` and ``package_source``. See the `packaging targets`_
 targets, ``package`` and ``package_source``. See the `packaging targets`_
 section below for details.
 section below for details.
 
 
-The generated binary installers contain everything installed via CMake's
-:command:`install` command (and the deprecated commands :command:`install_files`,
-:command:`install_programs`, and :command:`install_targets`).
-For certain kinds of binary installers (including the graphical
-installers on macOS and Windows), CPack generates installers that
-allow users to select individual application components to install.
-See :module:`CPackComponent` module for further details.
+The generated binary installers will contain all files that have been installed
+via CMake's :command:`install` command (and the deprecated commands
+:command:`install_files`, :command:`install_programs`, and
+:command:`install_targets`).  Certain kinds of binary installers can be
+configured such that users can select individual application components to
+install.  See the :module:`CPackComponent` module for further details.
+
+Source packages (configured through ``CPackSourceConfig.cmake`` and generated
+by the :cpack_gen:`CPack Archive Generator`) will contain all source files in
+the project directory except those specified in
+:variable:`CPACK_SOURCE_IGNORE_FILES`.
 
 
 CPack Generators
 CPack Generators
 ^^^^^^^^^^^^^^^^
 ^^^^^^^^^^^^^^^^
@@ -38,10 +42,6 @@ generator.  In a :variable:`CPACK_PROJECT_CONFIG_FILE`,
 :variable:`CPACK_GENERATOR` is a *string naming a single generator*.  If you
 :variable:`CPACK_GENERATOR` is a *string naming a single generator*.  If you
 need per-cpack-generator logic to control *other* cpack settings, then you
 need per-cpack-generator logic to control *other* cpack settings, then you
 need a :variable:`CPACK_PROJECT_CONFIG_FILE`.
 need a :variable:`CPACK_PROJECT_CONFIG_FILE`.
-
-The CMake source tree itself contains a :variable:`CPACK_PROJECT_CONFIG_FILE`.
-See the top level file ``CMakeCPackOptions.cmake.in`` for an example.
-
 If set, the :variable:`CPACK_PROJECT_CONFIG_FILE` is included automatically
 If set, the :variable:`CPACK_PROJECT_CONFIG_FILE` is included automatically
 on a per-generator basis.  It only need contain overrides.
 on a per-generator basis.  It only need contain overrides.
 
 

+ 50 - 37
Modules/CPackComponent.cmake

@@ -5,29 +5,34 @@
 CPackComponent
 CPackComponent
 --------------
 --------------
 
 
-Build binary and source package installers
+Configure components for binary installers and source packages.
 
 
-Variables concerning CPack Components
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+.. only:: html
 
 
-The CPackComponent module is the module which handles the component
-part of CPack.  See CPack module for general information about CPack.
+  .. contents::
 
 
-For certain kinds of binary installers (including the graphical
-installers on macOS and Windows), CPack generates installers that
-allow users to select individual application components to install.
-The contents of each of the components are identified by the COMPONENT
-argument of CMake's INSTALL command.  These components can be
+Introduction
+^^^^^^^^^^^^
+
+This module is automatically included by :module:`CPack`.
+
+Certain binary installers (especially the graphical installers) generated
+by CPack allow users to select individual application *components* to install.
+This module allows developers to configure the packaging of such components.
+
+Contents is assigned to components by the ``COMPONENT``
+argument of CMake's :command:`install` command.  Components can be
 annotated with user-friendly names and descriptions, inter-component
 annotated with user-friendly names and descriptions, inter-component
 dependencies, etc., and grouped in various ways to customize the
 dependencies, etc., and grouped in various ways to customize the
-resulting installer.  See the cpack_add_* commands, described below,
-for more information about component-specific installations.
+resulting installer, using the commands described below.
+
+To specify different groupings for different CPack generators use
+a CPACK_PROJECT_CONFIG_FILE.
 
 
-Component-specific installation allows users to select specific sets
-of components to install during the install process.  Installation
-components are identified by the COMPONENT argument of CMake's INSTALL
-commands, and should be further described by the following CPack
-commands:
+Variables
+^^^^^^^^^
+
+The following variables influence the component-specific packaging:
 
 
 .. variable:: CPACK_COMPONENTS_ALL
 .. variable:: CPACK_COMPONENTS_ALL
 
 
@@ -61,16 +66,14 @@ commands:
  Specify how components are grouped for multi-package component-aware CPack
  Specify how components are grouped for multi-package component-aware CPack
  generators.
  generators.
 
 
- Some generators like RPM or ARCHIVE family (TGZ, ZIP, ...) generates
- several packages files when asked for component packaging.  They group
- the component differently depending on the value of this variable:
-
- * ONE_PER_GROUP (default): creates one package file per component group
- * ALL_COMPONENTS_IN_ONE : creates a single package with all (requested) components
- * IGNORE : creates one package per component, i.e. IGNORE component group
+ Some generators like RPM or ARCHIVE (TGZ, ZIP, ...) may generate
+ several packages files when there are components, depending
+ on the value of this variable:
 
 
- One can specify different grouping for different CPack generator by
- using a CPACK_PROJECT_CONFIG_FILE.
+ * ONE_PER_GROUP (default): create one package per component group
+ * IGNORE : create one package per component (ignore the groups)
+ * ALL_COMPONENTS_IN_ONE : create a single package with all requested
+   components
 
 
 .. variable:: CPACK_COMPONENT_<compName>_DISPLAY_NAME
 .. variable:: CPACK_COMPONENT_<compName>_DISPLAY_NAME
 
 
@@ -100,10 +103,15 @@ commands:
 
 
  True if this component is not selected to be installed by default.
  True if this component is not selected to be installed by default.
 
 
+Commands
+^^^^^^^^
+
+Add component
+"""""""""""""
+
 .. command:: cpack_add_component
 .. command:: cpack_add_component
 
 
-Describes a CPack installation
-component named by the COMPONENT argument to a CMake INSTALL command.
+Describe an installation component.
 
 
 ::
 ::
 
 
@@ -118,13 +126,11 @@ component named by the COMPONENT argument to a CMake INSTALL command.
                       [ARCHIVE_FILE filename]
                       [ARCHIVE_FILE filename]
                       [PLIST filename])
                       [PLIST filename])
 
 
-
-
-The cmake_add_component command describes an installation component,
-which the user can opt to install or remove as part of the graphical
-installation process.  compname is the name of the component, as
-provided to the COMPONENT argument of one or more CMake INSTALL
-commands.
+``compname`` is the name of an installation component, as defined by the
+``COMPONENT`` argument of one or more CMake :command:`install` commands.
+With the ``cpack_add_component`` command one can set a name, a description,
+and other attributes of an installation component.
+One can also assign a component to a component group.
 
 
 DISPLAY_NAME is the displayed name of the component, used in graphical
 DISPLAY_NAME is the displayed name of the component, used in graphical
 installers to display the component name.  This value can be any
 installers to display the component name.  This value can be any
@@ -177,6 +183,9 @@ the component.  See cpack_configure_downloads for more information.
 PLIST gives a filename that is passed to pkgbuild with the
 PLIST gives a filename that is passed to pkgbuild with the
 ``--component-plist`` argument when using the productbuild generator.
 ``--component-plist`` argument when using the productbuild generator.
 
 
+Add component group
+"""""""""""""""""""
+
 .. command:: cpack_add_component_group
 .. command:: cpack_add_component_group
 
 
 Describes a group of related CPack installation components.
 Describes a group of related CPack installation components.
@@ -225,6 +234,9 @@ single entry.
 BOLD_TITLE indicates that the group title should appear in bold, to
 BOLD_TITLE indicates that the group title should appear in bold, to
 call the user's attention to the group.
 call the user's attention to the group.
 
 
+Add installation type
+"""""""""""""""""""""
+
 .. command:: cpack_add_install_type
 .. command:: cpack_add_install_type
 
 
 Add a new installation type containing
 Add a new installation type containing
@@ -249,6 +261,9 @@ DISPLAY_NAME is the displayed name of the install type, which will
 typically show up in a drop-down box within a graphical installer.
 typically show up in a drop-down box within a graphical installer.
 This value can be any string.
 This value can be any string.
 
 
+Configure downloads
+"""""""""""""""""""
+
 .. command:: cpack_configure_downloads
 .. command:: cpack_configure_downloads
 
 
 Configure CPack to download
 Configure CPack to download
@@ -281,8 +296,6 @@ requires the ZipDLL plug-in for NSIS, available at:
 
 
   http://nsis.sourceforge.net/ZipDLL_plug-in
   http://nsis.sourceforge.net/ZipDLL_plug-in
 
 
-
-
 On macOS, installers that download components on-the-fly can only
 On macOS, installers that download components on-the-fly can only
 be built and installed on system using macOS 10.5 or later.
 be built and installed on system using macOS 10.5 or later.
 
 

+ 2 - 4
Modules/CheckFortranSourceCompiles.cmake

@@ -103,8 +103,6 @@ macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR)
     if(NOT _SRC_EXT)
     if(NOT _SRC_EXT)
       set(_SRC_EXT F)
       set(_SRC_EXT F)
     endif()
     endif()
-    set(MACRO_CHECK_FUNCTION_DEFINITIONS
-      "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
     if(CMAKE_REQUIRED_LINK_OPTIONS)
     if(CMAKE_REQUIRED_LINK_OPTIONS)
       set(CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS
       set(CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS
         LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
         LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
@@ -132,10 +130,10 @@ macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR)
     try_compile(${VAR}
     try_compile(${VAR}
       ${CMAKE_BINARY_DIR}
       ${CMAKE_BINARY_DIR}
       ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}
       ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}
-      COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+      COMPILE_DEFINITIONS -D${VAR} ${CMAKE_REQUIRED_DEFINITIONS}
       ${CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS}
       ${CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS}
       ${CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES}
       ${CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES}
-      CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+      CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CMAKE_REQUIRED_FLAGS}
       "${CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES}"
       "${CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES}"
       OUTPUT_VARIABLE OUTPUT)
       OUTPUT_VARIABLE OUTPUT)
 
 

+ 2 - 4
Modules/CheckFortranSourceRuns.cmake

@@ -98,8 +98,6 @@ macro(CHECK_Fortran_SOURCE_RUNS SOURCE VAR)
     if(NOT _SRC_EXT)
     if(NOT _SRC_EXT)
       set(_SRC_EXT F90)
       set(_SRC_EXT F90)
     endif()
     endif()
-    set(MACRO_CHECK_FUNCTION_DEFINITIONS
-      "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
     if(CMAKE_REQUIRED_LINK_OPTIONS)
     if(CMAKE_REQUIRED_LINK_OPTIONS)
       set(CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS
       set(CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS
         LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
         LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
@@ -127,10 +125,10 @@ macro(CHECK_Fortran_SOURCE_RUNS SOURCE VAR)
     try_run(${VAR}_EXITCODE ${VAR}_COMPILED
     try_run(${VAR}_EXITCODE ${VAR}_COMPILED
       ${CMAKE_BINARY_DIR}
       ${CMAKE_BINARY_DIR}
       ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}
       ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}
-      COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+      COMPILE_DEFINITIONS -D${VAR} ${CMAKE_REQUIRED_DEFINITIONS}
       ${CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS}
       ${CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS}
       ${CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES}
       ${CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES}
-      CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+      CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CMAKE_REQUIRED_FLAGS}
       -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
       -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
       "${CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES}"
       "${CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES}"
       COMPILE_OUTPUT_VARIABLE OUTPUT
       COMPILE_OUTPUT_VARIABLE OUTPUT

+ 8 - 8
Modules/CheckLanguage.cmake

@@ -47,7 +47,7 @@ macro(check_language lang)
       set(extra_compiler_variables "set(CMAKE_CUDA_HOST_COMPILER \\\"\${CMAKE_CUDA_HOST_COMPILER}\\\")")
       set(extra_compiler_variables "set(CMAKE_CUDA_HOST_COMPILER \\\"\${CMAKE_CUDA_HOST_COMPILER}\\\")")
     endif()
     endif()
 
 
-    set(content
+    set(_cl_content
       "cmake_minimum_required(VERSION ${CMAKE_VERSION})
       "cmake_minimum_required(VERSION ${CMAKE_VERSION})
 project(Check${lang} ${lang})
 project(Check${lang} ${lang})
 file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
 file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
@@ -57,7 +57,7 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
     )
     )
 
 
     file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/CMakeLists.txt"
     file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/CMakeLists.txt"
-      "${content}")
+      "${_cl_content}")
     if(CMAKE_GENERATOR_INSTANCE)
     if(CMAKE_GENERATOR_INSTANCE)
       set(_D_CMAKE_GENERATOR_INSTANCE "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${CMAKE_GENERATOR_INSTANCE}")
       set(_D_CMAKE_GENERATOR_INSTANCE "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${CMAKE_GENERATOR_INSTANCE}")
     else()
     else()
@@ -75,22 +75,22 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
                                  -T "${CMAKE_GENERATOR_TOOLSET}"
                                  -T "${CMAKE_GENERATOR_TOOLSET}"
                                  ${_D_CMAKE_GENERATOR_INSTANCE}
                                  ${_D_CMAKE_GENERATOR_INSTANCE}
                                  ${_D_CMAKE_MAKE_PROGRAM}
                                  ${_D_CMAKE_MAKE_PROGRAM}
-      OUTPUT_VARIABLE output
-      ERROR_VARIABLE output
-      RESULT_VARIABLE result
+      OUTPUT_VARIABLE _cl_output
+      ERROR_VARIABLE _cl_output
+      RESULT_VARIABLE _cl_result
       )
       )
     include(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/result.cmake OPTIONAL)
     include(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/result.cmake OPTIONAL)
-    if(CMAKE_${lang}_COMPILER AND "${result}" STREQUAL "0")
+    if(CMAKE_${lang}_COMPILER AND "${_cl_result}" STREQUAL "0")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "${_desc} passed with the following output:\n"
         "${_desc} passed with the following output:\n"
-        "${output}\n")
+        "${_cl_output}\n")
       set(_CHECK_COMPILER_STATUS CHECK_PASS)
       set(_CHECK_COMPILER_STATUS CHECK_PASS)
     else()
     else()
       set(CMAKE_${lang}_COMPILER NOTFOUND)
       set(CMAKE_${lang}_COMPILER NOTFOUND)
       set(_CHECK_COMPILER_STATUS CHECK_FAIL)
       set(_CHECK_COMPILER_STATUS CHECK_FAIL)
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
         "${_desc} failed with the following output:\n"
         "${_desc} failed with the following output:\n"
-        "${output}\n")
+        "${_cl_output}\n")
     endif()
     endif()
     message(${_CHECK_COMPILER_STATUS} "${CMAKE_${lang}_COMPILER}")
     message(${_CHECK_COMPILER_STATUS} "${CMAKE_${lang}_COMPILER}")
     set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER}" CACHE FILEPATH "${lang} compiler")
     set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER}" CACHE FILEPATH "${lang} compiler")

+ 6 - 2
Modules/CheckTypeSize.c.in

@@ -5,10 +5,14 @@
 # define KEY '_','_','i','3','8','6'
 # define KEY '_','_','i','3','8','6'
 #elif defined(__x86_64)
 #elif defined(__x86_64)
 # define KEY '_','_','x','8','6','_','6','4'
 # define KEY '_','_','x','8','6','_','6','4'
-#elif defined(__ppc__)
-# define KEY '_','_','p','p','c','_','_'
+#elif defined(__PPC64__)
+# define KEY '_','_','P','P','C','6','4','_','_'
 #elif defined(__ppc64__)
 #elif defined(__ppc64__)
 # define KEY '_','_','p','p','c','6','4','_','_'
 # define KEY '_','_','p','p','c','6','4','_','_'
+#elif defined(__PPC__)
+# define KEY '_','_','P','P','C','_','_'
+#elif defined(__ppc__)
+# define KEY '_','_','p','p','c','_','_'
 #elif defined(__aarch64__)
 #elif defined(__aarch64__)
 # define KEY '_','_','a','a','r','c','h','6','4','_','_'
 # define KEY '_','_','a','a','r','c','h','6','4','_','_'
 #elif defined(__ARM_ARCH_7A__)
 #elif defined(__ARM_ARCH_7A__)

+ 6 - 0
Modules/Compiler/GNU-ASM.cmake

@@ -4,3 +4,9 @@ include(Compiler/GNU)
 set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm)
 set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm)
 
 
 __compiler_gnu(ASM)
 __compiler_gnu(ASM)
+
+if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH STREQUAL "GNU assembler")
+  set(CMAKE_DEPFILE_FLAGS_ASM${ASM_DIALECT} "--MD <DEPFILE>")
+  set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
+    "<CMAKE_LINKER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+endif()

+ 3 - 2
Modules/Compiler/GNU.cmake

@@ -114,6 +114,7 @@ macro(__compiler_gnu lang)
   if (NOT CMAKE_GENERATOR MATCHES "Xcode")
   if (NOT CMAKE_GENERATOR MATCHES "Xcode")
     set(CMAKE_PCH_PROLOGUE "#pragma GCC system_header")
     set(CMAKE_PCH_PROLOGUE "#pragma GCC system_header")
   endif()
   endif()
-  set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Winvalid-pch -include <PCH_HEADER>)
-  set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Winvalid-pch -x ${__pch_header_${lang}} -include <PCH_HEADER>)
+  set(CMAKE_${lang}_COMPILE_OPTIONS_INVALID_PCH -Winvalid-pch)
+  set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -include <PCH_HEADER>)
+  set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -x ${__pch_header_${lang}} -include <PCH_HEADER>)
 endmacro()
 endmacro()

+ 3 - 2
Modules/Compiler/Intel.cmake

@@ -37,7 +37,8 @@ else()
     set(CMAKE_PCH_EXTENSION .pchi)
     set(CMAKE_PCH_EXTENSION .pchi)
     set(CMAKE_LINK_PCH ON)
     set(CMAKE_LINK_PCH ON)
     set(CMAKE_PCH_EPILOGUE "#pragma hdrstop")
     set(CMAKE_PCH_EPILOGUE "#pragma hdrstop")
-    set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Winvalid-pch -Wno-pch-messages -pch-use <PCH_FILE> -include <PCH_HEADER>)
-    set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Winvalid-pch -Wno-pch-messages -pch-create <PCH_FILE> -include <PCH_HEADER>)
+    set(CMAKE_${lang}_COMPILE_OPTIONS_INVALID_PCH -Winvalid-pch)
+    set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Wno-pch-messages -pch-use <PCH_FILE> -include <PCH_HEADER>)
+    set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Wno-pch-messages -pch-create <PCH_FILE> -include <PCH_HEADER>)
   endmacro()
   endmacro()
 endif()
 endif()

+ 2 - 0
Modules/Compiler/NVIDIA-CUDA.cmake

@@ -4,6 +4,8 @@ set(CMAKE_CUDA_COMPILER_HAS_DEVICE_LINK_PHASE True)
 set(CMAKE_CUDA_VERBOSE_FLAG "-v")
 set(CMAKE_CUDA_VERBOSE_FLAG "-v")
 set(CMAKE_CUDA_VERBOSE_COMPILE_FLAG "-Xcompiler=-v")
 set(CMAKE_CUDA_VERBOSE_COMPILE_FLAG "-Xcompiler=-v")
 
 
+set(_CMAKE_COMPILE_AS_CUDA_FLAG "-x cu")
+
 if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89)
 if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89)
   # The -forward-unknown-to-host-compiler flag was only
   # The -forward-unknown-to-host-compiler flag was only
   # added to nvcc in 10.2 so before that we had no good
   # added to nvcc in 10.2 so before that we had no good

+ 1 - 1
Modules/Compiler/QCC-CXX.cmake

@@ -10,6 +10,6 @@ set(CMAKE_CXX_COMPILE_OBJECT
   "<CMAKE_CXX_COMPILER> -lang-c++ <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
   "<CMAKE_CXX_COMPILER> -lang-c++ <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
 
 
 set(CMAKE_CXX_LINK_EXECUTABLE
 set(CMAKE_CXX_LINK_EXECUTABLE
-  "<CMAKE_CXX_COMPILER> -lang-c++ <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS>  -o <TARGET> <LINK_LIBRARIES>")
+  "<CMAKE_CXX_COMPILER> -lang-c++ <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
 
 
 set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
 set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")

+ 6 - 2
Modules/Compiler/TI-C.cmake

@@ -14,5 +14,9 @@ set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> --compile_only --skip_ass
 set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> --preproc_only --c_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
 set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> --preproc_only --c_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
 
 
 set(CMAKE_C_COMPILE_OBJECT  "<CMAKE_C_COMPILER> --compile_only --c_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<OBJECT>")
 set(CMAKE_C_COMPILE_OBJECT  "<CMAKE_C_COMPILER> --compile_only --c_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<OBJECT>")
-set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> -r <TARGET> <OBJECTS>")
-set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>")
+set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qr <TARGET> <OBJECTS>")
+set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> qa <TARGET> <OBJECTS>")
+set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET_NAME>.map <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>")
+set(CMAKE_ASM_RESPONSE_FILE_FLAG "--cmd_file=")
+set(CMAKE_C_RESPONSE_FILE_FLAG "--cmd_file=")
+set(CMAKE_C_RESPONSE_FILE_LINK_FLAG " ")

+ 1 - 0
Modules/Compiler/XL-Fortran.cmake

@@ -8,6 +8,7 @@ set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-qfixed") # [=<right_margin>]
 set(CMAKE_Fortran_FORMAT_FREE_FLAG "-qfree") # [=f90|ibm]
 set(CMAKE_Fortran_FORMAT_FREE_FLAG "-qfree") # [=f90|ibm]
 
 
 set(CMAKE_Fortran_MODDIR_FLAG "-qmoddir=")
 set(CMAKE_Fortran_MODDIR_FLAG "-qmoddir=")
+set(CMAKE_Fortran_MODDIR_INCLUDE_FLAG "-I") # -qmoddir= does not affect search path
 
 
 set(CMAKE_Fortran_DEFINE_FLAG "-WF,-D")
 set(CMAKE_Fortran_DEFINE_FLAG "-WF,-D")
 
 

+ 26 - 16
Modules/ExternalProject.cmake

@@ -9,8 +9,11 @@ ExternalProject
 
 
    .. contents::
    .. contents::
 
 
+Commands
+^^^^^^^^
+
 External Project Definition
 External Project Definition
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
+"""""""""""""""""""""""""""
 
 
 .. command:: ExternalProject_Add
 .. command:: ExternalProject_Add
 
 
@@ -665,7 +668,7 @@ External Project Definition
   automatic substitutions that are supported for some options.
   automatic substitutions that are supported for some options.
 
 
 Obtaining Project Properties
 Obtaining Project Properties
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+""""""""""""""""""""""""""""
 
 
 .. command:: ExternalProject_Get_Property
 .. command:: ExternalProject_Get_Property
 
 
@@ -686,7 +689,7 @@ Obtaining Project Properties
     message("Source dir of myExtProj = ${SOURCE_DIR}")
     message("Source dir of myExtProj = ${SOURCE_DIR}")
 
 
 Explicit Step Management
 Explicit Step Management
-^^^^^^^^^^^^^^^^^^^^^^^^
+""""""""""""""""""""""""
 
 
 The ``ExternalProject_Add()`` function on its own is often sufficient for
 The ``ExternalProject_Add()`` function on its own is often sufficient for
 incorporating an external project into the main build. Certain scenarios
 incorporating an external project into the main build. Certain scenarios
@@ -2697,6 +2700,15 @@ function(_ep_add_download_command name)
     )
     )
 endfunction()
 endfunction()
 
 
+function(_ep_get_update_disconnected var name)
+  get_property(update_disconnected_set TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED SET)
+  if(update_disconnected_set)
+    get_property(update_disconnected TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED)
+  else()
+    get_property(update_disconnected DIRECTORY PROPERTY EP_UPDATE_DISCONNECTED)
+  endif()
+  set(${var} "${update_disconnected}" PARENT_SCOPE)
+endfunction()
 
 
 function(_ep_add_update_command name)
 function(_ep_add_update_command name)
   ExternalProject_Get_Property(${name} source_dir tmp_dir)
   ExternalProject_Get_Property(${name} source_dir tmp_dir)
@@ -2707,12 +2719,8 @@ function(_ep_add_update_command name)
   get_property(svn_repository TARGET ${name} PROPERTY _EP_SVN_REPOSITORY)
   get_property(svn_repository TARGET ${name} PROPERTY _EP_SVN_REPOSITORY)
   get_property(git_repository TARGET ${name} PROPERTY _EP_GIT_REPOSITORY)
   get_property(git_repository TARGET ${name} PROPERTY _EP_GIT_REPOSITORY)
   get_property(hg_repository  TARGET ${name} PROPERTY _EP_HG_REPOSITORY )
   get_property(hg_repository  TARGET ${name} PROPERTY _EP_HG_REPOSITORY )
-  get_property(update_disconnected_set TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED SET)
-  if(update_disconnected_set)
-    get_property(update_disconnected TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED)
-  else()
-    get_property(update_disconnected DIRECTORY PROPERTY EP_UPDATE_DISCONNECTED)
-  endif()
+
+  _ep_get_update_disconnected(update_disconnected ${name})
 
 
   set(work_dir)
   set(work_dir)
   set(comment)
   set(comment)
@@ -2874,10 +2882,17 @@ function(_ep_add_patch_command name)
     set(log "")
     set(log "")
   endif()
   endif()
 
 
+  _ep_get_update_disconnected(update_disconnected ${name})
+  if(update_disconnected)
+    set(update_dep skip-update)
+  else()
+    set(update_dep update)
+  endif()
+
   ExternalProject_Add_Step(${name} patch
   ExternalProject_Add_Step(${name} patch
     COMMAND ${cmd}
     COMMAND ${cmd}
     WORKING_DIRECTORY ${work_dir}
     WORKING_DIRECTORY ${work_dir}
-    DEPENDEES download
+    DEPENDEES download ${update_dep}
     ${log}
     ${log}
     )
     )
 endfunction()
 endfunction()
@@ -3028,12 +3043,7 @@ function(_ep_add_configure_command name)
     set(uses_terminal "")
     set(uses_terminal "")
   endif()
   endif()
 
 
-  get_property(update_disconnected_set TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED SET)
-  if(update_disconnected_set)
-    get_property(update_disconnected TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED)
-  else()
-    get_property(update_disconnected DIRECTORY PROPERTY EP_UPDATE_DISCONNECTED)
-  endif()
+  _ep_get_update_disconnected(update_disconnected ${name})
   if(update_disconnected)
   if(update_disconnected)
     set(update_dep skip-update)
     set(update_dep skip-update)
   else()
   else()

+ 27 - 2
Modules/FetchContent.cmake

@@ -76,8 +76,11 @@ sometimes useful as part of implementing some higher level feature or to
 populate some content in CMake's script mode.
 populate some content in CMake's script mode.
 
 
 
 
+Commands
+^^^^^^^^
+
 Declaring Content Details
 Declaring Content Details
-^^^^^^^^^^^^^^^^^^^^^^^^^
+"""""""""""""""""""""""""
 
 
 .. command:: FetchContent_Declare
 .. command:: FetchContent_Declare
 
 
@@ -130,7 +133,7 @@ Declaring Content Details
     )
     )
 
 
 Populating The Content
 Populating The Content
-^^^^^^^^^^^^^^^^^^^^^^
+""""""""""""""""""""""
 
 
 For most common scenarios, population means making content available to the
 For most common scenarios, population means making content available to the
 main build according to previously declared details for that dependency.
 main build according to previously declared details for that dependency.
@@ -793,6 +796,8 @@ function(__FetchContent_directPopulate contentName)
       SUBBUILD_DIR
       SUBBUILD_DIR
       SOURCE_DIR
       SOURCE_DIR
       BINARY_DIR
       BINARY_DIR
+      # We need special processing if DOWNLOAD_NO_EXTRACT is true
+      DOWNLOAD_NO_EXTRACT
       # Prevent the following from being passed through
       # Prevent the following from being passed through
       CONFIGURE_COMMAND
       CONFIGURE_COMMAND
       BUILD_COMMAND
       BUILD_COMMAND
@@ -843,6 +848,26 @@ function(__FetchContent_directPopulate contentName)
     set(ARG_EXTRA "${ARG_EXTRA} \"${arg}\"")
     set(ARG_EXTRA "${ARG_EXTRA} \"${arg}\"")
   endforeach()
   endforeach()
 
 
+  if(ARG_DOWNLOAD_NO_EXTRACT)
+    set(ARG_EXTRA "${ARG_EXTRA} DOWNLOAD_NO_EXTRACT YES")
+    set(__FETCHCONTENT_COPY_FILE
+"
+ExternalProject_Get_Property(${contentName}-populate DOWNLOADED_FILE)
+get_filename_component(dlFileName \"\${DOWNLOADED_FILE}\" NAME)
+
+ExternalProject_Add_Step(${contentName}-populate copyfile
+  COMMAND    \"${CMAKE_COMMAND}\" -E copy_if_different
+             \"<DOWNLOADED_FILE>\" \"${ARG_SOURCE_DIR}\"
+  DEPENDEES  patch
+  DEPENDERS  configure
+  BYPRODUCTS \"${ARG_SOURCE_DIR}/\${dlFileName}\"
+  COMMENT    \"Copying file to SOURCE_DIR\"
+)
+")
+  else()
+    unset(__FETCHCONTENT_COPY_FILE)
+  endif()
+
   # Hide output if requested, but save it to a variable in case there's an
   # Hide output if requested, but save it to a variable in case there's an
   # error so we can show the output upon failure. When not quiet, don't
   # error so we can show the output upon failure. When not quiet, don't
   # capture the output to a variable because the user may want to see the
   # capture the output to a variable because the user may want to see the

+ 2 - 0
Modules/FetchContent/CMakeLists.cmake.in

@@ -21,3 +21,5 @@ ExternalProject_Add(${contentName}-populate
                     USES_TERMINAL_DOWNLOAD  YES
                     USES_TERMINAL_DOWNLOAD  YES
                     USES_TERMINAL_UPDATE    YES
                     USES_TERMINAL_UPDATE    YES
 )
 )
+
+@__FETCHCONTENT_COPY_FILE@

+ 62 - 21
Modules/FindArmadillo.cmake

@@ -6,7 +6,7 @@ FindArmadillo
 -------------
 -------------
 
 
 Find the Armadillo C++ library.
 Find the Armadillo C++ library.
-Armadillo is library for linear algebra & scientific computing.
+Armadillo is a library for linear algebra & scientific computing.
 
 
 Using Armadillo:
 Using Armadillo:
 
 
@@ -31,19 +31,13 @@ This module sets the following variables:
   ARMADILLO_VERSION_NAME - name of the version (ex: "Antipodean Antileech")
   ARMADILLO_VERSION_NAME - name of the version (ex: "Antipodean Antileech")
 #]=======================================================================]
 #]=======================================================================]
 
 
-# UNIX paths are standard, no need to write.
-find_library(ARMADILLO_LIBRARY
-  NAMES armadillo
-  PATHS "$ENV{ProgramFiles}/Armadillo/lib"  "$ENV{ProgramFiles}/Armadillo/lib64" "$ENV{ProgramFiles}/Armadillo"
-  )
 find_path(ARMADILLO_INCLUDE_DIR
 find_path(ARMADILLO_INCLUDE_DIR
   NAMES armadillo
   NAMES armadillo
   PATHS "$ENV{ProgramFiles}/Armadillo/include"
   PATHS "$ENV{ProgramFiles}/Armadillo/include"
   )
   )
-
+mark_as_advanced(ARMADILLO_INCLUDE_DIR)
 
 
 if(ARMADILLO_INCLUDE_DIR)
 if(ARMADILLO_INCLUDE_DIR)
-
   # ------------------------------------------------------------------------
   # ------------------------------------------------------------------------
   #  Extract version information from <armadillo>
   #  Extract version information from <armadillo>
   # ------------------------------------------------------------------------
   # ------------------------------------------------------------------------
@@ -59,32 +53,79 @@ if(ARMADILLO_INCLUDE_DIR)
   if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/arma_version.hpp")
   if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/arma_version.hpp")
 
 
     # Read and parse armdillo version header file for version number
     # Read and parse armdillo version header file for version number
-    file(STRINGS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/arma_version.hpp" _armadillo_HEADER_CONTENTS REGEX "#define ARMA_VERSION_[A-Z]+ ")
-    string(REGEX REPLACE ".*#define ARMA_VERSION_MAJOR ([0-9]+).*" "\\1" ARMADILLO_VERSION_MAJOR "${_armadillo_HEADER_CONTENTS}")
-    string(REGEX REPLACE ".*#define ARMA_VERSION_MINOR ([0-9]+).*" "\\1" ARMADILLO_VERSION_MINOR "${_armadillo_HEADER_CONTENTS}")
-    string(REGEX REPLACE ".*#define ARMA_VERSION_PATCH ([0-9]+).*" "\\1" ARMADILLO_VERSION_PATCH "${_armadillo_HEADER_CONTENTS}")
+    file(STRINGS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/arma_version.hpp" _ARMA_HEADER_CONTENTS REGEX "#define ARMA_VERSION_[A-Z]+ ")
+    string(REGEX REPLACE ".*#define ARMA_VERSION_MAJOR ([0-9]+).*" "\\1" ARMADILLO_VERSION_MAJOR "${_ARMA_HEADER_CONTENTS}")
+    string(REGEX REPLACE ".*#define ARMA_VERSION_MINOR ([0-9]+).*" "\\1" ARMADILLO_VERSION_MINOR "${_ARMA_HEADER_CONTENTS}")
+    string(REGEX REPLACE ".*#define ARMA_VERSION_PATCH ([0-9]+).*" "\\1" ARMADILLO_VERSION_PATCH "${_ARMA_HEADER_CONTENTS}")
 
 
     # WARNING: The number of spaces before the version name is not one.
     # WARNING: The number of spaces before the version name is not one.
-    string(REGEX REPLACE ".*#define ARMA_VERSION_NAME +\"([0-9a-zA-Z _-]+)\".*" "\\1" ARMADILLO_VERSION_NAME "${_armadillo_HEADER_CONTENTS}")
+    string(REGEX REPLACE ".*#define ARMA_VERSION_NAME\ +\"([0-9a-zA-Z\ _-]+)\".*" "\\1" ARMADILLO_VERSION_NAME "${_ARMA_HEADER_CONTENTS}")
 
 
-    unset(_armadillo_HEADER_CONTENTS)
   endif()
   endif()
 
 
   set(ARMADILLO_VERSION_STRING "${ARMADILLO_VERSION_MAJOR}.${ARMADILLO_VERSION_MINOR}.${ARMADILLO_VERSION_PATCH}")
   set(ARMADILLO_VERSION_STRING "${ARMADILLO_VERSION_MAJOR}.${ARMADILLO_VERSION_MINOR}.${ARMADILLO_VERSION_PATCH}")
 endif ()
 endif ()
 
 
+if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp")
+  file(STRINGS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp" _ARMA_CONFIG_CONTENTS REGEX "^#define ARMA_USE_[A-Z]+")
+  string(REGEX MATCH "ARMA_USE_WRAPPER" _ARMA_USE_WRAPPER "${_ARMA_CONFIG_CONTENTS}")
+  string(REGEX MATCH "ARMA_USE_LAPACK" _ARMA_USE_LAPACK "${_ARMA_CONFIG_CONTENTS}")
+  string(REGEX MATCH "ARMA_USE_BLAS" _ARMA_USE_BLAS "${_ARMA_CONFIG_CONTENTS}")
+  string(REGEX MATCH "ARMA_USE_ARPACK" _ARMA_USE_ARPACK "${_ARMA_CONFIG_CONTENTS}")
+  string(REGEX MATCH "ARMA_USE_HDF5" _ARMA_USE_HDF5 "${_ARMA_CONFIG_CONTENTS}")
+endif()
+
 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+# If _ARMA_USE_WRAPPER is set, then we just link to armadillo, but if it's not then we need support libraries instead
+set(_ARMA_SUPPORT_LIBRARIES)
+
+if(_ARMA_USE_WRAPPER)
+  # Link to the armadillo wrapper library.
+  find_library(ARMADILLO_LIBRARY
+    NAMES armadillo
+    PATHS
+      "$ENV{ProgramFiles}/Armadillo/lib"
+      "$ENV{ProgramFiles}/Armadillo/lib64"
+      "$ENV{ProgramFiles}/Armadillo"
+    )
+  mark_as_advanced(ARMADILLO_LIBRARY)
+  set(_ARMA_REQUIRED_VARS ARMADILLO_LIBRARY)
+else()
+  # Link directly to individual components.
+  set(ARMADILLO_LIBRARY "")
+  foreach(pkg
+      LAPACK
+      BLAS
+      ARPACK
+      HDF5
+      )
+    if(_ARMA_USE_${pkg})
+      find_package(${pkg} QUIET)
+      list(APPEND _ARMA_REQUIRED_VARS "${pkg}_FOUND")
+      if(${pkg}_FOUND)
+        list(APPEND _ARMA_SUPPORT_LIBRARIES ${${pkg}_LIBRARIES})
+      endif()
+    endif()
+  endforeach()
+endif()
+
 find_package_handle_standard_args(Armadillo
 find_package_handle_standard_args(Armadillo
-  REQUIRED_VARS ARMADILLO_LIBRARY ARMADILLO_INCLUDE_DIR
+  REQUIRED_VARS ARMADILLO_INCLUDE_DIR ${_ARMA_REQUIRED_VARS}
   VERSION_VAR ARMADILLO_VERSION_STRING)
   VERSION_VAR ARMADILLO_VERSION_STRING)
-# version_var fails with cmake < 2.8.4.
 
 
 if (ARMADILLO_FOUND)
 if (ARMADILLO_FOUND)
   set(ARMADILLO_INCLUDE_DIRS ${ARMADILLO_INCLUDE_DIR})
   set(ARMADILLO_INCLUDE_DIRS ${ARMADILLO_INCLUDE_DIR})
-  set(ARMADILLO_LIBRARIES ${ARMADILLO_LIBRARY})
+  set(ARMADILLO_LIBRARIES ${ARMADILLO_LIBRARY} ${_ARMA_SUPPORT_LIBRARIES})
 endif ()
 endif ()
 
 
-# Hide internal variables
-mark_as_advanced(
-  ARMADILLO_INCLUDE_DIR
-  ARMADILLO_LIBRARY)
+# Clean up internal variables
+unset(_ARMA_REQUIRED_VARS)
+unset(_ARMA_SUPPORT_LIBRARIES)
+unset(_ARMA_USE_WRAPPER)
+unset(_ARMA_USE_LAPACK)
+unset(_ARMA_USE_BLAS)
+unset(_ARMA_USE_ARPACK)
+unset(_ARMA_USE_HDF5)
+unset(_ARMA_CONFIG_CONTENTS)
+unset(_ARMA_HEADER_CONTENTS)

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä