Imported Upstream version 3.20.1 upstream/3.20.1
authorDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 8 Oct 2021 00:20:46 +0000 (09:20 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 8 Oct 2021 00:20:46 +0000 (09:20 +0900)
111 files changed:
Help/command/add_custom_command.rst
Help/command/add_custom_target.rst
Help/command/add_library.rst
Help/command/configure_file.rst
Help/command/file.rst
Help/cpack_gen/nsis.rst
Help/manual/cmake-generator-expressions.7.rst
Help/prop_tgt/IMPORTED_LOCATION.rst
Help/prop_tgt/INSTALL_NAME_DIR.rst
Help/release/3.20.rst
Help/variable/CMAKE_APPLE_SILICON_PROCESSOR.rst
Help/variable/CMAKE_AUTOMOC_MACRO_NAMES.rst
Help/variable/CMAKE_INSTALL_NAME_DIR.rst
Modules/CMakeCUDAInformation.cmake
Modules/CMakeDetermineCompilerABI.cmake
Modules/CMakeDetermineCompilerId.cmake
Modules/CMakeFindBinUtils.cmake
Modules/CMakeFortranCompilerId.F.in
Modules/CMakeParseImplicitLinkInfo.cmake
Modules/CMakeParseLibraryArchitecture.cmake
Modules/Compiler/NVIDIA-CUDA.cmake
Modules/FindBLAS.cmake
Modules/FindHDF5.cmake
Modules/FindIntl.cmake
Modules/FindMPI.cmake
Modules/GNUInstallDirs.cmake
Modules/Platform/Android-Initialize.cmake
Modules/Platform/Android.cmake
Modules/Platform/Darwin.cmake
Modules/Platform/Linux.cmake
Modules/UseSWIG.cmake
Source/CMakeVersion.cmake
Source/CPack/cmCPackNSISGenerator.cxx
Source/cmCommandLineArgument.h
Source/cmConfigureFileCommand.cxx
Source/cmExportTryCompileFileGenerator.cxx
Source/cmFileCommand.cxx
Source/cmGccDepfileLexerHelper.cxx
Source/cmGeneratorTarget.cxx
Source/cmLocalNinjaGenerator.cxx
Source/cmQtAutoGenInitializer.cxx
Source/cmQtAutoMocUic.cxx
Tests/RunCMake/CMakeLists.txt
Tests/RunCMake/CMakeRelease/FileTable-stdout.txt [new file with mode: 0644]
Tests/RunCMake/CMakeRelease/FileTable.cmake [new file with mode: 0644]
Tests/RunCMake/CMakeRelease/RunCMakeTest.cmake [new file with mode: 0644]
Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-number-trailing--invalid-target-result.txt [new file with mode: 0644]
Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-number-trailing--invalid-target-stderr.txt [new file with mode: 0644]
Tests/RunCMake/CommandLine/RunCMakeTest.cmake
Tests/RunCMake/File_Generate/UseSourcePermissionsVerify.cmake
Tests/RunCMake/GenEx-DEVICE_LINK/DEVICE_LINK-try_compile.cmake [new file with mode: 0644]
Tests/RunCMake/GenEx-DEVICE_LINK/RunCMakeTest.cmake
Tests/RunCMake/GenEx-HOST_LINK/HOST_LINK-try_compile.cmake [new file with mode: 0644]
Tests/RunCMake/GenEx-HOST_LINK/RunCMakeTest.cmake
Tests/RunCMake/InitialFlags/C-stdout.txt [new file with mode: 0644]
Tests/RunCMake/InitialFlags/C.cmake [new file with mode: 0644]
Tests/RunCMake/InitialFlags/CMakeLists.txt [new file with mode: 0644]
Tests/RunCMake/InitialFlags/CXX-stdout.txt [new file with mode: 0644]
Tests/RunCMake/InitialFlags/CXX.cmake [new file with mode: 0644]
Tests/RunCMake/InitialFlags/RunCMakeTest.cmake [new file with mode: 0644]
Tests/RunCMake/Ninja/MyWindow.cpp [new file with mode: 0644]
Tests/RunCMake/Ninja/MyWindow.h [new file with mode: 0644]
Tests/RunCMake/Ninja/MyWindow.ui [new file with mode: 0644]
Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake
Tests/RunCMake/Ninja/RunCMakeTest.cmake
Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbg-debug-in-release-graph-ninja-stdout.txt [new file with mode: 0644]
Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbg-debug-ninja-stdout.txt [new file with mode: 0644]
Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbg-release-ninja-stdout.txt [new file with mode: 0644]
Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbgx-debug-in-release-graph-ninja-stdout.txt [new file with mode: 0644]
Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbgx-debug-ninja-stdout.txt [new file with mode: 0644]
Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbgx-release-ninja-stdout.txt [new file with mode: 0644]
Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_target_depend_out-debug-in-release-graph-ninja-stdout.txt
Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake
Tests/RunCMake/NinjaMultiConfig/LongCommandLine.cmake [new file with mode: 0644]
Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
Tests/RunCMake/ParseImplicitData/linux-C-NVHPC-21.1.0.input [new file with mode: 0644]
Tests/RunCMake/ParseImplicitData/linux-CXX-NVHPC-21.1.0.input [new file with mode: 0644]
Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake
Tests/RunCMake/ParseImplicitIncludeInfo/results/linux-C-NVHPC-21.1.0-empty.output [moved from Tests/RunCMake/configure_file/SourcePermissions-stderr.txt with 100% similarity]
Tests/RunCMake/ParseImplicitIncludeInfo/results/linux-CXX-NVHPC-21.1.0-empty.output [moved from Tests/RunCMake/configure_file/SourcePermissions-result.txt with 100% similarity]
Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake
Tests/RunCMake/ParseImplicitLinkInfo/results/linux-C-Intel-18.0.0.20170811.output
Tests/RunCMake/ParseImplicitLinkInfo/results/linux-C-NVHPC-21.1.0.output [new file with mode: 0644]
Tests/RunCMake/ParseImplicitLinkInfo/results/linux-C-XL-12.1.0.output
Tests/RunCMake/ParseImplicitLinkInfo/results/linux-C-XL-16.1.0.0.output
Tests/RunCMake/ParseImplicitLinkInfo/results/linux-CUDA-NVIDIA-10.1.168-XLClang-v.output
Tests/RunCMake/ParseImplicitLinkInfo/results/linux-CXX-Intel-18.0.0.20170811.output
Tests/RunCMake/ParseImplicitLinkInfo/results/linux-CXX-NVHPC-21.1.0.output [new file with mode: 0644]
Tests/RunCMake/ParseImplicitLinkInfo/results/linux-CXX-XL-12.1.0.output
Tests/RunCMake/ParseImplicitLinkInfo/results/linux-CXX-XL-16.1.0.0.output
Tests/RunCMake/ParseImplicitLinkInfo/results/linux-Fortran-XL-14.1.0.output
Tests/RunCMake/ParseImplicitLinkInfo/results/linux_nostdinc-C-PGI-18.10.1.output
Tests/RunCMake/ParseImplicitLinkInfo/results/linux_nostdinc-C-XL-12.1.0.output
Tests/RunCMake/ParseImplicitLinkInfo/results/linux_nostdinc-CXX-PGI-18.10.1.output
Tests/RunCMake/ParseImplicitLinkInfo/results/linux_nostdinc-CXX-XL-12.1.0.output
Tests/RunCMake/ParseImplicitLinkInfo/results/linux_nostdinc-Fortran-PGI-18.10.1.output
Tests/RunCMake/ParseImplicitLinkInfo/results/linux_nostdinc_i-C-XL-12.1.0.output
Tests/RunCMake/ParseImplicitLinkInfo/results/linux_pgf77-Fortran-PGI-18.10.1.output
Tests/RunCMake/RunCMake.cmake
Tests/RunCMake/configure_file/SourcePermissions.cmake
Tests/RunCMake/configure_file/UseSourcePermissions.cmake
Tests/RunCMake/target_link_options/RunCMakeTest.cmake
Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-check.cmake [new file with mode: 0644]
Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-result.txt [new file with mode: 0644]
Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake
Utilities/Release/README.rst
Utilities/Release/files-sign.bash [new file with mode: 0755]
Utilities/Release/files-v1.json.in [new file with mode: 0644]
Utilities/Release/files-v1.rst [new file with mode: 0644]
Utilities/Release/files.bash [new file with mode: 0755]
Utilities/cmlibarchive/libarchive/archive_random.c

index 183bb72..c0b9593 100644 (file)
@@ -80,8 +80,10 @@ The options are:
   :prop_sf:`GENERATED` files during ``make clean``.
 
   .. versionadded:: 3.20
-    Arguments to ``BYPRODUCTS`` may use
+    Arguments to ``BYPRODUCTS`` may use a restricted set of
     :manual:`generator expressions <cmake-generator-expressions(7)>`.
+    :ref:`Target-dependent expressions <Target-Dependent Queries>` are not
+    permitted.
 
 ``COMMAND``
   Specify the command-line(s) to execute at build time.
@@ -235,8 +237,10 @@ The options are:
   source file property.
 
   .. versionadded:: 3.20
-    Arguments to ``OUTPUT`` may use
+    Arguments to ``OUTPUT`` may use a restricted set of
     :manual:`generator expressions <cmake-generator-expressions(7)>`.
+    :ref:`Target-dependent expressions <Target-Dependent Queries>` are not
+    permitted.
 
 ``USES_TERMINAL``
   .. versionadded:: 3.2
index 22d3f29..def23fa 100644 (file)
@@ -55,8 +55,10 @@ The options are:
   :prop_sf:`GENERATED` files during ``make clean``.
 
   .. versionadded:: 3.20
-    Arguments to ``BYPRODUCTS`` may use
+    Arguments to ``BYPRODUCTS`` may use a restricted set of
     :manual:`generator expressions <cmake-generator-expressions(7)>`.
+    :ref:`Target-dependent expressions <Target-Dependent Queries>` are not
+    permitted.
 
 ``COMMAND``
   Specify the command-line(s) to execute at build time.
index d3fbdcf..dfc6500 100644 (file)
@@ -189,12 +189,24 @@ The ``<type>`` must be one of:
   References a library file located outside the project.  The
   :prop_tgt:`IMPORTED_LOCATION` target property (or its per-configuration
   variant :prop_tgt:`IMPORTED_LOCATION_<CONFIG>`) specifies the
-  location of the main library file on disk.  In the case of a ``SHARED``
-  library on Windows, the :prop_tgt:`IMPORTED_IMPLIB` target property
-  (or its per-configuration variant :prop_tgt:`IMPORTED_IMPLIB_<CONFIG>`)
-  specifies the location of the DLL import library file (``.lib`` or
-  ``.dll.a``) on disk, and the ``IMPORTED_LOCATION`` is the location of
-  the ``.dll`` runtime library (and is optional).
+  location of the main library file on disk:
+
+  * For a ``SHARED`` library on most non-Windows platforms, the main library
+    file is the ``.so`` or ``.dylib`` file used by both linkers and dynamic
+    loaders.  If the referenced library file has a ``SONAME`` (or on macOS,
+    has a ``LC_ID_DYLIB`` starting in ``@rpath/``), the value of that field
+    should be set in the :prop_tgt:`IMPORTED_SONAME` target property.
+    If the referenced library file does not have a ``SONAME``, but the
+    platform supports it, then  the :prop_tgt:`IMPORTED_NO_SONAME` target
+    property should be set.
+
+  * For a ``SHARED`` library on Windows, the :prop_tgt:`IMPORTED_IMPLIB`
+    target property (or its per-configuration variant
+    :prop_tgt:`IMPORTED_IMPLIB_<CONFIG>`) specifies the location of the
+    DLL import library file (``.lib`` or ``.dll.a``) on disk, and the
+    ``IMPORTED_LOCATION`` is the location of the ``.dll`` runtime
+    library (and is optional).
+
   Additional usage requirements may be specified in ``INTERFACE_*`` properties.
 
   An ``UNKNOWN`` library type is typically only used in the implementation of
index 63ea84d..d00f08b 100644 (file)
@@ -6,9 +6,9 @@ Copy a file to another location and modify its contents.
 .. code-block:: cmake
 
   configure_file(<input> <output>
-                 [FILE_PERMISSIONS <permissions>...]
+                 [NO_SOURCE_PERMISSIONS | USE_SOURCE_PERMISSIONS |
+                  FILE_PERMISSIONS <permissions>...]
                  [COPYONLY] [ESCAPE_QUOTES] [@ONLY]
-                 [NO_SOURCE_PERMISSIONS] [USE_SOURCE_PERMISSIONS]
                  [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])
 
 Copies an ``<input>`` file to an ``<output>`` file and substitutes
@@ -75,8 +75,27 @@ The arguments are:
   If the path names an existing directory the output file is placed
   in that directory with the same file name as the input file.
 
+``NO_SOURCE_PERMISSIONS``
+  .. versionadded:: 3.19
+
+  Do not transfer the permissions of the input file to the output file.
+  The copied file permissions default to the standard 644 value
+  (-rw-r--r--).
+
+``USE_SOURCE_PERMISSIONS``
+  .. versionadded:: 3.20
+
+  Transfer the permissions of the input file to the output file.
+  This is already the default behavior if none of the three permissions-related
+  keywords are given (``NO_SOURCE_PERMISSIONS``, ``USE_SOURCE_PERMISSIONS``
+  or ``FILE_PERMISSIONS``).  The ``USE_SOURCE_PERMISSIONS`` keyword mostly
+  serves as a way of making the intended behavior clearer at the call site.
+
 ``FILE_PERMISSIONS <permissions>...``
-  Use user provided permissions for the output file.
+  .. versionadded:: 3.20
+
+  Ignore the input file's permissions and use the specified ``<permissions>``
+  for the output file instead.
 
 ``COPYONLY``
   Copy the file without replacing any variable references or other
@@ -89,18 +108,6 @@ The arguments are:
   Restrict variable replacement to references of the form ``@VAR@``.
   This is useful for configuring scripts that use ``${VAR}`` syntax.
 
-``NO_SOURCE_PERMISSIONS``
-  .. versionadded:: 3.19
-
-  Does not transfer the file permissions of the original file to the copy.
-  The copied file permissions default to the standard 644 value
-  (-rw-r--r--).
-
-``USE_SOURCE_PERMISSIONS``
-  .. versionadded:: 3.20
-
-  Transfer the file permissions of the original file to the output file.
-
 ``NEWLINE_STYLE <style>``
   Specify the newline style for the output file.  Specify
   ``UNIX`` or ``LF`` for ``\n`` newlines, or specify
index 3db605d..24e43e9 100644 (file)
@@ -480,8 +480,8 @@ modified.
   file(GENERATE OUTPUT output-file
        <INPUT input-file|CONTENT content>
        [CONDITION expression] [TARGET target]
-       [FILE_PERMISSIONS <permissions>...]
-       [NO_SOURCE_PERMISSIONS] [USE_SOURCE_PERMISSIONS]
+       [NO_SOURCE_PERMISSIONS | USE_SOURCE_PERMISSIONS |
+        FILE_PERMISSIONS <permissions>...]
        [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])
 
 Generate an output file for each build configuration supported by the current
@@ -523,16 +523,26 @@ from the input content to produce the output content.  The options are:
   require a target for evaluation (e.g. ``$<COMPILE_FEATURES:...>``,
   ``$<TARGET_PROPERTY:prop>``).
 
-``FILE_PERMISSIONS <permissions>...``
-  Use user provided permissions for the generated file.
-
 ``NO_SOURCE_PERMISSIONS``
+  .. versionadded:: 3.20
+
   The generated file permissions default to the standard 644 value
   (-rw-r--r--).
 
 ``USE_SOURCE_PERMISSIONS``
-  Transfer the file permissions of the original file to the generated file.
-  This option expects INPUT option.
+  .. versionadded:: 3.20
+
+  Transfer the file permissions of the ``INPUT`` file to the generated file.
+  This is already the default behavior if none of the three permissions-related
+  keywords are given (``NO_SOURCE_PERMISSIONS``, ``USE_SOURCE_PERMISSIONS``
+  or ``FILE_PERMISSIONS``).  The ``USE_SOURCE_PERMISSIONS`` keyword mostly
+  serves as a way of making the intended behavior clearer at the call site.
+  It is an error to specify this option without ``INPUT``.
+
+``FILE_PERMISSIONS <permissions>...``
+  .. versionadded:: 3.20
+
+  Use the specified permissions for the generated file.
 
 ``NEWLINE_STYLE <style>``
   .. versionadded:: 3.20
@@ -702,9 +712,9 @@ Create the given directories and their parents as needed.
 .. code-block:: cmake
 
   file(<COPY|INSTALL> <files>... DESTINATION <dir>
+       [NO_SOURCE_PERMISSIONS | USE_SOURCE_PERMISSIONS]
        [FILE_PERMISSIONS <permissions>...]
        [DIRECTORY_PERMISSIONS <permissions>...]
-       [NO_SOURCE_PERMISSIONS] [USE_SOURCE_PERMISSIONS]
        [FOLLOW_SYMLINK_CHAIN]
        [FILES_MATCHING]
        [[PATTERN <pattern> | REGEX <regex>]
index eaef8ae..de1f3b5 100644 (file)
@@ -193,3 +193,5 @@ on Windows Nullsoft Scriptable Install System.
  .. versionadded:: 3.20
 
  If set, trim down the size of the control to the size of the branding text string.
+ Allowed values for this variable are ``LEFT``, ``CENTER`` or ``RIGHT``.
+ If not specified, the default behavior is ``LEFT``.
index ca4ea3e..7bc490f 100644 (file)
@@ -709,6 +709,8 @@ Variable Queries
     properties to avoid side-effects due to the double evaluation of
     these properties.
 
+.. _`Target-Dependent Queries`:
+
 Target-Dependent Queries
 ------------------------
 
index f0a1646..ddd910a 100644 (file)
@@ -4,12 +4,12 @@ IMPORTED_LOCATION
 Full path to the main file on disk for an ``IMPORTED`` target.
 
 Set this to the location of an ``IMPORTED`` target file on disk.  For
-executables this is the location of the executable file.  For bundles
-on macOS this is the location of the executable file inside
-``Contents/MacOS`` under the application bundle folder.  For ``STATIC``
+executables this is the location of the executable file.  For ``STATIC``
 libraries and modules this is the location of the library or module.
 For ``SHARED`` libraries on non-DLL platforms this is the location of the
-shared library.  For frameworks on macOS this is the location of the
+shared library.  For application bundles on macOS this is the location of
+the executable file inside ``Contents/MacOS`` within the bundle folder.
+For frameworks on macOS this is the location of the
 library file symlink just inside the framework folder.  For DLLs this
 is the location of the ``.dll`` part of the library.  For ``UNKNOWN``
 libraries this is the location of the file to be linked.  Ignored for
index 8faefb7..47a0037 100644 (file)
@@ -1,11 +1,13 @@
 INSTALL_NAME_DIR
 ----------------
 
-macOS directory name for installed targets.
+Directory name for installed targets on Apple platforms.
 
 ``INSTALL_NAME_DIR`` is a string specifying the directory portion of the
-"install_name" field of shared libraries on macOS to use in the
-installed targets.
+"install_name" field of shared libraries on Apple platforms for
+installed targets.  When not set, the default directory used is determined
+by :prop_tgt:`MACOSX_RPATH`.  Policies :policy:`CMP0068` and :policy:`CMP0042`
+are also relevant.
 
 This property is initialized by the value of the variable
 :variable:`CMAKE_INSTALL_NAME_DIR` if it is set when a target is
index 176447d..e452926 100644 (file)
@@ -327,3 +327,23 @@ Other Changes
   `cmake.org <https://cmake.org/download/>`_ have changed their naming pattern
   to ``cmake-$ver-windows-$arch``, where ``$arch`` is either ``x86_64`` or
   ``i386``.
+
+Updates
+=======
+
+Changes made since CMake 3.20.0 include the following.
+
+3.20.1
+------
+
+* The :module:`FindIntl` module in CMake 3.20.0 added checks
+  ``Intl_HAVE_GETTEXT_BUILTIN``, ``Intl_HAVE_DCGETTEXT_BUILTIN``,
+  and ``Intl_IS_BUILTIN``, but they were not implemented correctly.
+  These have been removed and replaced with a single ``Intl_IS_BUILT_IN``
+  check, whose name is consistent with the :module:`FindIconv` module.
+
+* The ``-rpath`` linker flag is now specified as supported on all Apple
+  platforms, not just macOS.  The ``install_name_dir`` used for
+  iOS, tvOS and watchOS should now default to ``@rpath`` instead of using
+  a full absolute path and failing at runtime when the library or framework
+  is embedded in an application bundle (see :prop_tgt:`XCODE_EMBED_<type>`).
index ad297c3..0d5ccd1 100644 (file)
@@ -8,8 +8,7 @@ CMake what architecture to use for :variable:`CMAKE_HOST_SYSTEM_PROCESSOR`.
 The value must be either ``arm64`` or ``x86_64``.
 
 The value of this variable should never be modified by project code.
-It is meant to be set by a toolchain file specified by the
-:variable:`CMAKE_TOOLCHAIN_FILE` variable, or as a cache entry
-provided by the user, e.g. via ``-DCMAKE_APPLE_SILICON_PROCESSOR=...``.
+It is meant to be set as a cache entry provided by the user,
+e.g. via ``-DCMAKE_APPLE_SILICON_PROCESSOR=...``.
 
 See also the :envvar:`CMAKE_APPLE_SILICON_PROCESSOR` environment variable.
index 8e34df2..1153cb2 100644 (file)
@@ -11,7 +11,7 @@ This variable is used to initialize the :prop_tgt:`AUTOMOC_MACRO_NAMES`
 property on all the targets. See that target property for additional
 information.
 
-The default value is ``Q_OBJECT;Q_GADGET;Q_NAMESPACE``.
+The default value is ``Q_OBJECT;Q_GADGET;Q_NAMESPACE;Q_NAMESPACE_EXPORT``.
 
 Example
 ^^^^^^^
index 5ba4c04..b07d44f 100644 (file)
@@ -1,7 +1,7 @@
 CMAKE_INSTALL_NAME_DIR
 ----------------------
 
-macOS directory name for installed targets.
+Directory name for installed targets on Apple platforms.
 
 ``CMAKE_INSTALL_NAME_DIR`` is used to initialize the
 :prop_tgt:`INSTALL_NAME_DIR` property on all targets.  See that target
index cb03ef4..5fd54c1 100644 (file)
@@ -111,6 +111,9 @@ include(CMakeCommonLanguageInclude)
 # CMAKE_CUDA_LINK_EXECUTABLE
 
 if(CMAKE_CUDA_HOST_COMPILER AND CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
+  # FIXME: This is too late for the Platform/Windows-NVIDIA-CUDA module to
+  # see it, so we do not support CMAKE_CUDA_HOST_COMPILER on Windows.
+  # Move this to Compiler/NVIDIA-CUDA and update the VS generator too.
   string(APPEND _CMAKE_CUDA_EXTRA_FLAGS " -ccbin=<CMAKE_CUDA_HOST_COMPILER>")
 endif()
 
index cf028f1..8191d81 100644 (file)
@@ -135,11 +135,13 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
 
       # Parse implicit linker information for this language, if available.
       set(implicit_dirs "")
+      set(implicit_objs "")
       set(implicit_libs "")
       set(implicit_fwks "")
       if(CMAKE_${lang}_VERBOSE_FLAG)
         CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs implicit_fwks log
-          "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}")
+          "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}"
+          COMPUTE_IMPLICIT_OBJECTS implicit_objs)
         file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
           "Parsed ${lang} implicit link information from above output:\n${log}\n\n")
       endif()
@@ -176,7 +178,7 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
       set(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE)
       set(CMAKE_${lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${implicit_fwks}" PARENT_SCOPE)
 
-      cmake_parse_library_architecture("${implicit_dirs}" architecture_flag)
+      cmake_parse_library_architecture(${lang} "${implicit_dirs}" "${implicit_objs}" architecture_flag)
       if(architecture_flag)
         set(CMAKE_${lang}_LIBRARY_ARCHITECTURE "${architecture_flag}" PARENT_SCOPE)
       endif()
index 1595cfd..ad9503c 100644 (file)
@@ -1,9 +1,9 @@
 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
 # file Copyright.txt or https://cmake.org/licensing for details.
 
-macro(__determine_compiler_id_test testflags_in userflags)
-  separate_arguments(testflags UNIX_COMMAND "${testflags_in}")
-  CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${testflags}" "${userflags}" "${src}")
+macro(__determine_compiler_id_test testflags_var userflags_var)
+  separate_arguments(testflags UNIX_COMMAND "${${testflags_var}}")
+  CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${testflags}" "${${userflags_var}}" "${src}")
   CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR("${lang}" "${COMPILER_${lang}_PRODUCED_OUTPUT}")
 
   if(NOT CMAKE_${lang}_COMPILER_ID)
@@ -44,7 +44,8 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
     endif()
 
     foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "")
-      __determine_compiler_id_test("${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST}" "${userflags}")
+      set(testflags "${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST}")
+      __determine_compiler_id_test(testflags userflags)
       if(CMAKE_${lang}_COMPILER_ID)
         break()
       endif()
@@ -55,7 +56,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
     # of helper flags.  Stop when the compiler is identified.
     foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "")
       foreach(testflags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST} "" ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS})
