diff options
-rw-r--r-- | .gitlab/ci/docker/debian10/Dockerfile | 15 | ||||
-rwxr-xr-x | .gitlab/ci/docker/debian10/install_iwyu.sh | 2 | ||||
-rw-r--r-- | .gitlab/ci/docker/fedora37/Dockerfile | 21 | ||||
-rw-r--r-- | .gitlab/os-linux.yml | 4 | ||||
-rw-r--r-- | Help/command/execute_process.rst | 74 | ||||
-rw-r--r-- | Help/manual/cmake.1.rst | 4 | ||||
-rw-r--r-- | Modules/CheckFortranSourceCompiles.cmake | 12 | ||||
-rw-r--r-- | Modules/CheckFortranSourceRuns.cmake | 10 | ||||
-rw-r--r-- | Modules/CheckSourceCompiles.cmake | 30 | ||||
-rw-r--r-- | Modules/CheckSourceRuns.cmake | 30 | ||||
-rw-r--r-- | Modules/FindCUDAToolkit.cmake | 2 |
11 files changed, 123 insertions, 81 deletions
diff --git a/.gitlab/ci/docker/debian10/Dockerfile b/.gitlab/ci/docker/debian10/Dockerfile index 34a4bf1..2d3ae3a 100644 --- a/.gitlab/ci/docker/debian10/Dockerfile +++ b/.gitlab/ci/docker/debian10/Dockerfile @@ -1,10 +1,10 @@ -FROM debian:10 as iwyu-build +FROM debian:10 AS iwyu-build MAINTAINER Ben Boeckel <ben.boeckel@kitware.com> COPY install_iwyu.sh /root/install_iwyu.sh RUN sh /root/install_iwyu.sh -FROM debian:10 as rvm-build +FROM debian:10 AS rvm-build MAINTAINER Ben Boeckel <ben.boeckel@kitware.com> COPY install_rvm.sh /root/install_rvm.sh @@ -16,10 +16,9 @@ MAINTAINER Ben Boeckel <ben.boeckel@kitware.com> COPY install_deps.sh /root/install_deps.sh RUN sh /root/install_deps.sh -COPY --from=iwyu-build /root/iwyu.tar.gz /root/iwyu.tar.gz -RUN tar -C / -xf /root/iwyu.tar.gz -RUN ln -s /usr/lib/llvm-6.0/bin/include-what-you-use /usr/bin/include-what-you-use-6.0 +RUN --mount=type=bind,from=iwyu-build,source=/root,target=/root \ + tar -C / -xf /root/iwyu.tar \ + && ln -s /usr/lib/llvm-6.0/bin/include-what-you-use /usr/bin/include-what-you-use-6.0 -COPY --from=rvm-build /root/rvm.tar /root/rvm.tar -RUN tar -C /usr/local -xf /root/rvm.tar \ - && rm /root/rvm.tar +RUN --mount=type=bind,from=rvm-build,source=/root,target=/root \ + tar -C /usr/local -xf /root/rvm.tar diff --git a/.gitlab/ci/docker/debian10/install_iwyu.sh b/.gitlab/ci/docker/debian10/install_iwyu.sh index 54d26ef..260570e 100755 --- a/.gitlab/ci/docker/debian10/install_iwyu.sh +++ b/.gitlab/ci/docker/debian10/install_iwyu.sh @@ -29,4 +29,4 @@ cmake -GNinja \ .. ninja DESTDIR=/root/iwyu-destdir ninja install -tar -C /root/iwyu-destdir -cf /root/iwyu.tar.gz . +tar -C /root/iwyu-destdir -cf /root/iwyu.tar . diff --git a/.gitlab/ci/docker/fedora37/Dockerfile b/.gitlab/ci/docker/fedora37/Dockerfile index 13ef9aa..1ba9e37 100644 --- a/.gitlab/ci/docker/fedora37/Dockerfile +++ b/.gitlab/ci/docker/fedora37/Dockerfile @@ -1,4 +1,4 @@ -FROM fedora:37 as rvm-build +FROM fedora:37 AS rvm-build MAINTAINER Ben Boeckel <ben.boeckel@kitware.com> COPY install_rvm.sh /root/install_rvm.sh @@ -10,7 +10,7 @@ MAINTAINER Kyle Edwards <kyle.edwards@kitware.com> COPY install_clang_tidy_headers.sh /root/install_clang_tidy_headers.sh RUN sh /root/install_clang_tidy_headers.sh -FROM fedora:37 AS iwyu +FROM fedora:37 AS iwyu-build MAINTAINER Kyle Edwards <kyle.edwards@kitware.com> COPY install_iwyu.sh /root/install_iwyu.sh @@ -22,12 +22,11 @@ MAINTAINER Ben Boeckel <ben.boeckel@kitware.com> COPY install_deps.sh /root/install_deps.sh RUN sh /root/install_deps.sh -COPY --from=rvm-build /root/rvm.tar /root/rvm.tar -RUN tar -C /usr/local -xf /root/rvm.tar \ - && rm /root/rvm.tar -COPY --from=clang-tidy-headers /root/clang-tidy-headers.tar /root/clang-tidy-headers.tar -RUN tar -C /usr/include -xf /root/clang-tidy-headers.tar \ - && rm /root/clang-tidy-headers.tar -COPY --from=iwyu /root/iwyu.tar /root/iwyu.tar -RUN tar -C / -xf /root/iwyu.tar \ - && rm /root/iwyu.tar +RUN --mount=type=bind,from=rvm-build,source=/root,target=/root \ + tar -C /usr/local -xf /root/rvm.tar + +RUN --mount=type=bind,from=clang-tidy-headers,source=/root,target=/root \ + tar -C /usr/include -xf /root/clang-tidy-headers.tar + +RUN --mount=type=bind,from=iwyu-build,source=/root,target=/root \ + tar -C / -xf /root/iwyu.tar diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index c00c4aa..9d7be0e 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -45,7 +45,7 @@ ### Debian .debian10: - image: "kitware/cmake:ci-debian10-x86_64-2023-01-26" + image: "kitware/cmake:ci-debian10-x86_64-2023-02-06" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" @@ -69,7 +69,7 @@ ### Fedora .fedora37: - image: "kitware/cmake:ci-fedora37-x86_64-2023-01-26" + image: "kitware/cmake:ci-fedora37-x86_64-2023-02-06" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes" diff --git a/Help/command/execute_process.rst b/Help/command/execute_process.rst index 5cfeeab..98430c5 100644 --- a/Help/command/execute_process.rst +++ b/Help/command/execute_process.rst @@ -32,6 +32,11 @@ Commands are executed concurrently as a pipeline, with the standard output of each process piped to the standard input of the next. A single standard error pipe is used for all processes. +``execute_process`` runs commands while CMake is configuring the project, +prior to build system generation. Use the :command:`add_custom_target` and +:command:`add_custom_command` commands to create custom commands that run +at build time. + Options: ``COMMAND`` @@ -51,8 +56,8 @@ Options: (Use the ``INPUT_*``, ``OUTPUT_*``, and ``ERROR_*`` options to redirect stdin, stdout, and stderr.) - If a sequential execution of multiple commands is required, use multiple - ``execute_process`` calls with a single ``COMMAND`` argument. + For **sequential execution** of multiple commands use multiple + ``execute_process`` calls each with a single ``COMMAND`` argument. ``WORKING_DIRECTORY`` The named directory will be set as the current working directory of @@ -76,22 +81,46 @@ Options: given ``COMMAND`` arguments. Each entry will be an integer return code from the corresponding child or a string describing an error condition. +``INPUT_FILE <file>`` + ``<file>`` is attached to the standard input pipe of the *first* ``COMMAND`` + process. + +``OUTPUT_FILE <file>`` + ``<file>`` is attached to the standard output pipe of the *last* ``COMMAND`` + process. + +``ERROR_FILE <file>`` + ``<file>`` is attached to the standard error pipe of *all* ``COMMAND`` + processes. + +.. versionadded:: 3.3 + If the same ``<file>`` is named for both ``OUTPUT_FILE`` and ``ERROR_FILE`` + then it will be used for both standard output and standard error pipes. + +``OUTPUT_QUIET``, ``ERROR_QUIET`` + The standard output on ``OUTPUT_VARIABLE`` or standard error on + ``ERROR_VARIABLE`` are not connected (no variable content). + The ``*_FILE`` and ``ECHO_*_VARIABLE`` options are not affected. + ``OUTPUT_VARIABLE``, ``ERROR_VARIABLE`` The variable named will be set with the contents of the standard output and standard error pipes, respectively. If the same variable is named for both pipes their output will be merged in the order produced. -``INPUT_FILE, OUTPUT_FILE``, ``ERROR_FILE`` - The file named will be attached to the standard input of the first - process, standard output of the last process, or standard error of - all processes, respectively. +``ECHO_OUTPUT_VARIABLE``, ``ECHO_ERROR_VARIABLE`` + .. versionadded:: 3.18 + + The standard output or standard error will not be exclusively redirected to + the specified variables. - .. versionadded:: 3.3 - If the same file is named for both output and error then it will be used - for both. + The output will be duplicated into the specified variables and also onto + standard output or standard error analogous to the ``tee`` Unix command. -``OUTPUT_QUIET``, ``ERROR_QUIET`` - The standard output or standard error results will be quietly ignored. +.. note:: + If more than one ``OUTPUT_*`` or ``ERROR_*`` option is given for the + same pipe the precedence is *not specified*. + If no ``OUTPUT_*`` or ``ERROR_*`` options are given the output will + be shared with the corresponding pipes of the CMake process itself. ``COMMAND_ECHO <where>`` .. versionadded:: 3.15 @@ -126,17 +155,6 @@ Options: Accept ``UTF-8`` spelling for consistency with the `UTF-8 RFC <https://www.ietf.org/rfc/rfc3629>`_ naming convention. -``ECHO_OUTPUT_VARIABLE``, ``ECHO_ERROR_VARIABLE`` - .. versionadded:: 3.18 - - The standard output or standard error will not be exclusively redirected to - the configured variables. - - The output will be duplicated, it will be sent into the configured variables - and also on standard output or standard error. - - This is analogous to the ``tee`` Unix command. - ``COMMAND_ERROR_IS_FATAL <ANY|LAST>`` .. versionadded:: 3.19 @@ -151,15 +169,3 @@ Options: If the last command in the list of commands fails, the ``execute_process()`` command halts with an error. Commands earlier in the list will not cause a fatal error. - -If more than one ``OUTPUT_*`` or ``ERROR_*`` option is given for the -same pipe the precedence is not specified. -If no ``OUTPUT_*`` or ``ERROR_*`` options are given the output will -be shared with the corresponding pipes of the CMake process itself. - -The :command:`execute_process` command is a newer more powerful version of -:command:`exec_program`, but the old command has been kept for compatibility. -Both commands run while CMake is processing the project prior to build -system generation. Use :command:`add_custom_target` and -:command:`add_custom_command` to create custom commands that run at -build time. diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 9f77562..e48ecd9 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -1080,10 +1080,6 @@ Available commands are: situations instead. Use ``--`` to stop interpreting options and treat all remaining arguments as paths, even if they start with ``-``. -.. option:: server - - Launch :manual:`cmake-server(7)` mode. - .. option:: sleep <number>... .. versionadded:: 3.0 diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake index e134329..8dcc1d5 100644 --- a/Modules/CheckFortranSourceCompiles.cmake +++ b/Modules/CheckFortranSourceCompiles.cmake @@ -19,18 +19,22 @@ Check if given Fortran source compiles and links into an executable. ) Checks that the source supplied in ``<code>`` can be compiled as a Fortran - source file and linked as an executable. The ``<code>`` must be a Fortran program - containing at least an ``end`` statement--for example: + source file and linked as an executable. The ``<code>`` must be a Fortran + ``program``. .. code-block:: cmake - check_fortran_source_compiles("character :: b; error stop b; end" F2018ESTOPOK SRC_EXT F90) + check_fortran_source_compiles("program test + error stop + end program" + HAVE_ERROR_STOP + SRC_EXT .F90) This command can help avoid costly build processes when a compiler lacks support for a necessary feature, or a particular vendor library is not compatible with the Fortran compiler version being used. This generate-time check may advise the user of such before the main build process. See also the - :command:`check_fortran_source_runs` command to actually run the compiled code. + :command:`check_fortran_source_runs` command to run the compiled code. The result will be stored in the internal cache variable ``<resultVar>``, with a boolean true value for success and boolean diff --git a/Modules/CheckFortranSourceRuns.cmake b/Modules/CheckFortranSourceRuns.cmake index 28f713f..985c765 100644 --- a/Modules/CheckFortranSourceRuns.cmake +++ b/Modules/CheckFortranSourceRuns.cmake @@ -18,12 +18,16 @@ subsequently be run. [SRC_EXT <extension>]) Check that the source supplied in ``<code>`` can be compiled as a Fortran source - file, linked as an executable and then run. The ``<code>`` must be a Fortran program - containing at least an ``end`` statement--for example: + file, linked as an executable and then run. The ``<code>`` must be a Fortran + ``program``. .. code-block:: cmake - check_fortran_source_runs("real :: x[*]; call co_sum(x); end" F2018coarrayOK) + check_fortran_source_runs("program test + real :: x[*] + call co_sum(x) + end program" + HAVE_COARRAY) This command can help avoid costly build processes when a compiler lacks support for a necessary feature, or a particular vendor library is not compatible with diff --git a/Modules/CheckSourceCompiles.cmake b/Modules/CheckSourceCompiles.cmake index ad74c3c..9788798 100644 --- a/Modules/CheckSourceCompiles.cmake +++ b/Modules/CheckSourceCompiles.cmake @@ -19,17 +19,34 @@ Check if given source compiles and links into an executable. [SRC_EXT <extension>]) Check that the source supplied in ``<code>`` can be compiled as a source - file for the requested language and linked as an executable (so it must - contain at least a ``main()`` function). The result will be stored in the - internal cache variable specified by ``<resultVar>``, with a boolean true - value for success and boolean false for failure. If ``FAIL_REGEX`` is - provided, then failure is determined by checking if anything in the output - matches any of the specified regular expressions. + file for the requested language and linked as an executable. The result + will be stored in the internal cache variable specified by ``<resultVar>``, + with a boolean true value for success and boolean false for failure. If + ``FAIL_REGEX`` is provided, then failure is determined by checking if + anything in the compiler output matches any of the specified regular + expressions. By default, the test source file will be given a file extension that matches the requested language. The ``SRC_EXT`` option can be used to override this with ``.<extension>`` instead. + The ``<code>`` must contain a valid main program. For example: + + .. code-block:: cmake + + check_source_compiles(C + "#include <stdlib.h> + #include <stdnoreturn.h> + noreturn void f(){ exit(0); } + int main(void) { f(); return 1; }" + HAVE_NORETURN) + + check_source_compiles(Fortran + "program test + error stop + end program" + HAVE_ERROR_STOP) + The underlying check is performed by the :command:`try_compile` command. The compile and link commands can be influenced by setting any of the following variables prior to calling ``check_source_compiles()``: @@ -73,7 +90,6 @@ Check if given source compiles and links into an executable. #]=======================================================================] - include_guard(GLOBAL) include(Internal/CheckSourceCompiles) diff --git a/Modules/CheckSourceRuns.cmake b/Modules/CheckSourceRuns.cmake index 8f1cf01..e2fa579 100644 --- a/Modules/CheckSourceRuns.cmake +++ b/Modules/CheckSourceRuns.cmake @@ -20,22 +20,40 @@ subsequently be run. Check that the source supplied in ``<code>`` can be compiled as a source file for the requested language, linked as an executable and then run. - The ``<code>`` must contain at least a ``main()`` function. If the ``<code>`` - could be built and run successfully, the internal cache variable specified by - ``<resultVar>`` will be set to 1, otherwise it will be set to an value that - evaluates to boolean false (e.g. an empty string or an error message). + If the ``<code>`` could be built and run successfully, the internal cache variable + specified by ``<resultVar>`` will be set to 1, otherwise it will be set to + a value that evaluates to boolean false (e.g. an empty string or an error + message). By default, the test source file will be given a file extension that matches the requested language. The ``SRC_EXT`` option can be used to override this with ``.<extension>`` instead. + The ``<code>`` must contain a valid main program. For example: + + .. code-block:: cmake + + check_source_runs(C + "#include <stdlib.h> + #include <stdnoreturn.h> + noreturn void f(){ exit(0); } + int main(void) { f(); return 1; }" + HAVE_NORETURN) + + check_source_runs(Fortran + "program test + real :: x[*] + call co_sum(x) + end program" + HAVE_COARRAY) + The underlying check is performed by the :command:`try_run` command. The compile and link commands can be influenced by setting any of the following - variables prior to calling ``check_objc_source_runs()``: + variables prior to calling ``check_source_runs()``: ``CMAKE_REQUIRED_FLAGS`` Additional flags to pass to the compiler. Note that the contents of - :variable:`CMAKE_OBJC_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated + :variable:`CMAKE_<LANG>_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated configuration-specific variable are automatically added to the compiler command before the contents of ``CMAKE_REQUIRED_FLAGS``. diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index cd44cc6..c3b6bc3 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -1122,7 +1122,7 @@ if(CUDAToolkit_FOUND) _CUDAToolkit_find_and_add_import_lib(nvrtc_builtins DEPS cuda_driver) _CUDAToolkit_find_and_add_import_lib(nvrtc DEPS nvrtc_builtins nvJitLink) if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.5.0) - _CUDAToolkit_find_and_add_import_lib(nvrtc_builtins_static DEPS cuda_driver) + _CUDAToolkit_find_and_add_import_lib(nvrtc_builtins_static ALT nvrtc-builtins_static DEPS cuda_driver) _CUDAToolkit_find_and_add_import_lib(nvrtc_static DEPS nvrtc_builtins_static nvptxcompiler_static nvJitLink_static) endif() |