-        __determine_compiler_id_test("${testflags}" "${userflags}")
+        __determine_compiler_id_test(testflags userflags)
         if(CMAKE_${lang}_COMPILER_ID)
           break()
         endif()
index ff178f6..f32266f 100644 (file)
@@ -99,6 +99,8 @@ else()
       set(_CMAKE_LINKER_NAMES "ld.lld")
     endif()
     list(APPEND _CMAKE_AR_NAMES "llvm-ar")
+    list(APPEND _CMAKE_RANLIB_NAMES "llvm-ranlib")
+    list(APPEND _CMAKE_STRIP_NAMES "llvm-strip")
     list(APPEND _CMAKE_NM_NAMES "llvm-nm")
     list(APPEND _CMAKE_OBJDUMP_NAMES "llvm-objdump")
     list(APPEND _CMAKE_OBJCOPY_NAMES "llvm-objcopy")
@@ -121,19 +123,19 @@ else()
     list(APPEND _CMAKE_TOOL_VARS AR RANLIB STRIP LINKER NM OBJDUMP OBJCOPY READELF DLLTOOL ADDR2LINE)
 endif()
 
-foreach(TOOL IN LISTS _CMAKE_TOOL_VARS)
-  foreach(NAME IN LISTS _CMAKE_${TOOL}_NAMES)
+foreach(_tool IN LISTS _CMAKE_TOOL_VARS)
+  foreach(_name IN LISTS _CMAKE_${_tool}_NAMES)
     if(NOT _CMAKE_TOOLCHAIN_PREFIX STREQUAL "")
       if(NOT _CMAKE_TOOLCHAIN_SUFFIX STREQUAL "")
-        list(PREPEND _CMAKE_${TOOL}_NAMES ${NAME}${_CMAKE_TOOLCHAIN_SUFFIX})
+        list(PREPEND _CMAKE_${_tool}_NAMES ${_name}${_CMAKE_TOOLCHAIN_SUFFIX})
       endif()
-      list(PREPEND _CMAKE_${TOOL}_NAMES ${_CMAKE_TOOLCHAIN_PREFIX}${NAME})
+      list(PREPEND _CMAKE_${_tool}_NAMES ${_CMAKE_TOOLCHAIN_PREFIX}${_name})
     endif()
     if(NOT _CMAKE_TOOLCHAIN_SUFFIX STREQUAL "")
-      list(PREPEND _CMAKE_${TOOL}_NAMES ${_CMAKE_TOOLCHAIN_PREFIX}${NAME}${_CMAKE_TOOLCHAIN_SUFFIX})
+      list(PREPEND _CMAKE_${_tool}_NAMES ${_CMAKE_TOOLCHAIN_PREFIX}${_name}${_CMAKE_TOOLCHAIN_SUFFIX})
     endif()
   endforeach()
-  find_program(CMAKE_${TOOL} NAMES ${_CMAKE_${TOOL}_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+  find_program(CMAKE_${_tool} NAMES ${_CMAKE_${_tool}_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
 endforeach()
 
 if(NOT CMAKE_RANLIB)
@@ -152,12 +154,12 @@ if(CMAKE_PLATFORM_HAS_INSTALLNAME)
 endif()
 
 # Mark any tool cache entries as advanced.
-foreach(var IN LISTS _CMAKE_TOOL_VARS)
-  get_property(_CMAKE_TOOL_CACHED CACHE CMAKE_${var} PROPERTY TYPE)
+foreach(_tool IN LISTS _CMAKE_TOOL_VARS)
+  get_property(_CMAKE_TOOL_CACHED CACHE CMAKE_${_tool} PROPERTY TYPE)
   if(_CMAKE_TOOL_CACHED)
-    mark_as_advanced(CMAKE_${var})
+    mark_as_advanced(CMAKE_${_tool})
   endif()
-  unset(_CMAKE_${var}_NAMES)
+  unset(_CMAKE_${_tool}_NAMES)
 endforeach()
 unset(_CMAKE_TOOL_VARS)
 unset(_CMAKE_TOOL_CACHED)
index 0a3db4c..0f547e9 100644 (file)
@@ -62,6 +62,9 @@
         PRINT *, 'INFO:compiler[Cray]'
 # define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
 # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
+# if defined(_RELEASE_PATCHLEVEL)
+#  define COMPILER_VERSION_PATCH DEC(_RELEASE_PATCHLEVEL)
+# endif
 #elif defined(__G95__)
         PRINT *, 'INFO:compiler[G95]'
 # define COMPILER_VERSION_MAJOR DEC(__G95__)
index 0465515..e848b55 100644 (file)
@@ -5,16 +5,27 @@ cmake_policy(PUSH)
 cmake_policy(SET CMP0053 NEW)
 cmake_policy(SET CMP0054 NEW)
 
-# Function parse implicit linker options.
+# Function to parse implicit linker options.
+#
 # This is used internally by CMake and should not be included by user
 # code.
-
+#
+# Note: this function is leaked/exposed by FindOpenMP and therefore needs
+# to have a stable API so projects that copied `FindOpenMP` for backwards
+# compatibility don't break.
+#
 function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj_regex)
   set(implicit_libs_tmp "")
+  set(implicit_objs_tmp "")
   set(implicit_dirs_tmp)
   set(implicit_fwks_tmp)
   set(log "")
 
+  set(keywordArgs)
+  set(oneValueArgs COMPUTE_IMPLICIT_OBJECTS)
+  set(multiValueArgs )
+  cmake_parse_arguments(EXTRA_PARSE "${keywordArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
   # Parse implicit linker arguments.
   set(linker "CMAKE_LINKER-NOTFOUND")
   if(CMAKE_LINKER)
@@ -103,11 +114,15 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
           set(lib "${CMAKE_MATCH_2}")
           list(APPEND implicit_libs_tmp ${lib})
           string(APPEND log "    arg [${arg}] ==> lib [${lib}]\n")
-        elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.o$"
-            AND obj_regex AND "${arg}" MATCHES "${obj_regex}")
-          # Object file full path.
-          list(APPEND implicit_libs_tmp ${arg})
-          string(APPEND log "    arg [${arg}] ==> obj [${arg}]\n")
+        elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.o$")
+          if(EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS)
+            list(APPEND implicit_objs_tmp ${arg})
+            string(APPEND log "    arg [${arg}] ==> obj [${arg}]\n")
+          endif()
+          if(obj_regex AND "${arg}" MATCHES "${obj_regex}")
+            # Object file full path.
+            list(APPEND implicit_libs_tmp ${arg})
+          endif()
         elseif("${arg}" MATCHES "^-Y(P,)?[^0-9]")
           # Sun search path ([^0-9] avoids conflict with Mac -Y<num>).
           string(REGEX REPLACE "^-Y(P,)?" "" dirs "${arg}")
@@ -170,6 +185,21 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
     endif()
   endforeach()
 
+  if(EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS)
+    set(implicit_objs "")
+    foreach(obj IN LISTS implicit_objs_tmp)
+      if(IS_ABSOLUTE "${obj}")
+        get_filename_component(abs "${obj}" ABSOLUTE)
+        if(NOT "x${obj}" STREQUAL "x${abs}")
+          string(APPEND log "  collapse obj [${obj}] ==> [${abs}]\n")
+        endif()
+        list(APPEND implicit_objs "${abs}")
+      else()
+        list(APPEND implicit_objs "${obj}")
+      endif()
+    endforeach()
+  endif()
+
   # Cleanup list of library and framework directories.
   set(desc_dirs "library")
   set(desc_fwks "framework")
@@ -191,6 +221,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
 
   # Log results.
   string(APPEND log "  implicit libs: [${implicit_libs}]\n")
+  string(APPEND log "  implicit objs: [${implicit_objs}]\n")
   string(APPEND log "  implicit dirs: [${implicit_dirs}]\n")
   string(APPEND log "  implicit fwks: [${implicit_fwks}]\n")
 
@@ -199,6 +230,10 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
   set(${dir_var} "${implicit_dirs}" PARENT_SCOPE)
   set(${fwk_var} "${implicit_fwks}" PARENT_SCOPE)
   set(${log_var} "${log}" PARENT_SCOPE)
+
+  if(EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS)
+    set(${EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS} "${implicit_objs}" PARENT_SCOPE)
+  endif()
 endfunction()
 
 cmake_policy(POP)
index aa6fd74..6fb9c6b 100644 (file)
@@ -9,24 +9,22 @@ cmake_policy(SET CMP0054 NEW)
 # This is used internally by CMake and should not be included by user
 # code.
 
-function(cmake_parse_library_architecture implicit_dirs output_var)
+function(cmake_parse_library_architecture lang implicit_dirs implicit_objs output_var)
   unset(library_arch)
   # Detect library architecture directory name.
   if(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
-    foreach(dir ${implicit_dirs})
+    foreach(dir IN LISTS implicit_dirs)
       if("${dir}" MATCHES "/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$")
         get_filename_component(arch "${dir}" NAME)
         set(library_arch "${arch}")
         break()
       endif()
     endforeach()
-  endif()
 
-  if(CMAKE_LIBRARY_ARCHITECTURE_REGEX_VERSIONED AND NOT library_arch)
-    foreach(dir ${implicit_dirs})
-      if("${dir}" MATCHES "/${CMAKE_LIBRARY_ARCHITECTURE_REGEX_VERSIONED}$")
-        get_filename_component(arch "${dir}" DIRECTORY)
-        get_filename_component(arch "${arch}" NAME)
+    foreach(obj IN LISTS implicit_objs)
+      get_filename_component(dir "${obj}" DIRECTORY)
+      if("${dir}" MATCHES "(/usr)+/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$")
+        get_filename_component(arch "${dir}" NAME)
         set(library_arch "${arch}")
         break()
       endif()
index eb80675..a0f7c05 100644 (file)
@@ -30,7 +30,15 @@ if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89)
   # to get header dependency information
   set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
 else()
-  set(CMAKE_CUDA_DEPENDS_EXTRA_COMMANDS "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M <SOURCE> -MT <OBJECT> -o <DEP_FILE>")
+  if(CMAKE_CUDA_HOST_COMPILER AND NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
+    # FIXME: Move the main -ccbin= flag from CMakeCUDAInformation to
+    # a block above, remove this copy, and update the VS generator too.
+    set(_CMAKE_CUDA_EXTRA_FLAGS_LOCAL " -ccbin=<CMAKE_CUDA_HOST_COMPILER>")
+  else()
+    set(_CMAKE_CUDA_EXTRA_FLAGS_LOCAL "")
+  endif()
+  set(CMAKE_CUDA_DEPENDS_EXTRA_COMMANDS "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS}${_CMAKE_CUDA_EXTRA_FLAGS_LOCAL} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M <SOURCE> -MT <OBJECT> -o <DEP_FILE>")
+  unset(_CMAKE_CUDA_EXTRA_FLAGS_LOCAL)
 endif()
 set(CMAKE_CUDA_DEPFILE_FORMAT gcc)
 if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
index 4cf812b..b4650b2 100644 (file)
@@ -619,8 +619,17 @@ if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All")
     endif()
     set(_threadlibs "${CMAKE_THREAD_LIBS_INIT}")
     if(BLA_STATIC)
-      find_package(OpenMP COMPONENTS C)
-      list(PREPEND _threadlibs "${OpenMP_C_LIBRARIES}")
+      set(_blas_STATIC_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}")
+      set(CMAKE_FIND_LIBRARY_SUFFIXES "${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}")
+      if (CMAKE_C_COMPILER_LOADED)
+        find_package(OpenMP COMPONENTS C)
+        list(PREPEND _threadlibs "${OpenMP_C_LIBRARIES}")
+      elseif(CMAKE_CXX_COMPILER_LOADED)
+        find_package(OpenMP COMPONENTS CXX)
+        list(PREPEND _threadlibs "${OpenMP_CXX_LIBRARIES}")
+      endif()
+      set(CMAKE_FIND_LIBRARY_SUFFIXES "${_blas_STATIC_CMAKE_FIND_LIBRARY_SUFFIXES}")
+      unset(_blas_STATIC_CMAKE_FIND_LIBRARY_SUFFIXES)
     endif()
     check_blas_libraries(
       BLAS_LIBRARIES
index 16bf279..ec5ebdd 100644 (file)
@@ -797,7 +797,7 @@ if( NOT HDF5_FOUND )
     set(HDF5_CXX_HL_LIBRARY_NAMES     hdf5_hl_cpp ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_CXX_LIBRARY_NAMES})
 
     set(HDF5_Fortran_LIBRARY_NAMES    hdf5_fortran   ${HDF5_C_LIBRARY_NAMES})
-    set(HDF5_Fortran_HL_LIBRARY_NAMES hdf5hl_fortran ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_Fortran_LIBRARY_NAMES})
+    set(HDF5_Fortran_HL_LIBRARY_NAMES hdf5_hl_fortran hdf5hl_fortran ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_Fortran_LIBRARY_NAMES})
 
     # suffixes as seen on Linux, MSYS2, ...
     set(_lib_suffixes hdf5)
index 686c818..43398c1 100644 (file)
@@ -10,27 +10,38 @@ FindIntl
 Find the Gettext libintl headers and libraries.
 
 This module reports information about the Gettext libintl
-installation in several variables.  General variables::
+installation in several variables.
 
-  Intl_FOUND - true if the libintl headers and libraries were found
-  Intl_INCLUDE_DIRS - the directory containing the libintl headers
-  Intl_LIBRARIES - libintl libraries to be linked
+.. variable:: Intl_FOUND
+
+  True if libintl is found.
+
+.. variable:: Intl_INCLUDE_DIRS
+
+  The directory containing the libintl headers.
+
+.. variable:: Intl_LIBRARIES
+
+  The intl libraries to be linked.
 
 .. versionadded:: 3.20
   This module defines :prop_tgt:`IMPORTED` target ``Intl::Intl``.
 
-The following cache variables may also be set::
+The following cache variables may also be set:
 
-  Intl_INCLUDE_DIR - the directory containing the libintl headers
-  Intl_LIBRARY - the libintl library (if any)
-  Intl_HAVE_GETTEXT_BUILTIN - check if gettext is in the C library
-  Intl_HAVE_DCGETTEXT_BUILTIN - check if dcgettext is in the C library
-  Intl_IS_BUILTIN - whether intl is a part of the C library determined
-      from the result of Intl_HAVE_GETTEXT_BUILTIN and Intl_HAVE_DCGETTEXT_BUILTIN
+.. variable:: Intl_INCLUDE_DIR
 
-.. versionadded:: 3.20
-  Added the ``Intl_HAVE_GETTEXT_BUILTIN``, ``Intl_HAVE_DCGETTEXT_BUILTIN`` and
-  ``Intl_IS_BUILTIN`` variables.
+  The directory containing the libintl headers
+
+.. variable:: Intl_LIBRARY
+
+  The libintl library (if any)
+
+.. variable:: Intl_IS_BUILT_IN
+
+  .. versionadded:: 3.20
+
+  whether ``intl`` is a part of the C library.
 
 .. note::
   On some platforms, such as Linux with GNU libc, the gettext
@@ -43,50 +54,74 @@ The following cache variables may also be set::
   ``msgfmt``, etc.), use :module:`FindGettext`.
 #]=======================================================================]
 
-
-# Written by Roger Leigh <rleigh@codelibre.net>
-
 include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
-include(${CMAKE_CURRENT_LIST_DIR}/CheckSymbolExists.cmake)
+if(CMAKE_C_COMPILER_LOADED)
+  include(${CMAKE_CURRENT_LIST_DIR}/CheckCSourceCompiles.cmake)
+elseif(CMAKE_CXX_COMPILER_LOADED)
+  include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSourceCompiles.cmake)
+else()
+  # If neither C nor CXX are loaded, implicit intl makes no sense.
+  set(Intl_IS_BUILT_IN FALSE)
+endif()
 
-# Check if we have libintl is a part of libc
-cmake_push_check_state(RESET)
-set(CMAKE_REQUIRED_QUIET TRUE)
-check_symbol_exists(gettext libintl.h Intl_HAVE_GETTEXT_BUILTIN)
-check_symbol_exists(dcgettext libintl.h Intl_HAVE_DCGETTEXT_BUILTIN) # redundant check
-cmake_pop_check_state()
+# Check if Intl is built in to the C library.
+if(NOT DEFINED Intl_IS_BUILT_IN)
+  if(NOT DEFINED Intl_INCLUDE_DIR AND NOT DEFINED Intl_LIBRARY)
+    cmake_push_check_state(RESET)
+    set(CMAKE_REQUIRED_QUIET TRUE)
+    set(Intl_IMPLICIT_TEST_CODE [[
+#include <libintl.h>
+int main(void) {
+  gettext("");
+  dgettext("", "");
+  dcgettext("", "", 0);
+  return 0;
+}
+]])
+    if(CMAKE_C_COMPILER_LOADED)
+      check_c_source_compiles("${Intl_IMPLICIT_TEST_CODE}" Intl_IS_BUILT_IN)
+    else()
+      check_cxx_source_compiles("${Intl_IMPLICIT_TEST_CODE}" Intl_IS_BUILT_IN)
+    endif()
+    cmake_pop_check_state()
+  else()
+    set(Intl_IS_BUILT_IN FALSE)
+  endif()
+endif()
 
-if(Intl_HAVE_GETTEXT_BUILTIN AND Intl_HAVE_DCGETTEXT_BUILTIN)
-  set(Intl_IS_BUILTIN TRUE)
+set(_Intl_REQUIRED_VARS)
+if(Intl_IS_BUILT_IN)
+  set(_Intl_REQUIRED_VARS _Intl_IS_BUILT_IN_MSG)
+  set(_Intl_IS_BUILT_IN_MSG "built in to C library")
 else()
-  set(Intl_IS_BUILTIN FALSE)
-endif()
+  set(_Intl_REQUIRED_VARS Intl_LIBRARY Intl_INCLUDE_DIR)
 
-# Find include directory
-find_path(Intl_INCLUDE_DIR
-          NAMES "libintl.h"
-          DOC "libintl include directory")
-mark_as_advanced(Intl_INCLUDE_DIR)
+  find_path(Intl_INCLUDE_DIR
+            NAMES "libintl.h"
+            DOC "libintl include directory")
+  mark_as_advanced(Intl_INCLUDE_DIR)
 
-# Find all Intl libraries
-set(Intl_REQUIRED_VARS)
-if(NOT Intl_IS_BUILTIN)
   find_library(Intl_LIBRARY "intl" "libintl" NAMES_PER_DIR
     DOC "libintl libraries (if not in the C library)")
   mark_as_advanced(Intl_LIBRARY)
-  list(APPEND Intl_REQUIRED_VARS Intl_LIBRARY)
 endif()
 
 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Intl
                                   FOUND_VAR Intl_FOUND
-                                  REQUIRED_VARS Intl_INCLUDE_DIR ${Intl_REQUIRED_VARS}
+                                  REQUIRED_VARS ${_Intl_REQUIRED_VARS}
                                   FAIL_MESSAGE "Failed to find Gettext libintl")
-unset(Intl_REQUIRED_VARS)
+unset(_Intl_REQUIRED_VARS)
+unset(_Intl_IS_BUILT_IN_MSG)
 
 if(Intl_FOUND)
-  set(Intl_INCLUDE_DIRS "${Intl_INCLUDE_DIR}")
-  set(Intl_LIBRARIES "${Intl_LIBRARY}")
+  if(Intl_IS_BUILT_IN)
+    set(Intl_INCLUDE_DIRS "")
+    set(Intl_LIBRARIES "")
+  else()
+    set(Intl_INCLUDE_DIRS "${Intl_INCLUDE_DIR}")
+    set(Intl_LIBRARIES "${Intl_LIBRARY}")
+  endif()
   if(NOT TARGET Intl::Intl)
     add_library(Intl::Intl INTERFACE IMPORTED)
     set_target_properties(Intl::Intl PROPERTIES
index 195ca49..de38ac2 100644 (file)
@@ -1182,9 +1182,10 @@ macro(_MPI_create_imported_target LANG)
   set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}")
 
   if(MPI_${LANG}_LINK_FLAGS)
-    string(REPLACE "-pthread" "$<$<LINK_LANG_AND_ID:CUDA,NVIDIA>:-Xlinker >-pthread"
-      _MPI_${LANG}_LINK_FLAGS "${MPI_${LANG}_LINK_FLAGS}")
-    set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_OPTIONS "SHELL:${MPI_${LANG}_LINK_FLAGS}")
+    string(REPLACE "," "$<COMMA>" _MPI_${LANG}_LINK_FLAGS "${MPI_${LANG}_LINK_FLAGS}")
+    string(PREPEND _MPI_${LANG}_LINK_FLAGS "$<HOST_LINK:SHELL:")
+    string(APPEND _MPI_${LANG}_LINK_FLAGS ">")
+    set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_OPTIONS "${_MPI_${LANG}_LINK_FLAGS}")
   endif()
   # If the compiler links MPI implicitly, no libraries will be found as they're contained within
   # CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES already.
index 37869fb..e149f4c 100644 (file)
@@ -21,7 +21,10 @@ Inclusion of this module defines the following variables:
 
   Destination for files of a given type.  This value may be passed to
   the ``DESTINATION`` options of :command:`install` commands for the
-  corresponding file type.
+  corresponding file type.  It should typically be a path relative to
+  the installation prefix so that it can be converted to an absolute
+  path in a relocatable way (see ``CMAKE_INSTALL_FULL_<dir>``).
+  However, an absolute path is also allowed.
 
 ``CMAKE_INSTALL_FULL_<dir>``
 
index 6116ae1..50f0620 100644 (file)
@@ -25,6 +25,56 @@ endif()
 
 set(CMAKE_BUILD_TYPE_INIT "RelWithDebInfo")
 
+if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED)
+  # Tell CMake not to search host sysroots for headers/libraries.
+
+  # All paths added to CMAKE_SYSTEM_*_PATH below will be rerooted under
+  # CMAKE_FIND_ROOT_PATH. This is set because:
+  # 1. Users may structure their libraries in a way similar to NDK. When they do that,
+  #    they can simply append another path to CMAKE_FIND_ROOT_PATH.
+  # 2. CMAKE_FIND_ROOT_PATH must be non-empty for CMAKE_FIND_ROOT_PATH_MODE_* == ONLY
+  #    to be meaningful. https://github.com/android-ndk/ndk/issues/890
+  list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/sysroot")
+
+  # Allow users to override these values in case they want more strict behaviors.
+  # For example, they may want to prevent the NDK's libz from being picked up so
+  # they can use their own.
+  # https://github.com/android-ndk/ndk/issues/517
+  if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
+    set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+  endif()
+
+  if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
+    set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+  endif()
+
+  if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
+    set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+  endif()
+
+  if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
+    set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+  endif()
+
+  # Don't search paths in PATH environment variable.
+  if(NOT DEFINED CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH)
+    set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF)
+  endif()
+
+  # Allows CMake to find headers in the architecture-specific include directories.
+  set(CMAKE_LIBRARY_ARCHITECTURE "${CMAKE_ANDROID_ARCH_TRIPLE}")
+
+  # Instructs CMake to search the correct API level for libraries.
+  # Besides the paths like <root>/<prefix>/lib/<arch>, cmake also searches <root>/<prefix>.
+  # So we can add the API level specific directory directly.
+  # https://github.com/android/ndk/issues/929
+  list(PREPEND CMAKE_SYSTEM_PREFIX_PATH
+    "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_SYSTEM_VERSION}"
+    )
+
+  list(APPEND CMAKE_SYSTEM_PROGRAM_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/bin")
+endif()
+
 # Skip sysroot selection if the NDK has a unified toolchain.
 if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED)
   return()
index e4b9a09..6944e32 100644 (file)
@@ -35,56 +35,6 @@ if(CMAKE_SYSTEM_VERSION EQUAL 1)
   return()
 endif()
 
-if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED)
-  # Tell CMake not to search host sysroots for headers/libraries.
-
-  # All paths added to CMAKE_SYSTEM_*_PATH below will be rerooted under
-  # CMAKE_FIND_ROOT_PATH. This is set because:
-  # 1. Users may structure their libraries in a way similar to NDK. When they do that,
-  #    they can simply append another path to CMAKE_FIND_ROOT_PATH.
-  # 2. CMAKE_FIND_ROOT_PATH must be non-empty for CMAKE_FIND_ROOT_PATH_MODE_* == ONLY
-  #    to be meaningful. https://github.com/android-ndk/ndk/issues/890
-  list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/sysroot")
-
-  # Allow users to override these values in case they want more strict behaviors.
-  # For example, they may want to prevent the NDK's libz from being picked up so
-  # they can use their own.
-  # https://github.com/android-ndk/ndk/issues/517
-  if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
-    set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-  endif()
-
-  if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
-    set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-  endif()
-
-  if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
-    set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-  endif()
-
-  if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
-    set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
-  endif()
-
-  # Don't search paths in PATH environment variable.
-  if(NOT DEFINED CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH)
-    set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF)
-  endif()
-
-  # Allows CMake to find headers in the architecture-specific include directories.
-  set(CMAKE_LIBRARY_ARCHITECTURE "${CMAKE_ANDROID_ARCH_TRIPLE}")
-
-  # Instructs CMake to search the correct API level for libraries.
-  # Besides the paths like <root>/<prefix>/lib/<arch>, cmake also searches <root>/<prefix>.
-  # So we can add the API level specific directory directly.
-  # https://github.com/android/ndk/issues/929
-  list(PREPEND CMAKE_SYSTEM_PREFIX_PATH
-    "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_SYSTEM_VERSION}"
-    )
-
-  list(APPEND CMAKE_SYSTEM_PROGRAM_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/bin")
-endif()
-
 # Include the NDK hook.
 # It can be used by NDK to inject necessary fixes for an earlier cmake.
 if(CMAKE_ANDROID_NDK)
index 80595ea..d9a7894 100644 (file)
@@ -47,11 +47,7 @@ set(CMAKE_SHARED_MODULE_PREFIX "lib")
 set(CMAKE_SHARED_MODULE_SUFFIX ".so")
 set(CMAKE_MODULE_EXISTS 1)
 set(CMAKE_DL_LIBS "")
-
-# Enable rpath support for 10.5 and greater where it is known to work.
-if("${DARWIN_MAJOR_VERSION}" GREATER 8)
-  set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
-endif()
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
 
 foreach(lang C CXX OBJC OBJCXX)
   set(CMAKE_${lang}_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
index 23b48bd..b5d5464 100644 (file)
@@ -48,7 +48,6 @@ endif()
 
 # Match multiarch library directory names.
 set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_]*")
-set(CMAKE_LIBRARY_ARCHITECTURE_REGEX_VERSIONED "gcc/[a-z0-9_]+(-[a-z0-9_]+)?-linux(-gnu)?/[0-9]+(\\.[0-9]+\\.[0-9]+)*")
 
 include(Platform/UnixPaths)
 
index 7d7f737..6073125 100644 (file)
@@ -338,20 +338,13 @@ as well as ``SWIG``:
   initialized with the value of this variable.
 #]=======================================================================]
 
-cmake_policy(GET CMP0078 target_name_policy)
-cmake_policy(GET CMP0086 module_name_policy)
-
-cmake_policy (VERSION 3.12)
-if (target_name_policy)
-  # respect user choice regarding CMP0078 policy
-  cmake_policy(SET CMP0078 ${target_name_policy})
-endif()
-if (module_name_policy)
-  # respect user choice regarding CMP0086 policy
-  cmake_policy(SET CMP0086 ${module_name_policy})
-endif()
-unset(target_name_policy)
-unset(module_name_policy)
+cmake_policy(PUSH)
+# numbers and boolean constants
+cmake_policy (SET CMP0012 NEW)
+# IN_LIST operator
+cmake_policy (SET CMP0057 NEW)
+# Ninja generator normalizes custom command depfile paths
+cmake_policy (SET CMP0116 NEW)
 
 set(SWIG_CXX_EXTENSION "cxx")
 set(SWIG_EXTRA_LIBRARIES "")
@@ -911,7 +904,7 @@ function(SWIG_ADD_LIBRARY name)
     if (APPLE)
       set_target_properties (${target_name} PROPERTIES SUFFIX ".jnilib")
     endif()
-    if ((WIN32 AND MINGW) OR CYGWIN OR CMAKE_SYSTEM_NAME STREQUAL MSYS)
+    if ((WIN32 AND MINGW) OR CYGWIN OR CMAKE_SYSTEM_NAME STREQUAL "MSYS")
       set_target_properties(${target_name} PROPERTIES PREFIX "")
     endif()
   elseif (swig_lowercase_language STREQUAL "lua")
@@ -1007,3 +1000,5 @@ function(SWIG_LINK_LIBRARIES name)
     endif()
   endif()
 endfunction()
+
+cmake_policy(POP)
index a0713ba..948452a 100644 (file)
@@ -1,7 +1,7 @@
 # CMake version number components.
 set(CMake_VERSION_MAJOR 3)
 set(CMake_VERSION_MINOR 20)
-set(CMake_VERSION_PATCH 0)
+set(CMake_VERSION_PATCH 1)
 #set(CMake_VERSION_RC 0)
 set(CMake_VERSION_IS_DIRTY 0)
 
@@ -21,7 +21,7 @@ endif()
 
 if(NOT CMake_VERSION_NO_GIT)
   # If this source was exported by 'git archive', use its commit info.
-  set(git_info [==[b7b0fb4303 CMake 3.20.0]==])
+  set(git_info [==[9765ccfa71 CMake 3.20.1]==])
 
   # Otherwise, try to identify the current development source version.
   if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* "
index 263adfd..f1cc677 100644 (file)
@@ -215,9 +215,16 @@ int cmCPackNSISGenerator::PackageFiles()
     if (this->IsSet("CPACK_NSIS_BRANDING_TEXT_TRIM_POSITION")) {
       std::string wantedPosition =
         this->GetOption("CPACK_NSIS_BRANDING_TEXT_TRIM_POSITION");
-      const std::set<std::string> possiblePositions{ "CENTER", "LEFT",
-                                                     "RIGHT" };
-      if (possiblePositions.find(wantedPosition) != possiblePositions.end()) {
+      if (!wantedPosition.empty()) {
+        const std::set<std::string> possiblePositions{ "CENTER", "LEFT",
+                                                       "RIGHT" };
+        if (possiblePositions.find(wantedPosition) ==
+            possiblePositions.end()) {
+          cmCPackLogger(cmCPackLog::LOG_ERROR,
+                        "Unsupported branding text trim position "
+                          << wantedPosition << std::endl);
+          return false;
+        }
         brandingTextPosition = wantedPosition;
       }
     }
index cbedf0a..495dc69 100644 (file)
@@ -76,8 +76,9 @@ struct cmCommandLineArgument
 
     } else if (this->Type == Values::One || this->Type == Values::ZeroOrOne) {
       if (input.size() == this->Name.size()) {
-        ++index;
-        if (index >= allArgs.size() || allArgs[index][0] == '-') {
+        auto nextValueIndex = index + 1;
+        if (nextValueIndex >= allArgs.size() ||
+            allArgs[nextValueIndex][0] == '-') {
           if (this->Type == Values::ZeroOrOne) {
             parseState =
               this->StoreCall(std::string{}, std::forward<CallState>(state)...)
@@ -87,10 +88,11 @@ struct cmCommandLineArgument
             parseState = ParseMode::ValueError;
           }
         } else {
-          parseState =
-            this->StoreCall(allArgs[index], std::forward<CallState>(state)...)
+          parseState = this->StoreCall(allArgs[nextValueIndex],
+                                       std::forward<CallState>(state)...)
             ? ParseMode::Valid
             : ParseMode::Invalid;
+          index = nextValueIndex;
         }
       } else {
         // parse the string to get the value
@@ -133,7 +135,8 @@ struct cmCommandLineArgument
     } else if (this->Type == Values::OneOrMore) {
       if (input.size() == this->Name.size()) {
         auto nextValueIndex = index + 1;
-        if (nextValueIndex >= allArgs.size() || allArgs[index + 1][0] == '-') {
+        if (nextValueIndex >= allArgs.size() ||
+            allArgs[nextValueIndex][0] == '-') {
           parseState = ParseMode::ValueError;
         } else {
           std::string buffer = allArgs[nextValueIndex++];
@@ -145,6 +148,7 @@ struct cmCommandLineArgument
             this->StoreCall(buffer, std::forward<CallState>(state)...)
             ? ParseMode::Valid
             : ParseMode::Invalid;
+          index = (nextValueIndex - 1);
         }
       }
     }
index edd261d..12b2925 100644 (file)
@@ -165,7 +165,7 @@ bool cmConfigureFileCommand(std::vector<std::string> const& args,
     return false;
   }
 
-  mode_t permisiions = 0;
+  mode_t permissions = 0;
 
   if (filePermissions) {
     if (filePermissionOptions.empty()) {
@@ -175,7 +175,7 @@ bool cmConfigureFileCommand(std::vector<std::string> const& args,
 
     std::vector<std::string> invalidOptions;
     for (auto const& e : filePermissionOptions) {
-      if (!cmFSPermissions::stringToModeT(e, permisiions)) {
+      if (!cmFSPermissions::stringToModeT(e, permissions)) {
         invalidOptions.push_back(e);
       }
     }
@@ -197,14 +197,14 @@ bool cmConfigureFileCommand(std::vector<std::string> const& args,
   }
 
   if (noSourcePermissions) {
-    permisiions |= cmFSPermissions::mode_owner_read;
-    permisiions |= cmFSPermissions::mode_owner_write;
-    permisiions |= cmFSPermissions::mode_group_read;
-    permisiions |= cmFSPermissions::mode_world_read;
+    permissions |= cmFSPermissions::mode_owner_read;
+    permissions |= cmFSPermissions::mode_owner_write;
+    permissions |= cmFSPermissions::mode_group_read;
+    permissions |= cmFSPermissions::mode_world_read;
   }
 
   if (!status.GetMakefile().ConfigureFile(inputFile, outputFile, copyOnly,
-                                          atOnly, escapeQuotes, permisiions,
+                                          atOnly, escapeQuotes, permissions,
                                           newLineStyle)) {
     status.SetError("Problem configuring file");
     return false;
index c6b6184..cac60e1 100644 (file)
@@ -3,9 +3,10 @@
 #include "cmExportTryCompileFileGenerator.h"
 
 #include <map>
-#include <memory>
 #include <utility>
 
+#include <cm/memory>
+
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorExpressionDAGChecker.h"
 #include "cmGeneratorTarget.h"
@@ -66,7 +67,15 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
 
   cmGeneratorExpression ge;
 
-  cmGeneratorExpressionDAGChecker dagChecker(tgt, propName, nullptr, nullptr);
+  std::unique_ptr<cmGeneratorExpressionDAGChecker> parentDagChecker;
+  if (propName == "INTERFACE_LINK_OPTIONS") {
+    // To please constraint checks of DAGChecker, this property must have
+    // LINK_OPTIONS property as parent
+    parentDagChecker = cm::make_unique<cmGeneratorExpressionDAGChecker>(
+      tgt, "LINK_OPTIONS", nullptr, nullptr);
+  }
+  cmGeneratorExpressionDAGChecker dagChecker(tgt, propName, nullptr,
+                                             parentDagChecker.get());
 
   std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*prop);
 
index f674833..4a28238 100644 (file)
@@ -2446,18 +2446,18 @@ bool HandleGenerateCommand(std::vector<std::string> const& args,
     }
   }
 
-  mode_t permisiions = 0;
+  mode_t permissions = 0;
   if (arguments.NoSourcePermissions) {
-    permisiions |= cmFSPermissions::mode_owner_read;
-    permisiions |= cmFSPermissions::mode_owner_write;
-    permisiions |= cmFSPermissions::mode_group_read;
-    permisiions |= cmFSPermissions::mode_world_read;
+    permissions |= cmFSPermissions::mode_owner_read;
+    permissions |= cmFSPermissions::mode_owner_write;
+    permissions |= cmFSPermissions::mode_group_read;
+    permissions |= cmFSPermissions::mode_world_read;
   }
 
   if (!arguments.FilePermissions.empty()) {
     std::vector<std::string> invalidOptions;
     for (auto const& e : arguments.FilePermissions) {
-      if (!cmFSPermissions::stringToModeT(e, permisiions)) {
+      if (!cmFSPermissions::stringToModeT(e, permissions)) {
         invalidOptions.push_back(e);
       }
     }
@@ -2479,7 +2479,7 @@ bool HandleGenerateCommand(std::vector<std::string> const& args,
 
   AddEvaluationFile(input, arguments.Target, arguments.Output,
                     arguments.Condition, inputIsContent,
-                    newLineStyle.GetCharacters(), permisiions, status);
+                    newLineStyle.GetCharacters(), permissions, status);
   return true;
 }
 
index c782bcd..afa8e9b 100644 (file)
@@ -12,6 +12,8 @@
 #include "LexerParser/cmGccDepfileLexer.h"
 
 #ifdef _WIN32
+#  include <cctype>
+
 #  include "cmsys/Encoding.h"
 #endif
 
@@ -123,11 +125,21 @@ void cmGccDepfileLexerHelper::sanitizeContent()
     if (it->rules.empty()) {
       it = this->Content.erase(it);
     } else {
-      // Remove empty paths
+      // Remove empty paths and normalize windows paths
       for (auto pit = it->paths.begin(); pit != it->paths.end();) {
         if (pit->empty()) {
           pit = it->paths.erase(pit);
         } else {
+#if defined(_WIN32)
+          // Unescape the colon following the drive letter.
+          // Some versions of GNU compilers can escape this character.
+          // c\:\path must be transformed to c:\path
+          if (pit->size() >= 3 && std::toupper((*pit)[0]) >= 'A' &&
+              std::toupper((*pit)[0]) <= 'Z' && (*pit)[1] == '\\' &&
+              (*pit)[2] == ':') {
+            pit->erase(1, 1);
+          }
+#endif
           ++pit;
         }
       }
index d7e9952..efac06a 100644 (file)
@@ -3641,13 +3641,58 @@ std::vector<BT<std::string>> wrapOptions(
     return result;
   }
 
-  if (wrapperFlag.empty() || cmHasLiteralPrefix(options.front(), "LINKER:")) {
-    // nothing specified or LINKER wrapper, insert elements as is
+  if (wrapperFlag.empty()) {
+    // nothing specified, insert elements as is
     result.reserve(options.size());
     for (std::string& o : options) {
       result.emplace_back(std::move(o), bt);
     }
-  } else {
+    return result;
+  }
+
+  for (std::vector<std::string>::size_type index = 0; index < options.size();
+       index++) {
+    if (cmHasLiteralPrefix(options[index], "LINKER:")) {
+      // LINKER wrapper specified, insert elements as is
+      result.emplace_back(std::move(options[index]), bt);
+      continue;
+    }
+    if (cmHasLiteralPrefix(options[index], "-Wl,")) {
+      // replace option by LINKER wrapper
+      result.emplace_back(options[index].replace(0, 4, "LINKER:"), bt);
+      continue;
+    }
+    if (cmHasLiteralPrefix(options[index], "-Xlinker=")) {
+      // replace option by LINKER wrapper
+      result.emplace_back(options[index].replace(0, 9, "LINKER:"), bt);
+      continue;
+    }
+    if (options[index] == "-Xlinker") {
+      // replace option by LINKER wrapper
+      if (index + 1 < options.size()) {
+        result.emplace_back("LINKER:" + options[++index], bt);
+      } else {
+        result.emplace_back(std::move(options[index]), bt);
+      }
+      continue;
+    }
+
+    // collect all options which must be transformed
+    std::vector<std::string> opts;
+    while (index < options.size()) {
+      if (!cmHasLiteralPrefix(options[index], "LINKER:") &&
+          !cmHasLiteralPrefix(options[index], "-Wl,") &&
+          !cmHasLiteralPrefix(options[index], "-Xlinker")) {
+        opts.emplace_back(std::move(options[index++]));
+      } else {
+        --index;
+        break;
+      }
+    }
+    if (opts.empty()) {
+      continue;
+    }
+
     if (!wrapperSep.empty()) {
       if (concatFlagAndArgs) {
         // insert flag elements except last one
@@ -3656,24 +3701,23 @@ std::vector<BT<std::string>> wrapOptions(
         }
         // concatenate last flag element and all list values
         // in one option
-        result.emplace_back(wrapperFlag.back() + cmJoin(options, wrapperSep),
-                            bt);
+        result.emplace_back(wrapperFlag.back() + cmJoin(opts, wrapperSep), bt);
       } else {
         for (std::string const& i : wrapperFlag) {
           result.emplace_back(i, bt);
         }
         // concatenate all list values in one option
-        result.emplace_back(cmJoin(options, wrapperSep), bt);
+        result.emplace_back(cmJoin(opts, wrapperSep), bt);
       }
     } else {
       // prefix each element of list with wrapper
       if (concatFlagAndArgs) {
-        std::transform(options.begin(), options.end(), options.begin(),
+        std::transform(opts.begin(), opts.end(), opts.begin(),
                        [&wrapperFlag](std::string const& o) -> std::string {
                          return wrapperFlag.back() + o;
                        });
       }
-      for (std::string& o : options) {
+      for (std::string& o : opts) {
         for (auto i = wrapperFlag.begin(),
                   e = concatFlagAndArgs ? wrapperFlag.end() - 1
                                         : wrapperFlag.end();
index 8ed411a..51ad993 100644 (file)
@@ -582,6 +582,11 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
 
   auto ccgs = this->MakeCustomCommandGenerators(*cc, fileConfig);
   for (cmCustomCommandGenerator const& ccg : ccgs) {
+    if (ccg.GetOutputs().empty() && ccg.GetByproducts().empty()) {
+      // Generator expressions evaluate to no output for this config.
+      continue;
+    }
+
     cmNinjaDeps orderOnlyDeps;
 
     // A custom command may appear on multiple targets.  However, some build
@@ -651,6 +656,12 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
       gg->WriteBuild(this->GetImplFileStream(fileConfig), build);
     } else {
       std::string customStep = cmSystemTools::GetFilenameName(ninjaOutputs[0]);
+      if (this->GlobalGenerator->IsMultiConfig()) {
+        customStep += '-';
+        customStep += fileConfig;
+        customStep += '-';
+        customStep += ccg.GetOutputConfig();
+      }
       // Hash full path to make unique.
       customStep += '-';
       cmCryptoHash hash(cmCryptoHash::AlgoSHA256);
index d4138d9..a1816f1 100644 (file)
@@ -1463,15 +1463,15 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
     headers.reserve(this->AutogenTarget.Headers.size());
     for (auto const& pair : this->AutogenTarget.Headers) {
       MUFile const* const muf = pair.second.get();
-      if (muf->Generated && !this->CMP0071Accept) {
-        continue;
-      }
       if (muf->SkipMoc) {
         moc_skip.insert(muf->FullPath);
       }
       if (muf->SkipUic) {
         uic_skip.insert(muf->FullPath);
       }
+      if (muf->Generated && !this->CMP0071Accept) {
+        continue;
+      }
       if (muf->MocIt || muf->UicIt) {
         headers.emplace_back(muf);
       }
index 1e3bf06..535f786 100644 (file)
@@ -2248,6 +2248,13 @@ void cmQtAutoMocUicT::JobDepFilesMergeT::Process()
   std::for_each(this->MocEval().SourceMappings.begin(),
                 this->MocEval().SourceMappings.end(), processMappingEntry);
 
+  // Remove SKIP_AUTOMOC files
+  dependencies.erase(std::remove_if(dependencies.begin(), dependencies.end(),
+                                    [this](const std::string& dep) {
+                                      return this->MocConst().skipped(dep);
+                                    }),
+                     dependencies.end());
+
   // Remove duplicates to make the depfile smaller
   std::sort(dependencies.begin(), dependencies.end());
   dependencies.erase(std::unique(dependencies.begin(), dependencies.end()),
index 91fe6ca..78e0b6a 100644 (file)
@@ -141,6 +141,9 @@ endif()
 if(CMAKE_GENERATOR MATCHES "Make")
   add_RunCMake_test(Make -DMAKE_IS_GNU=${MAKE_IS_GNU})
 endif()
+if(CMake_TEST_Qt5)
+  find_package(Qt5Widgets QUIET NO_MODULE)
+endif()
 if(CMAKE_GENERATOR MATCHES "Ninja")
   set(Ninja_ARGS
     -DCMAKE_C_OUTPUT_EXTENSION=${CMAKE_C_OUTPUT_EXTENSION}
@@ -151,6 +154,9 @@ if(CMAKE_GENERATOR MATCHES "Ninja")
   endif()
   if(CMake_TEST_Qt5 AND Qt5Core_FOUND)
     list(APPEND Ninja_ARGS -DCMake_TEST_Qt5=1 -DQt5Core_DIR=${Qt5Core_DIR} -DCMAKE_TEST_Qt5Core_Version=${Qt5Core_VERSION})
+    if(Qt5Widgets_FOUND)
+      list(APPEND Ninja_ARGS -DQt5Widgets_DIR=${Qt5Widgets_DIR})
+    endif()
   endif()
   add_RunCMake_test(Ninja)
   set(NinjaMultiConfig_ARGS
@@ -190,9 +196,6 @@ if(CMake_TEST_APPLE_SILICON)
   add_RunCMake_test(AppleSilicon)
 endif()
 set(autogen_with_qt5 FALSE)
-if(CMake_TEST_Qt5)
-  find_package(Qt5Widgets QUIET NO_MODULE)
-endif()
 if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND)
   set(autogen_with_qt5 TRUE)
 endif ()
@@ -221,6 +224,7 @@ if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
   add_RunCMake_test(Byproducts)
 endif()
 add_RunCMake_test(CMakeRoleGlobalProperty)
+add_RunCMake_test(CMakeRelease -DCMake_TEST_JQ=${CMake_TEST_JQ})
 if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
   add_RunCMake_test(CompilerChange)
 endif()
@@ -239,6 +243,7 @@ add_RunCMake_test(FileAPI -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
 add_RunCMake_test(FindBoost)
 add_RunCMake_test(FindLua)
 add_RunCMake_test(FindOpenGL)
+add_RunCMake_test(InitialFlags)
 if(CMake_TEST_FindOpenSSL)
   add_RunCMake_test(FindOpenSSL)
 endif()
diff --git a/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt b/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt
new file mode 100644 (file)
index 0000000..37eb91e
--- /dev/null
@@ -0,0 +1,44 @@
+^-- query: \.version \| \.major , \.minor , \.patch , \.suffix, \.string
+1
+2
+3
+"rc4"
+"@version@"
+-- query: \.files\[\]\.name
+"cmake-@version@-linux-aarch64\.sh"
+"cmake-@version@-linux-aarch64\.tar\.gz"
+"cmake-@version@-linux-x86_64\.sh"
+"cmake-@version@-linux-x86_64\.tar\.gz"
+"cmake-@version@-macos-universal\.dmg"
+"cmake-@version@-macos-universal\.tar\.gz"
+"cmake-@version@-macos10\.10-universal\.dmg"
+"cmake-@version@-macos10\.10-universal\.tar\.gz"
+"cmake-@version@-windows-i386\.msi"
+"cmake-@version@-windows-i386\.zip"
+"cmake-@version@-windows-x86_64\.msi"
+"cmake-@version@-windows-x86_64\.zip"
+"cmake-@version@\.tar\.gz"
+"cmake-@version@\.zip"
+-- query: \.files\[\] \| select\(\.os\[\] \| \. == "source"\) \| \.name
+"cmake-@version@\.tar\.gz"
+"cmake-@version@\.zip"
+-- query: \.files\[\] \| select\(\(\.os\[\] \| \. == "macOS"\) and \(\.class == "volume"\)\) \| \.name
+"cmake-@version@-macos-universal\.dmg"
+-- query: \.files\[\] \| select\(\(\.os\[\] \| \. == "macos10\.10"\) and \(\.class == "archive"\)\) \| \.name
+"cmake-@version@-macos10\.10-universal\.tar\.gz"
+-- query: \.files\[\] \| select\(\(\.os\[\] \| \. == "windows"\) and \(\.architecture\[\] \| \. == "i386"\) and \(\.class == "installer"\)\) \| \.name
+"cmake-@version@-windows-i386\.msi"
+-- query: \.files\[\] \| select\(\.architecture\[\] \| \. == "x86_64"\) \| \.name
+"cmake-@version@-linux-x86_64\.sh"
+"cmake-@version@-linux-x86_64\.tar\.gz"
+"cmake-@version@-macos-universal\.dmg"
+"cmake-@version@-macos-universal\.tar\.gz"
+"cmake-@version@-macos10\.10-universal\.dmg"
+"cmake-@version@-macos10\.10-universal\.tar\.gz"
+"cmake-@version@-windows-x86_64\.msi"
+"cmake-@version@-windows-x86_64\.zip"
+-- query: \.files\[\] \| select\(\[\.macOSmin\] \| inside\(\["10\.10", "10\.11", "10\.12"\]\)\) \| \.name
+"cmake-@version@-macos10\.10-universal\.dmg"
+"cmake-@version@-macos10\.10-universal\.tar\.gz"
+-- query: \.hashFiles\[\] \| select\(\.algorithm\[\] \| \. == "SHA-256"\) \| \.name
+"cmake-@version@-SHA-256\.txt"$
diff --git a/Tests/RunCMake/CMakeRelease/FileTable.cmake b/Tests/RunCMake/CMakeRelease/FileTable.cmake
new file mode 100644 (file)
index 0000000..f46535c
--- /dev/null
@@ -0,0 +1,21 @@
+set(version "@version@")
+set(version_major "1")
+set(version_minor "2")
+set(version_patch "3")
+set(maybe_version_suffix "\"suffix\": \"rc4\",")
+configure_file("${CMAKE_CURRENT_LIST_DIR}/../../../Utilities/Release/files-v1.json.in" "files-v1.json" @ONLY)
+
+foreach(query
+    ".version | .major , .minor , .patch , .suffix, .string"
+    ".files[].name"
+    ".files[] | select(.os[] | . == \"source\") | .name"
+    ".files[] | select((.os[] | . == \"macOS\") and (.class == \"volume\")) | .name"
+    ".files[] | select((.os[] | . == \"macos10.10\") and (.class == \"archive\")) | .name"
+    ".files[] | select((.os[] | . == \"windows\") and (.architecture[] | . == \"i386\") and (.class == \"installer\")) | .name"
+    ".files[] | select(.architecture[] | . == \"x86_64\") | .name"
+    ".files[] | select([.macOSmin] | inside([\"10.10\", \"10.11\", \"10.12\"])) | .name"
+    ".hashFiles[] | select(.algorithm[] | . == \"SHA-256\") | .name"
+    )
+  message(STATUS "query: ${query}")
+  execute_process(COMMAND ${JQ} "${query}" files-v1.json)
+endforeach()
diff --git a/Tests/RunCMake/CMakeRelease/RunCMakeTest.cmake b/Tests/RunCMake/CMakeRelease/RunCMakeTest.cmake
new file mode 100644 (file)
index 0000000..9a08ff3
--- /dev/null
@@ -0,0 +1,10 @@
+include(RunCMake)
+
+if(CMake_TEST_JQ)
+  set(JQ "${CMake_TEST_JQ}")
+else()
+  find_program(JQ NAMES jq)
+endif()
+if(JQ)
+  run_cmake_script(FileTable -DJQ=${JQ})
+endif()
diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-number-trailing--invalid-target-result.txt b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-number-trailing--invalid-target-result.txt
new file mode 100644 (file)
index 0000000..3beecb0
--- /dev/null
@@ -0,0 +1 @@
+(1|2)
diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-number-trailing--invalid-target-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-number-trailing--invalid-target-stderr.txt
new file mode 100644 (file)
index 0000000..ee4bcc0
--- /dev/null
@@ -0,0 +1 @@
+.*(ninja: error: unknown target 'invalid-target'|No rule to make target [`']invalid-target').*
index 51754fc..8072a2c 100644 (file)
@@ -209,6 +209,10 @@ function(run_BuildDir)
       ${CMAKE_COMMAND} --build BuildDir-build -j)
     run_cmake_command(BuildDir--build-jobs-no-number-trailing--target ${CMAKE_COMMAND} -E chdir ..
       ${CMAKE_COMMAND} --build BuildDir-build -j --target CustomTarget)
+    if(RunCMake_GENERATOR MATCHES "Unix Makefiles" OR RunCMake_GENERATOR MATCHES "Ninja")
+      run_cmake_command(BuildDir--build-jobs-no-number-trailing--invalid-target ${CMAKE_COMMAND} -E chdir ..
+        ${CMAKE_COMMAND} --build BuildDir-build -j --target invalid-target)
+    endif()
     run_cmake_command(BuildDir--build--parallel-no-number ${CMAKE_COMMAND} -E chdir ..
       ${CMAKE_COMMAND} --build BuildDir-build --parallel)
     run_cmake_command(BuildDir--build--parallel-no-number-trailing--target ${CMAKE_COMMAND} -E chdir ..
index 8b30f96..31494d5 100644 (file)
@@ -2,7 +2,7 @@ if(NOT EXISTS "${generatedFile}")
   message(SEND_ERROR "Missing generated file:\n  ${generatedFile}")
 endif()
 
-if (UNIX)
+if (CMAKE_HOST_UNIX)
   find_program(STAT_EXECUTABLE NAMES stat)
   if(NOT STAT_EXECUTABLE)
     return()
diff --git a/Tests/RunCMake/GenEx-DEVICE_LINK/DEVICE_LINK-try_compile.cmake b/Tests/RunCMake/GenEx-DEVICE_LINK/DEVICE_LINK-try_compile.cmake
new file mode 100644 (file)
index 0000000..281f8aa
--- /dev/null
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+add_library(demo INTERFACE IMPORTED)
+set_property(TARGET demo PROPERTY INTERFACE_LINK_OPTIONS "$<DEVICE_LINK:>")
+
+set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
+try_compile(result "${CMAKE_CURRENT_BINARY_DIR}/tc" "${CMAKE_CURRENT_SOURCE_DIR}/empty.c"
+  LINK_LIBRARIES demo)
index 1e44601..80633e2 100644 (file)
@@ -12,6 +12,7 @@ run_cmake(DEVICE_LINK-target_compile_options)
 run_cmake(DEVICE_LINK-target_include_directories)
 run_cmake(DEVICE_LINK-target_link_libraries)
 run_cmake(DEVICE_LINK-target_link_directories)
+run_cmake(DEVICE_LINK-try_compile)
 if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)")
   run_cmake(DEVICE_LINK-link_depends)
 endif()
diff --git a/Tests/RunCMake/GenEx-HOST_LINK/HOST_LINK-try_compile.cmake b/Tests/RunCMake/GenEx-HOST_LINK/HOST_LINK-try_compile.cmake
new file mode 100644 (file)
index 0000000..f221ff1
--- /dev/null
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+add_library(demo INTERFACE IMPORTED)
+set_property(TARGET demo PROPERTY INTERFACE_LINK_OPTIONS "$<HOST_LINK:>")
+
+set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
+try_compile(result "${CMAKE_CURRENT_BINARY_DIR}/tc" "${CMAKE_CURRENT_SOURCE_DIR}/empty.c"
+  LINK_LIBRARIES demo)
index 329a7c6..9e3eeec 100644 (file)
@@ -12,6 +12,7 @@ run_cmake(HOST_LINK-target_compile_options)
 run_cmake(HOST_LINK-target_include_directories)
 run_cmake(HOST_LINK-target_link_libraries)
 run_cmake(HOST_LINK-target_link_directories)
+run_cmake(HOST_LINK-try_compile)
 if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)")
   run_cmake(HOST_LINK-link_depends)
 endif()
diff --git a/Tests/RunCMake/InitialFlags/C-stdout.txt b/Tests/RunCMake/InitialFlags/C-stdout.txt
new file mode 100644 (file)
index 0000000..9a7341d
--- /dev/null
@@ -0,0 +1 @@
+CMAKE_C_FLAGS='[^']*-Denv="a\\b"[^']+-Dvar="b\\c"[^']*'
diff --git a/Tests/RunCMake/InitialFlags/C.cmake b/Tests/RunCMake/InitialFlags/C.cmake
new file mode 100644 (file)
index 0000000..5afc395
--- /dev/null
@@ -0,0 +1,3 @@
+set(CMAKE_C_FLAGS_INIT [[-Dvar="b\c"]])
+enable_language(C)
+message(STATUS "CMAKE_C_FLAGS='${CMAKE_C_FLAGS}'")
diff --git a/Tests/RunCMake/InitialFlags/CMakeLists.txt b/Tests/RunCMake/InitialFlags/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7cabeb6
--- /dev/null
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.20)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/InitialFlags/CXX-stdout.txt b/Tests/RunCMake/InitialFlags/CXX-stdout.txt
new file mode 100644 (file)
index 0000000..623b74a
--- /dev/null
@@ -0,0 +1 @@
+CMAKE_CXX_FLAGS='[^']*-Denv="a\\b"[^']+-Dvar="b\\c"[^']*'
diff --git a/Tests/RunCMake/InitialFlags/CXX.cmake b/Tests/RunCMake/InitialFlags/CXX.cmake
new file mode 100644 (file)
index 0000000..1d7a53c
--- /dev/null
@@ -0,0 +1,3 @@
+set(CMAKE_CXX_FLAGS_INIT [[-Dvar="b\c"]])
+enable_language(CXX)
+message(STATUS "CMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'")
diff --git a/Tests/RunCMake/InitialFlags/RunCMakeTest.cmake b/Tests/RunCMake/InitialFlags/RunCMakeTest.cmake
new file mode 100644 (file)
index 0000000..d13019e
--- /dev/null
@@ -0,0 +1,7 @@
+include(RunCMake)
+
+set(ENV{CFLAGS} "$ENV{CFLAGS} -Denv=\"a\\b\"")
+run_cmake(C)
+
+set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -Denv=\"a\\b\"")
+run_cmake(CXX)
diff --git a/Tests/RunCMake/Ninja/MyWindow.cpp b/Tests/RunCMake/Ninja/MyWindow.cpp
new file mode 100644 (file)
index 0000000..d87c2e9
--- /dev/null
@@ -0,0 +1,7 @@
+#include "MyWindow.h"
+
+MyWindow::MyWindow(QWidget* parent)
+  : QWidget(parent)
+{
+  this->m_ui.setupUi(this);
+}
diff --git a/Tests/RunCMake/Ninja/MyWindow.h b/Tests/RunCMake/Ninja/MyWindow.h
new file mode 100644 (file)
index 0000000..c267610
--- /dev/null
@@ -0,0 +1,16 @@
+#pragma once
+
+#include <QWidget>
+
+#include "ui_MyWindow.h"
+
+class MyWindow : public QWidget
+{
+  Q_OBJECT
+
+public:
+  explicit MyWindow(QWidget* parent = nullptr);
+
+private:
+  Ui::MyWindow m_ui;
+};
diff --git a/Tests/RunCMake/Ninja/MyWindow.ui b/Tests/RunCMake/Ninja/MyWindow.ui
new file mode 100644 (file)
index 0000000..fbf294c
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MyWindow</class>
+ <widget class="QWidget" name="MyWindow"/>
+</ui>
index 7456608..46b840f 100644 (file)
@@ -8,6 +8,14 @@ add_library(simple_lib SHARED simple_lib.cpp)
 add_executable(app_with_qt app.cpp app_qt.cpp)
 target_link_libraries(app_with_qt PRIVATE simple_lib Qt5::Core)
 
+if(Qt5Widgets_DIR)
+  find_package(Qt5Widgets REQUIRED)
+  qt5_wrap_ui(_headers MyWindow.ui)
+  add_executable(app_with_widget app.cpp MyWindow.cpp ${_headers})
+  target_link_libraries(app_with_widget PRIVATE Qt5::Widgets)
+  target_include_directories(app_with_widget PRIVATE "${CMAKE_BINARY_DIR}")
+endif()
+
 add_subdirectory(QtSubDir1)
 add_subdirectory(QtSubDir2)
 add_subdirectory(QtSubDir3)
index 1b252cd..0c0619d 100644 (file)
@@ -186,16 +186,6 @@ function(sleep delay)
   endif()
 endfunction(sleep)
 
-function(touch path)
-  execute_process(
-    COMMAND ${CMAKE_COMMAND} -E touch ${path}
-    RESULT_VARIABLE result
-    )
-  if(NOT result EQUAL 0)
-    message(FATAL_ERROR "failed to touch main ${path} file.")
-  endif()
-endfunction(touch)
-
 macro(ninja_escape_path path out)
   string(REPLACE "\$ " "\$\$" "${out}" "${path}")
   string(REPLACE " " "\$ " "${out}" "${${out}}")
@@ -264,8 +254,8 @@ build build.ninja: RERUN ${escaped_build_ninja_dep} || ${escaped_ninja_output_pa
   # Test regeneration rules run in order.
   set(main_cmakelists "${RunCMake_SOURCE_DIR}/CMakeLists.txt")
   sleep(${fs_delay})
-  touch("${main_cmakelists}")
-  touch("${build_ninja_dep}")
+  file(TOUCH "${main_cmakelists}")
+  file(TOUCH "${build_ninja_dep}")
   run_ninja("${top_build_dir}")
   file(TIMESTAMP "${main_cmakelists}" mtime_main_cmakelists UTC)
   file(TIMESTAMP "${sub_build_ninja}" mtime_sub_build_ninja UTC)
@@ -329,14 +319,14 @@ run_ChangeBuildType()
 function(run_Qt5AutoMocDeps)
   if(CMake_TEST_Qt5 AND CMAKE_TEST_Qt5Core_Version VERSION_GREATER_EQUAL 5.15.0)
     set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Qt5AutoMocDeps-build)
-    set(RunCMake_TEST_OPTIONS "-DQt5Core_DIR=${Qt5Core_DIR}")
+    set(RunCMake_TEST_OPTIONS "-DQt5Core_DIR=${Qt5Core_DIR}" "-DQt5Widgets_DIR=${Qt5Widgets_DIR}")
     run_cmake(Qt5AutoMocDeps)
     unset(RunCMake_TEST_OPTIONS)
     # Build the project.
     run_ninja("${RunCMake_TEST_BINARY_DIR}")
     # Touch just the library source file, which shouldn't cause a rerun of AUTOMOC
     # for app_with_qt target.
-    touch("${RunCMake_SOURCE_DIR}/simple_lib.cpp")
+    file(TOUCH "${RunCMake_SOURCE_DIR}/simple_lib.cpp")
     # Build and assert that AUTOMOC was not run for app_with_qt.
     run_ninja("${RunCMake_TEST_BINARY_DIR}")
     if(ninja_stdout MATCHES "Automatic MOC for target app_with_qt")
@@ -352,6 +342,11 @@ function(run_Qt5AutoMocDeps)
       message(FATAL_ERROR
         "AUTOMOC should not have executed for 'sub_exe_2' target:\nstdout:\n${ninja_stdout}")
     endif()
+    # Touch a header file to make sure an automoc dependency cycle is not introduced.
+    file(TOUCH "${RunCMake_SOURCE_DIR}/MyWindow.h")
+    run_ninja("${RunCMake_TEST_BINARY_DIR}")
+    # Need to run a second time to hit the dependency cycle.
+    run_ninja("${RunCMake_TEST_BINARY_DIR}")
   endif()
 endfunction()
 run_Qt5AutoMocDeps()
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbg-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbg-debug-in-release-graph-ninja-stdout.txt
new file mode 100644 (file)
index 0000000..3c92457
--- /dev/null
@@ -0,0 +1,4 @@
+^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Release[\/]echo\.c\.(o|obj)
+\[2/3\] Linking C executable Release[\/]echo(\.exe)?
+\[3/3\] Generating echo_dbg_Debug\.txt
+'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Release[\/]echo(\.exe)?' 'Debug' 'echo_dbg_Debug\.txt'$
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbg-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbg-debug-ninja-stdout.txt
new file mode 100644 (file)
index 0000000..2ab35a7
--- /dev/null
@@ -0,0 +1,4 @@
+^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj)
+\[2/3\] Linking C executable Debug[\/]echo(\.exe)?
+\[3/3\] Generating echo_dbg_Debug\.txt
+'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug[\/]echo(\.exe)?' 'Debug' 'echo_dbg_Debug\.txt'$
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbg-release-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbg-release-ninja-stdout.txt
new file mode 100644 (file)
index 0000000..4b1473d
--- /dev/null
@@ -0,0 +1,2 @@
+^\[1/2\] Building C object CMakeFiles[\/]echo.dir[\/]Release[\/]echo\.c\.(o|obj)
+\[2/2\] Linking C executable Release[\/]echo(\.exe)?$
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbgx-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbgx-debug-in-release-graph-ninja-stdout.txt
new file mode 100644 (file)
index 0000000..25c357c
--- /dev/null
@@ -0,0 +1,4 @@
+^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Release[\/]echo\.c\.(o|obj)
+\[2/3\] Linking C executable Release[\/]echo(\.exe)?
+\[3/3\] Generating echo_dbgx_Debug\.txt
+'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Release[\/]echo(\.exe)?' 'Debug' 'echo_dbgx_Debug\.txt' 'echo_dbgx_byproduct_Debug\.txt'$
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbgx-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbgx-debug-ninja-stdout.txt
new file mode 100644 (file)
index 0000000..153906d
--- /dev/null
@@ -0,0 +1,4 @@
+^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Debug[\/]echo\.c\.(o|obj)
+\[2/3\] Linking C executable Debug[\/]echo(\.exe)?
+\[3/3\] Generating echo_dbgx_Debug\.txt
+'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug[\/]echo(\.exe)?' 'Debug' 'echo_dbgx_Debug\.txt' 'echo_dbgx_byproduct_Debug\.txt'$
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbgx-release-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_dbgx-release-ninja-stdout.txt
new file mode 100644 (file)
index 0000000..32aa070
--- /dev/null
@@ -0,0 +1,5 @@
+^\[1/3\] Building C object CMakeFiles[\/]echo.dir[\/]Release[\/]echo\.c\.(o|obj)
+\[2/3\] Linking C executable Release[\/]echo(\.exe)?
+\[3/3\] [^
+]*
+'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Release[\/]echo(\.exe)?' 'Release' 'echo_dbgx_byproduct_Release\.txt'$
index 5d6f421..e49cc32 100644 (file)
@@ -119,6 +119,30 @@ foreach(case
   add_custom_target(${case} DEPENDS ${case}_$<CONFIG>.txt)
 endforeach()
 
+# An OUTPUT in only one configuration.
+add_custom_command(
+  OUTPUT "$<$<CONFIG:Debug>:echo_dbg_Debug.txt>"
+  COMMAND echo $<CONFIG> "$<$<CONFIG:Debug>:echo_dbg_Debug.txt>"
+  )
+set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/echo_dbg_Debug.txt PROPERTY SYMBOLIC 1)
+add_custom_target(echo_dbg DEPENDS "$<$<CONFIG:Debug>:echo_dbg_Debug.txt>")
+
+# An OUTPUT in only one configuration with BYPRODUCTS in every configuration.
+add_custom_command(
+  OUTPUT "$<$<CONFIG:Debug>:echo_dbgx_Debug.txt>"
+  BYPRODUCTS echo_dbgx_byproduct_$<CONFIG>.txt
+  COMMAND echo $<CONFIG> "$<$<CONFIG:Debug>:echo_dbgx_Debug.txt>" echo_dbgx_byproduct_$<CONFIG>.txt
+  COMMAND_EXPAND_LISTS
+  )
+  set_property(SOURCE
+    ${CMAKE_CURRENT_BINARY_DIR}/echo_dbgx_Debug.txt
+    ${CMAKE_CURRENT_BINARY_DIR}/echo_dbgx_byproduct_Debug.txt
+    ${CMAKE_CURRENT_BINARY_DIR}/echo_dbgx_byproduct_Release.txt
+    ${CMAKE_CURRENT_BINARY_DIR}/echo_dbgx_byproduct_MinSizeRel.txt
+    ${CMAKE_CURRENT_BINARY_DIR}/echo_dbgx_byproduct_RelWithDebInfo.txt
+    PROPERTY SYMBOLIC 1)
+add_custom_target(echo_dbgx DEPENDS "$<$<CONFIG:Debug>:echo_dbgx_Debug.txt>")
+
 add_custom_target(echo_target_raw
   BYPRODUCTS echo_target_raw_$<CONFIG>.txt
   COMMENT echo_target_raw
diff --git a/Tests/RunCMake/NinjaMultiConfig/LongCommandLine.cmake b/Tests/RunCMake/NinjaMultiConfig/LongCommandLine.cmake
new file mode 100644 (file)
index 0000000..00aa896
--- /dev/null
@@ -0,0 +1,16 @@
+enable_language(C)
+
+add_executable(generator main.c)
+
+string(REPEAT "." 5000 very_long)
+
+add_custom_command(
+  OUTPUT gen.txt
+  COMMAND generator "${very_long}" > gen.txt
+  )
+
+add_custom_target(
+  custom
+  ALL
+  DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gen.txt"
+  )
index 21c2658..23b4aea 100644 (file)
@@ -193,9 +193,14 @@ run_cmake_build(SimpleCrossConfigs all-relwithdebinfo-in-release-graph Release a
 set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PostBuild-build)
 set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all")
 run_cmake_configure(PostBuild)
+unset(RunCMake_TEST_OPTIONS)
 run_cmake_build(PostBuild release Release Exe)
 run_cmake_build(PostBuild debug-in-release-graph Release Exe:Debug)
 
+set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/LongCommandLine-build)
+run_cmake_configure(LongCommandLine)
+run_cmake_build(LongCommandLine release Release custom)
+
 set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Framework-build)
 set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all")
 run_cmake_configure(Framework)
@@ -318,6 +323,20 @@ run_ninja(CustomCommandOutputGenex echo_no_cross_byproduct_if-debug build-Debug.
 run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean)
 run_ninja(CustomCommandOutputGenex echo_no_cross_byproduct_if-debug-in-release-graph build-Release.ninja echo_no_cross_byproduct_if:Debug)
 run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean)
+# echo_dbg
+run_ninja(CustomCommandOutputGenex echo_dbg-debug build-Debug.ninja echo_dbg)
+run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean)
+run_ninja(CustomCommandOutputGenex echo_dbg-release build-Release.ninja echo_dbg)
+run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean)
+run_ninja(CustomCommandOutputGenex echo_dbg-debug-in-release-graph build-Release.ninja echo_dbg:Debug)
+run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean)
+# echo_dbgx
+run_ninja(CustomCommandOutputGenex echo_dbgx-debug build-Debug.ninja echo_dbgx)
+run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean)
+run_ninja(CustomCommandOutputGenex echo_dbgx-release build-Release.ninja echo_dbgx)
+run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean)
+run_ninja(CustomCommandOutputGenex echo_dbgx-debug-in-release-graph build-Release.ninja echo_dbgx:Debug)
+run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean)
 # echo_target_raw
 run_ninja(CustomCommandOutputGenex echo_target_raw-debug build-Debug.ninja echo_target_raw:Debug)
 run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean)
diff --git a/Tests/RunCMake/ParseImplicitData/linux-C-NVHPC-21.1.0.input b/Tests/RunCMake/ParseImplicitData/linux-C-NVHPC-21.1.0.input
new file mode 100644 (file)
index 0000000..93e36ca
--- /dev/null
@@ -0,0 +1,42 @@
+CMAKE_LANG=C
+CMAKE_LINKER=/usr/bin/ld
+CMAKE_C_COMPILER_ABI=
+CMAKE_C_COMPILER_AR=
+CMAKE_C_COMPILER_ARCHITECTURE_ID=
+CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN=
+CMAKE_C_COMPILER_ID=NVHPC
+CMAKE_C_COMPILER_LAUNCHER=
+CMAKE_C_COMPILER_LOADED=1
+CMAKE_C_COMPILER_RANLIB=
+CMAKE_C_COMPILER_TARGET=
+CMAKE_C_COMPILER_VERSION=21.1.0
+CMAKE_C_COMPILER_VERSION_INTERAL=
+Change Dir: /root/parse_implicit_data/CMakeFiles/CMakeTmp
+
+Run Build Command(s):/usr/bin/make -f Makefile cmTC_b8daa/fast && /usr/bin/make  -f CMakeFiles/cmTC_b8daa.dir/build.make CMakeFiles/cmTC_b8daa.dir/build
+make[1]: Entering directory '/root/parse_implicit_data/CMakeFiles/CMakeTmp'
+Building C object CMakeFiles/cmTC_b8daa.dir/CMakeCCompilerABI.c.o
+/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/bin/nvc   -v -o CMakeFiles/cmTC_b8daa.dir/CMakeCCompilerABI.c.o -c /host_pwd/Work/cmake/src/Modules/CMakeCCompilerABI.c
+Export PGI_CURR_CUDA_HOME=/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/cuda/
+Export NVCOMPILER=/opt/nvidia/hpc_sdk/Linux_x86_64/21.1
+Export PGI=/opt/nvidia/hpc_sdk
+
+/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/bin/tools/cpp1 --llalign -Dunix -D__unix -D__unix__ -Dlinux -D__linux -D__linux__ -D__NO_MATH_INLINES -D__LP64__ -D__x86_64 -D__x86_64__ -D__LONG_MAX__=9223372036854775807L '-D__SIZE_TYPE__=unsigned long int' '-D__PTRDIFF_TYPE__=long int' -D__amd64 -D__amd64__ -D__k8 -D__k8__ -D__MMX__ -D__SSE__ -D__SSE2__ -D__SSE3__ -D__SSSE3__ -D__SSE4_1__ -D__SSE4_2__ -D__AVX__ -D__AVX2__ -D__AVX512F__ -D__AVX512VL__ -D__FMA__ -D__XSAVE__ -D__POPCNT__ -D__FXSR__ -D__PGI -D__NVCOMPILER -D_PGCG_SOURCE --c -I- -I/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/include-gcc70 -I/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/include -I/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/include-gcc70 -I/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/include -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include -D__PGLLVM__ -D__NVCOMPILER_LLVM__ -D__extension__= --preinclude _cplus_preinclude.h --preinclude_macros _cplus_macros.h --gnu_version=90300 -D__pgnu_vsn=90300 -q -o /tmp/nvcjpcFBbmqiQuf.il /host_pwd/Work/cmake/src/Modules/CMakeCCompilerABI.c
+
+/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/bin/tools/cpp2 /host_pwd/Work/cmake/src/Modules/CMakeCCompilerABI.c -opt 1 -x 119 0xa10000 -x 122 0x40 -x 123 0x1000 -x 127 4 -x 127 17 -x 19 0x400000 -x 28 0x40000 -x 120 0x10000000 -x 70 0x8000 -x 122 1 -x 125 0x20000 -quad -x 59 4 -tp skylake -x 120 0x1000 -astype 0 -fn /host_pwd/Work/cmake/src/Modules/CMakeCCompilerABI.c -il /tmp/nvcjpcFBbmqiQuf.il -x 123 0x80000000 -x 123 4 -x 2 0x400 -x 119 0x20 -def __pgnu_vsn=90300 -x 70 0x40000000 -x 183 4 -x 121 0x800 -x 6 0x20000 -x 122 0x400000 -y 125 0x100000 -x 249 100 -x 120 0x200000 -x 70 0x40000000 -x 8 0x40000000 -x 164 0x800000 -x 85 0x2000 -x 85 0x4000 -x 68 0x1 -x 39 4 -x 56 0x10 -x 26 0x10 -x 26 1 -x 56 0x4000 -y 163 0xc0000000 -x 189 0x10 -y 189 0x4000000 -gnuvsn 90300 -x 69 0x200 -x 123 0x400 -cmdline '+nvc /tmp/nvcjpcFBbmqiQuf.il -v -o CMakeFiles/cmTC_b8daa.dir/CMakeCCompilerABI.c.o -c' -asm /tmp/nvczpcFlZn4rWzz.ll
+NVC++/x86-64 Linux 21.1-0: compilation successful
+
+/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/share/llvm/bin/llc /tmp/nvczpcFlZn4rWzz.ll -march=x86-64 -mcpu=native -O1 -fast-isel=0 -non-global-value-max-name-size=4294967295 -x86-cmov-converter=0 -filetype=obj -o CMakeFiles/cmTC_b8daa.dir/CMakeCCompilerABI.c.o
+Unlinking /tmp/nvcjpcFBbmqiQuf.il
+Unlinking /tmp/nvcrpcFZmmAHpuz.s
+Unlinking /tmp/nvczpcFlZn4rWzz.ll
+Unlinking /tmp/nvcHpcFJmCQUbek.llvm
+Linking C executable cmTC_b8daa
+/host_pwd/Work/cmake/nvhpc_build/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b8daa.dir/link.txt --verbose=1
+/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/bin/nvc  -v CMakeFiles/cmTC_b8daa.dir/CMakeCCompilerABI.c.o -o cmTC_b8daa
+Export PGI_CURR_CUDA_HOME=/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/cuda/
+Export NVCOMPILER=/opt/nvidia/hpc_sdk/Linux_x86_64/21.1
+Export PGI=/opt/nvidia/hpc_sdk
+
+/usr/bin/ld /usr/lib/x86_64-linux-gnu/crt1.o /usr/lib/x86_64-linux-gnu/crti.o /opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/lib/trace_init.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbegin.o --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/lib/nvhpc.ld -L/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/lib -L/usr/lib64 -L/usr/lib/gcc/x86_64-linux-gnu/9 CMakeFiles/cmTC_b8daa.dir/CMakeCCompilerABI.c.o -rpath /opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/lib -rpath /usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib64 -o cmTC_b8daa -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib64 -lnvomp -ldl --as-needed -lnvhpcatm -latomic --no-as-needed -lpthread --start-group -lnvcpumath -lnsnvc -lnvc --end-group -lm -lgcc -lc -lgcc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/9/crtend.o /usr/lib/x86_64-linux-gnu/crtn.o
+make[1]: Leaving directory '/root/parse_implicit_data/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitData/linux-CXX-NVHPC-21.1.0.input b/Tests/RunCMake/ParseImplicitData/linux-CXX-NVHPC-21.1.0.input
new file mode 100644 (file)
index 0000000..64781b9
--- /dev/null
@@ -0,0 +1,42 @@
+CMAKE_LANG=CXX
+CMAKE_LINKER=/usr/bin/ld
+CMAKE_CXX_COMPILER_ABI=
+CMAKE_CXX_COMPILER_AR=
+CMAKE_CXX_COMPILER_ARCHITECTURE_ID=
+CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN=
+CMAKE_CXX_COMPILER_ID=NVHPC
+CMAKE_CXX_COMPILER_LAUNCHER=
+CMAKE_CXX_COMPILER_LOADED=1
+CMAKE_CXX_COMPILER_RANLIB=
+CMAKE_CXX_COMPILER_TARGET=
+CMAKE_CXX_COMPILER_VERSION=21.1.0
+CMAKE_CXX_COMPILER_VERSION_INTERAL=
+Change Dir: /root/parse_implicit_data/CMakeFiles/CMakeTmp
+
+Run Build Command(s):/usr/bin/make -f Makefile cmTC_79118/fast && /usr/bin/make  -f CMakeFiles/cmTC_79118.dir/build.make CMakeFiles/cmTC_79118.dir/build
+make[1]: Entering directory '/root/parse_implicit_data/CMakeFiles/CMakeTmp'
+Building CXX object CMakeFiles/cmTC_79118.dir/CMakeCXXCompilerABI.cpp.o
+/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/bin/nvc++   -v -o CMakeFiles/cmTC_79118.dir/CMakeCXXCompilerABI.cpp.o -c /host_pwd/Work/cmake/src/Modules/CMakeCXXCompilerABI.cpp
+Export PGI_CURR_CUDA_HOME=/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/cuda/
+Export NVCOMPILER=/opt/nvidia/hpc_sdk/Linux_x86_64/21.1
+Export PGI=/opt/nvidia/hpc_sdk
+
+/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/bin/tools/cpp1 --llalign -Dunix -D__unix -D__unix__ -Dlinux -D__linux -D__linux__ -D__NO_MATH_INLINES -D__LP64__ -D__x86_64 -D__x86_64__ -D__LONG_MAX__=9223372036854775807L '-D__SIZE_TYPE__=unsigned long int' '-D__PTRDIFF_TYPE__=long int' -D__amd64 -D__amd64__ -D__k8 -D__k8__ -D__MMX__ -D__SSE__ -D__SSE2__ -D__SSE3__ -D__SSSE3__ -D__SSE4_1__ -D__SSE4_2__ -D__AVX__ -D__AVX2__ -D__AVX512F__ -D__AVX512VL__ -D__FMA__ -D__XSAVE__ -D__POPCNT__ -D__FXSR__ -D__PGI -D__NVCOMPILER -D_GNU_SOURCE -D_PGCG_SOURCE -I- -I/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/include-gcc70 -I/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/include -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include -I/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/include-gcc70 -I/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/include -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include -D__PGLLVM__ -D__NVCOMPILER_LLVM__ -D__extension__= --preinclude _cplus_preinclude.h --preinclude_macros _cplus_macros.h --gnu_version=90300 -D__pgnu_vsn=90300 -q -o /tmp/nvc++WCcFq4IEc6_D.il /host_pwd/Work/cmake/src/Modules/CMakeCXXCompilerABI.cpp
+
+/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/bin/tools/cpp2 /host_pwd/Work/cmake/src/Modules/CMakeCXXCompilerABI.cpp -opt 1 -x 119 0xa10000 -x 122 0x40 -x 123 0x1000 -x 127 4 -x 127 17 -x 19 0x400000 -x 28 0x40000 -x 120 0x10000000 -x 70 0x8000 -x 122 1 -x 125 0x20000 -quad -x 59 4 -tp skylake -x 120 0x1000 -astype 0 -fn /host_pwd/Work/cmake/src/Modules/CMakeCXXCompilerABI.cpp -il /tmp/nvc++WCcFq4IEc6_D.il -x 117 0x200 -x 123 0x80000000 -x 123 4 -x 119 0x20 -def __pgnu_vsn=90300 -x 70 0x40000000 -x 183 4 -x 121 0x800 -x 6 0x20000 -x 249 100 -x 120 0x200000 -x 70 0x40000000 -x 8 0x40000000 -x 164 0x800000 -x 85 0x2000 -x 85 0x4000 -x 68 0x1 -x 39 4 -x 56 0x10 -x 26 0x10 -x 26 1 -x 56 0x4000 -y 163 0xc0000000 -x 189 0x10 -y 189 0x4000000 -gnuvsn 90300 -x 69 0x200 -x 123 0x400 -cmdline '+nvc++ /tmp/nvc++WCcFq4IEc6_D.il -v -o CMakeFiles/cmTC_79118.dir/CMakeCXXCompilerABI.cpp.o -c' -asm /tmp/nvc++WCcFqmjAQUnq.ll
+NVC++/x86-64 Linux 21.1-0: compilation successful
+
+/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/share/llvm/bin/llc /tmp/nvc++WCcFqmjAQUnq.ll -march=x86-64 -mcpu=native -O1 -fast-isel=0 -non-global-value-max-name-size=4294967295 -x86-cmov-converter=0 -filetype=obj -o CMakeFiles/cmTC_79118.dir/CMakeCXXCompilerABI.cpp.o
+Unlinking /tmp/nvc++WCcFq4IEc6_D.il
+Unlinking /tmp/nvc++WCcFq65QYK7M.s
+Unlinking /tmp/nvc++WCcFqmjAQUnq.ll
+Unlinking /tmp/nvc++WCcFqUsdHmUV.llvm
+Linking CXX executable cmTC_79118
+/host_pwd/Work/cmake/nvhpc_build/bin/cmake -E cmake_link_script CMakeFiles/cmTC_79118.dir/link.txt --verbose=1
+/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/bin/nvc++  -v CMakeFiles/cmTC_79118.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_79118
+Export PGI_CURR_CUDA_HOME=/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/cuda/
+Export NVCOMPILER=/opt/nvidia/hpc_sdk/Linux_x86_64/21.1
+Export PGI=/opt/nvidia/hpc_sdk
+
+/usr/bin/ld /usr/lib/x86_64-linux-gnu/crt1.o /usr/lib/x86_64-linux-gnu/crti.o /opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/lib/trace_init.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbegin.o --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/lib/nvhpc.ld -L/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/lib -L/usr/lib64 -L/usr/lib/gcc/x86_64-linux-gnu/9 CMakeFiles/cmTC_79118.dir/CMakeCXXCompilerABI.cpp.o -rpath /opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/lib -rpath /usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib64 -o cmTC_79118 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib64 -latomic -lnvhpcatm -lstdc++ -lnvomp -ldl --as-needed -lnvhpcatm -latomic --no-as-needed -lpthread --start-group -lnvcpumath -lnsnvc -lnvc --end-group -lm -lgcc -lc -lgcc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/9/crtend.o /usr/lib/x86_64-linux-gnu/crtn.o
+make[1]: Leaving directory '/root/parse_implicit_data/CMakeFiles/CMakeTmp'
index abd0eaa..2d3abcc 100644 (file)
@@ -28,6 +28,7 @@ set(targets
     linux-Fortran-PGI-18.10.1 linux_pgf77-Fortran-PGI-18.10.1
     linux_nostdinc-C-PGI-18.10.1 linux_nostdinc-CXX-PGI-18.10.1
     linux_nostdinc-Fortran-PGI-18.10.1
+  linux-C-NVHPC-21.1.0-empty linux-CXX-NVHPC-21.1.0-empty
   linux-C-XL-12.1.0 linux-CXX-XL-12.1.0 linux-Fortran-XL-14.1.0
     linux_nostdinc-C-XL-12.1.0 linux_nostdinc-CXX-XL-12.1.0
     linux_nostdinc_i-C-XL-12.1.0 linux_nostdinc-CXX-XL-12.1.0
index c46d044..1f3468b 100644 (file)
@@ -28,6 +28,7 @@ set(targets
     linux-Fortran-PGI-18.10.1 linux_pgf77-Fortran-PGI-18.10.1
     linux_nostdinc-C-PGI-18.10.1 linux_nostdinc-CXX-PGI-18.10.1
     linux_nostdinc-Fortran-PGI-18.10.1
+  linux-C-NVHPC-21.1.0 linux-CXX-NVHPC-21.1.0
   linux-C-XL-12.1.0 linux-CXX-XL-12.1.0 linux-Fortran-XL-14.1.0
     linux_nostdinc-C-XL-12.1.0 linux_nostdinc-CXX-XL-12.1.0
     linux_nostdinc_i-C-XL-12.1.0 linux_nostdinc-CXX-XL-12.1.0
@@ -104,10 +105,8 @@ endfunction()
 function(load_platform_info target)
   if(target MATCHES "linux-")
     set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_]*" PARENT_SCOPE)
-    set(CMAKE_LIBRARY_ARCHITECTURE_REGEX_VERSIONED "gcc/[a-z0-9_]+(-[a-z0-9_]+)?-linux(-gnu)?/[0-9]+(\\.[0-9]+\\.[0-9]+)*" PARENT_SCOPE)
   else()
     unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX PARENT_SCOPE)
-    unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX_VERSIONED PARENT_SCOPE)
   endif()
 endfunction()
 
@@ -134,6 +133,7 @@ foreach(t ${targets})
   # Need to handle files with empty entries for both libs or dirs
   set(implicit_lib_output "")
   set(idirs_output "")
+  set(implicit_objs "")
   set(library_arch_output "")
   file(STRINGS ${outfile} outputs)
   foreach(line IN LISTS outputs)
@@ -149,10 +149,11 @@ foreach(t ${targets})
   endforeach()
 
   cmake_parse_implicit_link_info("${input}" implicit_libs idirs implicit_fwks log
-      "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}")
+      "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}"
+      COMPUTE_IMPLICIT_OBJECTS implicit_objs)
 
   set(library_arch)
-  cmake_parse_library_architecture("${idirs}" library_arch)
+  cmake_parse_library_architecture(${lang} "${idirs}" "${implicit_objs}" library_arch)
 
   # File format
   # file(WRITE ${outfile} "libs=${implicit_libs}\ndirs=${idirs}\nlibrary_arch=${library_arch}")
@@ -165,7 +166,7 @@ foreach(t ${targets})
     message("${t} parse failed: state=${state}, '${idirs}' does not match '${idirs_output}'")
   elseif(NOT "${implicit_libs}" STREQUAL "${implicit_lib_output}")
     message("${t} parse failed: state=${state}, '${implicit_libs}' does not match '${implicit_lib_output}'")
-  elseif(library_arch AND NOT "${library_arch}" STREQUAL "${library_arch_output}")
+  elseif((library_arch OR library_arch_output) AND NOT "${library_arch}" STREQUAL "${library_arch_output}")
     message("${t} parse failed: state=${state}, '${library_arch}' does not match '${library_arch_output}'")
   endif()
 
index 55852c0..e613290 100644 (file)
@@ -1,3 +1,3 @@
 libs=imf;svml;irng;m;ipgo;decimal;cilkrts;stdc++;gcc;gcc_s;irc;svml;c;gcc;gcc_s;irc_s;dl;c
 dirs=/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/lib/intel64;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/lib/intel64_lin;/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin;/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/lib/intel64/gcc4.7;/usr/lib/gcc/x86_64-redhat-linux/4.8.5;/usr/lib64;/lib64;/usr/lib;/lib
-library_arch=x86_64-redhat-linux
+library_arch=
diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-C-NVHPC-21.1.0.output b/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-C-NVHPC-21.1.0.output
new file mode 100644 (file)
index 0000000..e932be9
--- /dev/null
@@ -0,0 +1,3 @@
+libs=nvomp;dl;nvhpcatm;atomic;pthread;nvcpumath;nsnvc;nvc;m;gcc;c;gcc;gcc_s
+dirs=/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/lib;/usr/lib64;/usr/lib/gcc/x86_64-linux-gnu/9
+library_arch=x86_64-linux-gnu
index de8c8eb..81ac0ba 100644 (file)
@@ -1,3 +1,3 @@
 libs=xlopt;xl;dl;gcc_s;gcc;m;c;gcc_s;gcc
 dirs=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/lib64;/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/lib64;/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/lib64;/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/lib64;/usr/lib/gcc/ppc64-redhat-linux/4.4.7;/usr/lib64;/lib64;/usr/lib
-library_arch=ppc64-redhat-linux
+library_arch=
index cd672d5..b88a48d 100644 (file)
@@ -1,3 +1,3 @@
 libs=xlopt;xl;dl;gcc_s;pthread;gcc;m;c;gcc_s;gcc
 dirs=/opt/ibm/xlsmp/5.1.0/lib;/opt/ibm/xlmass/9.1.0/lib;/opt/ibm/xlC/16.1.0/lib;/usr/lib/gcc/ppc64le-redhat-linux/4.8.5;/usr/lib64;/lib64;/usr/lib
-library_arch=ppc64le-redhat-linux
+library_arch=
index 8824772..261785c 100644 (file)
@@ -1,3 +1,3 @@
 libs=cudadevrt;cudart_static;rt;pthread;dl;xlopt;xl;ibmc++;stdc++;m;dl;gcc_s;gcc;pthread;m;c;gcc_s;gcc
 dirs=/sw/summit/cuda/10.1.168/targets/ppc64le-linux/lib/stubs;/sw/summit/cuda/10.1.168/targets/ppc64le-linux/lib;/autofs/nccs-svm1_sw/summit/.swci/1-compute/opt/spack/20180914/linux-rhel7-ppc64le/xl-16.1.1-3/spectrum-mpi-10.3.0.1-20190611-aqjt3jo53mogrrhcrd2iufr435azcaha/lib;/autofs/nccs-svm1_sw/summit/.swci/1-compute/opt/spack/20180914/linux-rhel7-ppc64le/gcc-4.8.5/darshan-runtime-3.1.7-csygoqyym3m3ysoaperhxlhoiluvpa2u/lib;/autofs/nccs-svm1_sw/summit/xl/16.1.1-3/xlsmp/5.1.1/lib;/autofs/nccs-svm1_sw/summit/xl/16.1.1-3/xlmass/9.1.1/lib;/autofs/nccs-svm1_sw/summit/xl/16.1.1-3/xlC/16.1.1/lib;/usr/lib/gcc/ppc64le-redhat-linux/4.8.5;/usr/lib64;/lib64;/autofs/nccs-svm1_sw/peak/.swci/1-compute/opt/spack/20180914/linux-rhel7-ppc64le/gcc-4.8.5/darshan-runtime-3.1.7-ytwv7xbkub6mqnpvygdthwqa7mhjqbc5/lib;/usr/lib
-library_arch=ppc64le-redhat-linux
+library_arch=
index 6a2a105..678a196 100644 (file)
@@ -1,3 +1,3 @@
 libs=imf;svml;irng;stdc++;m;ipgo;decimal;cilkrts;stdc++;gcc;gcc_s;irc;svml;c;gcc;gcc_s;irc_s;dl;c
 dirs=/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/lib/intel64;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/lib/intel64_lin;/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin;/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/lib/intel64/gcc4.7;/usr/lib/gcc/x86_64-redhat-linux/4.8.5;/usr/lib64;/lib64;/usr/lib;/lib
-library_arch=x86_64-redhat-linux
+library_arch=
diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-CXX-NVHPC-21.1.0.output b/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-CXX-NVHPC-21.1.0.output
new file mode 100644 (file)
index 0000000..e7f7d05
--- /dev/null
@@ -0,0 +1,3 @@
+libs=atomic;nvhpcatm;stdc++;nvomp;dl;nvhpcatm;atomic;pthread;nvcpumath;nsnvc;nvc;m;gcc;c;gcc;gcc_s
+dirs=/opt/nvidia/hpc_sdk/Linux_x86_64/21.1/compilers/lib;/usr/lib64;/usr/lib/gcc/x86_64-linux-gnu/9
+library_arch=x86_64-linux-gnu
index 9fbc844..45c5565 100644 (file)
@@ -1,3 +1,3 @@
 libs=xlopt;xl;ibmc++;xlopt;xl;stdc++;m;dl;gcc_s;gcc;m;c;gcc_s;gcc;dl;gcc_s;gcc;m;c;gcc_s;gcc
 dirs=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/lib64;/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/lib64;/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/lib64;/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/lib64;/usr/lib/gcc/ppc64-redhat-linux/4.4.7;/usr/lib64;/lib64;/usr/lib
-library_arch=ppc64-redhat-linux
+library_arch=
index 4e9ab0a..9d649ec 100644 (file)
@@ -1,3 +1,3 @@
 libs=xlopt;xl;ibmc++;stdc++;m;dl;gcc_s;gcc;pthread;m;c;gcc_s;gcc
 dirs=/opt/ibm/xlsmp/5.1.0/lib;/opt/ibm/xlmass/9.1.0/lib;/opt/ibm/xlC/16.1.0/lib;/usr/lib/gcc/ppc64le-redhat-linux/4.8.5;/usr/lib64;/lib64;/usr/lib
-library_arch=ppc64le-redhat-linux
+library_arch=
index 68be4c5..3c07cf8 100644 (file)
@@ -1,3 +1,3 @@
 libs=xlf90;xlopt;xlomp_ser;xl;xlfmath;gcc_s;dl;rt;pthread;gcc;m;c;gcc_s;gcc
 dirs=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/lib64;/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/lib64;/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/lib64;/usr/lib/gcc/ppc64-redhat-linux/4.4.7;/usr/lib64;/lib64;/usr/lib
-library_arch=ppc64-redhat-linux
+library_arch=
index e44c84d..dc17ce7 100644 (file)
@@ -1,3 +1,3 @@
 libs=pgmp;numa;pthread;pgmath;nspgc;pgc;m;gcc;c;gcc;gcc_s
 dirs=/mnt/pgi/linux86-64/18.10/lib;/usr/lib64;/usr/lib/gcc/x86_64-linux-gnu/7
-library_arch=x86_64-linux-gnu2
+library_arch=
index de8c8eb..81ac0ba 100644 (file)
@@ -1,3 +1,3 @@
 libs=xlopt;xl;dl;gcc_s;gcc;m;c;gcc_s;gcc
 dirs=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/lib64;/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/lib64;/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/lib64;/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/lib64;/usr/lib/gcc/ppc64-redhat-linux/4.4.7;/usr/lib64;/lib64;/usr/lib
-library_arch=ppc64-redhat-linux
+library_arch=
index cd15054..a7c14d2 100644 (file)
@@ -1,3 +1,3 @@
 libs=atomic;pgatm;stdc++;pgmp;numa;pthread;pgmath;nspgc;pgc;m;gcc;c;gcc;gcc_s
 dirs=/mnt/pgi/linux86-64/18.10/lib;/usr/lib64;/usr/lib/gcc/x86_64-linux-gnu/7
-library_arch=x86_64-linux-gnu
+library_arch=
index 9fbc844..45c5565 100644 (file)
@@ -1,3 +1,3 @@
 libs=xlopt;xl;ibmc++;xlopt;xl;stdc++;m;dl;gcc_s;gcc;m;c;gcc_s;gcc;dl;gcc_s;gcc;m;c;gcc_s;gcc
 dirs=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/lib64;/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/lib64;/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/lib64;/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/lib64;/usr/lib/gcc/ppc64-redhat-linux/4.4.7;/usr/lib64;/lib64;/usr/lib
-library_arch=ppc64-redhat-linux
+library_arch=
index f3cc551..955d540 100644 (file)
@@ -1,3 +1,3 @@
 libs=pgf90rtl;pgf90;pgf90_rpm1;pgf902;pgf90rtl;pgftnrtl;pgmp;numa;pthread;pgmath;nspgc;pgc;rt;pthread;m;gcc;c;gcc;gcc_s
 dirs=/mnt/pgi/linux86-64/18.10/lib;/usr/lib64;/usr/lib/gcc/x86_64-linux-gnu/7
-library_arch=x86_64-linux-gnu
+library_arch=
index de8c8eb..81ac0ba 100644 (file)
@@ -1,3 +1,3 @@
 libs=xlopt;xl;dl;gcc_s;gcc;m;c;gcc_s;gcc
 dirs=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/lib64;/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/lib64;/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/lib64;/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/lib64;/usr/lib/gcc/ppc64-redhat-linux/4.4.7;/usr/lib64;/lib64;/usr/lib
-library_arch=ppc64-redhat-linux
+library_arch=
index 8f68358..30b86e6 100644 (file)
@@ -1,3 +1,3 @@
 libs=pgftnrtl;pgmp;numa;pthread;pgmath;nspgc;pgc;rt;pthread;m;gcc;c;gcc;gcc_s
 dirs=/mnt/pgi/linux86-64/18.10/lib;/usr/lib64;/usr/lib/gcc/x86_64-linux-gnu/7
-library_arch=x86_64-linux-gnu
+library_arch=
index a26f632..ea94a5b 100644 (file)
@@ -152,6 +152,7 @@ function(run_cmake test)
     "|clang[^:]*: warning: the object size sanitizer has no effect at -O0, but is explicitly enabled:"
     "|Error kstat returned"
     "|Hit xcodebuild bug"
+    "|Recompacting log\\.\\.\\."
 
     "|LICENSE WARNING:"
     "|Your license to use PGI[^\n]*expired"
@@ -214,6 +215,11 @@ function(run_cmake_command test)
   run_cmake(${test})
 endfunction()
 
+function(run_cmake_script test)
+  set(RunCMake_TEST_COMMAND ${CMAKE_COMMAND} ${ARGN} -P ${RunCMake_SOURCE_DIR}/${test}.cmake)
+  run_cmake(${test})
+endfunction()
+
 function(run_cmake_with_options test)
   set(RunCMake_TEST_OPTIONS "${ARGN}")
   run_cmake(${test})
index 50330fc..c4d3d61 100644 (file)
@@ -6,17 +6,17 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt
         WORLD_READ
 )
 
-if (UNIX)
+if (CMAKE_HOST_UNIX)
   find_program(STAT_EXECUTABLE NAMES stat)
   if(NOT STAT_EXECUTABLE)
     return()
   endif()
 
-  if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+  if (CMAKE_HOST_SYSTEM_NAME MATCHES "FreeBSD")
     execute_process(COMMAND "${STAT_EXECUTABLE}" -f %Lp "${CMAKE_CURRENT_BINARY_DIR}/sourcefile-source-permissions.txt"
       OUTPUT_VARIABLE output
     )
-  elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+  elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin")
     execute_process(COMMAND "${STAT_EXECUTABLE}" -f %A "${CMAKE_CURRENT_BINARY_DIR}/sourcefile-source-permissions.txt"
       OUTPUT_VARIABLE output
     )
index f7aedd1..65e5954 100644 (file)
@@ -3,20 +3,20 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt
     USE_SOURCE_PERMISSIONS
 )
 
-if (UNIX)
+if (CMAKE_HOST_UNIX)
   find_program(STAT_EXECUTABLE NAMES stat)
   if(NOT STAT_EXECUTABLE)
     return()
   endif()
 
-  if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+  if (CMAKE_HOST_SYSTEM_NAME MATCHES "FreeBSD")
     execute_process(COMMAND "${STAT_EXECUTABLE}" -f %Lp "${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt"
       OUTPUT_VARIABLE output1
     )
     execute_process(COMMAND "${STAT_EXECUTABLE}" -f %Lp "${CMAKE_CURRENT_BINARY_DIR}/sourcefile-use-source-permissions.txt"
       OUTPUT_VARIABLE output2
     )
-  elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+  elseif (CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin")
     execute_process(COMMAND "${STAT_EXECUTABLE}" -f %A "${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt"
       OUTPUT_VARIABLE output1
     )
index 8ef13f9..a707383 100644 (file)
@@ -17,6 +17,9 @@ if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
   if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
     list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release)
   endif()
+  if (RunCMake_GENERATOR MATCHES "Ninja")
+    set(VERBOSE -- -v)
+  endif()
 
   run_cmake(LINK_OPTIONS)
 
@@ -56,6 +59,10 @@ if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
       run_cmake_target(genex_DEVICE_LINK CMP0105_OLD LinkOptions_CMP0105_OLD --config Release)
       run_cmake_target(genex_DEVICE_LINK CMP0105_NEW LinkOptions_CMP0105_NEW --config Release)
       run_cmake_target(genex_DEVICE_LINK device LinkOptions_device --config Release)
+
+      if (RunCMake_GENERATOR MATCHES "(Ninja|Unix Makefiles)")
+        run_cmake_target(genex_DEVICE_LINK host_link_options LinkOptions_host_link_options --config Release ${VERBOSE})
+      endif()
     endif()
 
     run_cmake_target(genex_DEVICE_LINK no_device LinkOptions_no_device --config Release)
diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-check.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-check.cmake
new file mode 100644 (file)
index 0000000..31ffe7f
--- /dev/null
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "-Xlinker=OPT1 -Xlinker=OPT2 -Xlinker=OPT3 -Xlinker=OPT4 -Xlinker=OPT5")
+    set (RunCMake_TEST_FAILED "Not found expected '-Xlinker=OPT1 -Xlinker=OPT2 -Xlinker=OPT3 -Xlinker=OPT4 -Xlinker=OPT5'.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-result.txt b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-result.txt
new file mode 100644 (file)
index 0000000..8d98f9d
--- /dev/null
@@ -0,0 +1 @@
+.*
index 0126080..a53ab20 100644 (file)
@@ -1,6 +1,10 @@
 
 enable_language(C)
 
+set(CMAKE_VERBOSE_MAKEFILE TRUE)
+set(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES FALSE)
+set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_LIBRARIES FALSE)
+
 set (obj "${CMAKE_C_OUTPUT_EXTENSION}")
 if(BORLAND)
   set(pre -)
@@ -43,6 +47,10 @@ if (CMake_TEST_CUDA)
     set_property(TARGET LinkOptions_device PROPERTY CUDA_SEPARABLE_COMPILATION ON)
     target_link_options(LinkOptions_device PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>
                                                   $<HOST_LINK:${pre}BADFLAG_NORMAL_LINK${obj}>)
+
+    add_executable(LinkOptions_host_link_options LinkOptionsDevice.cu)
+    set_property(TARGET LinkOptions_host_link_options PROPERTY CUDA_SEPARABLE_COMPILATION ON)
+    target_link_options(LinkOptions_host_link_options PRIVATE -Wl,OPT1 -Xlinker=OPT2 "SHELL:-Xlinker OPT3" "SHELL:LINKER:OPT4 LINKER:OPT5")
   endif()
 
   add_executable(LinkOptions_no_device LinkOptionsDevice.cu)
index 5d8e318..dfaf831 100644 (file)
@@ -6,6 +6,17 @@ on ``cmake.org``.  See also the `CMake Source Code Guide`_.
 
 .. _`CMake Source Code Guide`: ../../Help/dev/source.rst
 
+File Table
+----------
+
+The set of package files distributed on ``cmake.org`` varies by CMake version.
+Clients providing automatic download functionality may query the set of
+package files available using a special file that lists them:
+
+* `File Table v1`_ Documentation
+
+.. _`File Table v1`: files-v1.rst
+
 Docker
 ------
 
diff --git a/Utilities/Release/files-sign.bash b/Utilities/Release/files-sign.bash
new file mode 100755 (executable)
index 0000000..414859d
--- /dev/null
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+set -e
+
+gpg --armor --detach-sign cmake-*-SHA-256.txt
diff --git a/Utilities/Release/files-v1.json.in b/Utilities/Release/files-v1.json.in
new file mode 100644 (file)
index 0000000..aa6b15d
--- /dev/null
@@ -0,0 +1,106 @@
+{
+  "version": {
+    "major": @version_major@,
+    "minor": @version_minor@,
+    "patch": @version_patch@,
+    @maybe_version_suffix@
+    "string": "@version@"
+  },
+  "files": [
+    {
+      "os": ["linux", "Linux"],
+      "architecture": ["aarch64"],
+      "class": "installer",
+      "name": "cmake-@version@-linux-aarch64.sh"
+    },
+    {
+      "os": ["linux", "Linux"],
+      "architecture": ["aarch64"],
+      "class": "archive",
+      "name": "cmake-@version@-linux-aarch64.tar.gz"
+    },
+    {
+      "os": ["linux", "Linux"],
+      "architecture": ["x86_64"],
+      "class": "installer",
+      "name": "cmake-@version@-linux-x86_64.sh"
+    },
+    {
+      "os": ["linux", "Linux"],
+      "architecture": ["x86_64"],
+      "class": "archive",
+      "name": "cmake-@version@-linux-x86_64.tar.gz"
+    },
+    {
+      "os": ["macos", "macOS"],
+      "architecture": ["arm64", "x86_64"],
+      "class": "volume",
+      "name": "cmake-@version@-macos-universal.dmg",
+      "macOSmin": "10.13"
+    },
+    {
+      "os": ["macos", "macOS"],
+      "architecture": ["arm64", "x86_64"],
+      "class": "archive",
+      "name": "cmake-@version@-macos-universal.tar.gz",
+      "macOSmin": "10.13"
+    },
+    {
+      "os": ["macos10.10", "macOS10.10"],
+      "architecture": ["arm64", "x86_64"],
+      "class": "volume",
+      "name": "cmake-@version@-macos10.10-universal.dmg",
+      "macOSmin": "10.10"
+    },
+    {
+      "os": ["macos10.10", "macOS10.10"],
+      "architecture": ["arm64", "x86_64"],
+      "class": "archive",
+      "name": "cmake-@version@-macos10.10-universal.tar.gz",
+      "macOSmin": "10.10"
+    },
+    {
+      "os": ["windows", "Windows"],
+      "architecture": ["i386"],
+      "class": "installer",
+      "name": "cmake-@version@-windows-i386.msi"
+    },
+    {
+      "os": ["windows", "Windows"],
+      "architecture": ["i386"],
+      "class": "archive",
+      "name": "cmake-@version@-windows-i386.zip"
+    },
+    {
+      "os": ["windows", "Windows"],
+      "architecture": ["x86_64"],
+      "class": "installer",
+      "name": "cmake-@version@-windows-x86_64.msi"
+    },
+    {
+      "os": ["windows", "Windows"],
+      "architecture": ["x86_64"],
+      "class": "archive",
+      "name": "cmake-@version@-windows-x86_64.zip"
+    },
+    {
+      "os": ["source"],
+      "architecture": [],
+      "class": "archive",
+      "name": "cmake-@version@.tar.gz"
+    },
+    {
+      "os": ["source"],
+      "architecture": [],
+      "class": "archive",
+      "name": "cmake-@version@.zip"
+    }
+  ],
+  "hashFiles": [
+    {
+      "algorithm": ["sha256", "SHA-256"],
+      "name": "cmake-@version@-SHA-256.txt",
+      "signature": ["cmake-@version@-SHA-256.txt.asc"]
+    }
+  ]
+}
diff --git a/Utilities/Release/files-v1.rst b/Utilities/Release/files-v1.rst
new file mode 100644 (file)
index 0000000..ceebecc
--- /dev/null
@@ -0,0 +1,186 @@
+File Table v1
+*************
+
+The set of package files distributed on ``cmake.org`` varies by CMake version.
+One file, named ``cmake-<ver>-files-v1.json``, contains a table of the package
+files available for a given version.  Clients may use this to find other files.
+
+Format
+------
+
+The format is a JSON object:
+
+.. code-block:: json
+
+  {
+    "version": {
+      "major": 3, "minor": 20, "patch": 0,
+      "string": "3.20.0"
+    },
+    "files": [
+      {
+        "os": ["...", "..."],
+        "architecture": ["...", "..."],
+        "class": "...",
+        "name": "..."
+      }
+    ],
+    "hashFiles": [
+      {
+        "algorithm": ["...", "..."],
+        "name": "cmake-<version>-<algo>.txt",
+        "signature": ["cmake-<version>-<algo>.txt.asc"]
+      }
+    ]
+  }
+
+The members are:
+
+``version``
+  A JSON object specifying the version of CMake with members:
+
+  ``major``, ``minor``, ``patch``
+    Integer values specifying the major, minor, and patch version components.
+
+  ``suffix``
+    A string specifying the version suffix, if any, e.g. ``rc1``.
+
+  ``string``
+    A string specifying the full version in the format
+    ``<major>.<minor>.<patch>[-<suffix>]``.
+
+``files``
+  A JSON array of entries corresponding to available package files.
+  Each entry is a JSON object containing members:
+
+  ``os``
+    A JSON array of strings naming the operating system for which the
+    package file is built, possibly using multiple alternative spellings.
+    Possible names include:
+
+    ``source``
+      Source packages.
+
+    ``Linux``, ``linux``
+      Linux packages.
+
+    ``macOS``, ``macos``
+      macOS packages.
+
+    ``Windows``, ``windows``
+      Windows packages.
+
+  ``architecture``
+    A JSON array of strings naming the architecture(s) for which the
+    package file is built, possibly using multiple alternative spellings.
+    Source packages have an empty list of architectures (``[]``).
+    Binary packages have a non-empty list of architectures, with at least
+    one name matching the output of ``uname -m`` on corresponding hosts.
+    On Windows, architecture names include ``x86_64`` and ``i386``.
+    On macOS, universal binary packages list all architectures,
+    e.g. ``["arm64","x86_64"]``.
+
+  ``class``
+    A JSON string naming the class of package.  The value is one of:
+
+    ``archive``
+      A tarball or zip archive.
+      The extension, such as ``.tar.gz`` or ``.zip``, indicates the format.
+      The rest of the file name matches the top-level directory in the archive.
+
+    ``installer``
+      An interactive installer.
+
+    ``volume``
+      A disk image (``.dmg`` on macOS).
+
+  ``name``
+    A JSON string specifying the name of the package file.
+
+  ``macOSmin``
+    Optional member that is present on package files for macOS.
+    The value is a JSON string specifying the minimum version of macOS
+    required to run the binary, e.g. ``"10.13"``.
+
+  ``deprecated``
+    Optional member that is present when the package file is deprecated
+    and may be removed from the set of package files in later versions.
+    The value is a string containing a deprecation message.
+    Clients should check this field to warn users when they are using
+    a deprecated package file.
+
+``hashFiles``
+  A JSON array of entries corresponding to files containing cryptographic
+  hashes of the package file contents.  Each entry is a JSON object
+  containing members:
+
+  ``algorithm``
+    A JSON array of strings naming a cryptographic hash algorithm, possibly
+    using multiple alternative spellings, e.g. ``["sha256", "SHA-256"]``.
+
+  ``name``
+    A JSON string specifying the name of the file containing hashes,
+    e.g. ``"cmake-<version>-SHA-256.txt"``.
+
+  ``signature``
+    A JSON array of strings naming files containing a cryptographic
+    signature of the hash file specified by ``name``, e.g.
+    ``["cmake-<version>-SHA-256.txt.asc"]``.
+
+  ``deprecated``
+    Optional member that is present when the hash algorithm is deprecated
+    and may be removed from the set of hash files in later versions.
+    The value is a string containing a deprecation message.
+    Clients that rely on a specific hash algorithm should check this
+    field to determine whether an update is needed.
+
+``deprecated``
+  Optional member that is present when `File Table v1`_ has been
+  deprecated in favor of a newer alternative.  The value is a string
+  containing a deprecation message.  Clients should check this field
+  to determine whether they need an update to use a newer alternative.
+
+The table and hash files are generated by `files.bash`_ from
+the `files-v1.json.in`_ template and the package files themselves.
+
+.. _`files.bash`: files.bash
+.. _`files-v1.json.in`: files-v1.json.in
+
+Queries
+-------
+
+Clients may download the `File Table v1`_ file ``cmake-<ver>-files-v1.json``
+and query it to get the name(s) of specific package files adjacent to it.
+Make queries as specific as possible in order to account for additional
+alternative binaries in future CMake versions.
+
+For example, one may use ``jq`` queries:
+
+* To select a Windows binary archive supporting ``x86_64`` hosts::
+
+    .files[] | select((.os[] | . == "windows") and
+                      (.architecture[] | . == "x86_64") and
+                      (.class == "archive")) | .name
+
+* To select a Linux binary archive supporting ``aarch64`` hosts::
+
+    .files[] | select((.os[] | . == "linux") and
+                      (.architecture[] | . == "aarch64") and
+                      (.class == "archive")) | .name
+
+* To select a macOS binary archive supporting ``arm64`` hosts::
+
+    .files[] | select((.os[] | . == "macos") and
+                      (.architecture[] | . == "arm64") and
+                      (.class == "archive")) | .name
+
+* To select a macOS binary archive supporting macOS 10.12 on ``x86_64`` hosts::
+
+    .files[] | select((.os[] | contains("macOS")) and
+                      (.architecture[] | . == "x86_64") and
+                      ([.macOSmin] | inside(["10.10", "10.11", "10.12"]))
+                      ) | .name
+
+* To select a SHA-256 hash file::
+
+    .hashFiles[] | select(.algorithm[] | . == "SHA-256") | .name
diff --git a/Utilities/Release/files.bash b/Utilities/Release/files.bash
new file mode 100755 (executable)
index 0000000..28ca8f1
--- /dev/null
@@ -0,0 +1,84 @@
+#!/usr/bin/env bash
+
+set -e
+
+usage='usage: files.bash [<options>] [--]
+
+Options:
+
+    --version <ver>            CMake <major>.<minor> version number to push.
+                               Defaults to version of source tree.
+'
+
+die() {
+    echo "$@" 1>&2; exit 1
+}
+
+readonly cmake_source_dir="${BASH_SOURCE%/*}/../.."
+
+cmake_version_component()
+{
+  sed -n "
+/^set(CMake_VERSION_${1}/ {s/set(CMake_VERSION_${1} *\([0-9]*\))/\1/;p;}
+" "${cmake_source_dir}/Source/CMakeVersion.cmake"
+}
+
+
+version=''
+while test "$#" != 0; do
+    case "$1" in
+    --version) shift; version="$1" ;;
+    --) shift ; break ;;
+    -*) die "$usage" ;;
+    *) break ;;
+    esac
+    shift
+done
+test "$#" = 0 || die "$usage"
+
+if test -z "$version"; then
+    cmake_version_major="$(cmake_version_component MAJOR)"
+    cmake_version_minor="$(cmake_version_component MINOR)"
+    cmake_version_patch="$(cmake_version_component PATCH)"
+    cmake_version_rc="$(cmake_version_component RC)"
+    version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}"
+    if test -n "$cmake_version_rc"; then
+      version="$version-rc$cmake_version_rc"
+    fi
+fi
+readonly version
+
+IFS='.-' read version_major version_minor version_patch version_suffix <<< "$version"
+readonly version_major
+readonly version_minor
+readonly version_patch
+readonly version_suffix
+
+if test -n "$version_suffix"; then
+  maybe_version_suffix='"suffix": "'"$version_suffix"'",'
+else
+  maybe_version_suffix=''
+fi
+readonly maybe_version_suffix
+
+readonly files_v1_in="${BASH_SOURCE%/*}/files-v1.json.in"
+sed "
+  s/@version@/$version/g
+  s/@version_major@/$version_major/g
+  s/@version_minor@/$version_minor/g
+  s/@version_patch@/$version_patch/g
+  s/@maybe_version_suffix@/$maybe_version_suffix/g
+" "$files_v1_in" \
+  | jq . \
+  > "cmake-$version-files-v1.json"
+
+readonly algos='
+  256
+'
+for algo in $algos; do
+  shasum -a $algo \
+    "cmake-$version-files-v1.json" \
+    $(jq -r '.files[].name' "cmake-$version-files-v1.json") \
+  | LC_ALL=C sort -k 2 \
+  > "cmake-$version-SHA-$algo.txt"
+done
index 65ea691..9d1aa49 100644 (file)
@@ -173,7 +173,7 @@ arc4_init(void)
 }
 
 static inline void
-arc4_addrandom(u_char *dat, int datlen)
+arc4_addrandom(uint8_t *dat, int datlen)
 {
        int     n;
        uint8_t si;
@@ -196,7 +196,7 @@ arc4_stir(void)
        struct {
                struct timeval  tv;
                pid_t           pid;
-               u_char          rnd[KEYSIZE];
+               uint8_t         rnd[KEYSIZE];
        } rdat;
 
        if (!rs_initialized) {
@@ -216,7 +216,7 @@ arc4_stir(void)
                /* We'll just take whatever was on the stack too... */
        }
 
-       arc4_addrandom((u_char *)&rdat, KEYSIZE);
+       arc4_addrandom((uint8_t *)&rdat, KEYSIZE);
 
        /*
         * Discard early keystream, as per recommendations in:
@@ -258,7 +258,7 @@ arc4_getbyte(void)
 static void
 arc4random_buf(void *_buf, size_t n)
 {
-       u_char *buf = (u_char *)_buf;
+       uint8_t *buf = (uint8_t *)_buf;
        _ARC4_LOCK();
        arc4_stir_if_needed();
        while (n--) {