To avoid issues with multi-line scripts, regexes that match
unquoted shell command arguments shouldn't include newlines.
Fixes: #12553
Co-authored-by: K. R. Walker
Since commit d74210a8bd (CMP0017: Remove support for OLD behavior,
2024-11-17) we can rely on CMP0017's NEW behavior unconditionally.
Calling `include(FindPackageHandleStandardArgs)` in a builtin module
will always get the builtin `FindPackageHandleStandardArgs`.
Covers almost all blocks containing actual code, except:
* Parsed-literal blocks can't be highlighted, including many command
summaries and substitution-heavy docs like find_... commands.
This is a Sphinx limitation.
* Code with errors, like CMP0049, DEPLOYMENT_ADDITIONAL_FILES,
DEPLOYMENT_REMOTE_DIRECTORY, @PACKAGE_INIT@ substitution in the
tutorial, bracket arguments/comments in cmake-language.7 and
cmake-developer.7.
* FindQt4 module, which needs reformatting.
77f71ad4e2 Remove compatibility with CMake versions older than 3.5
fb1bd1d330 CMP0065: Remove support for OLD behavior
d9dd38cccf CMP0064: Remove support for OLD behavior
d88047c329 Remove compatibility with CMake versions older than 3.3
ac1a9cb160 CMP0063: Remove support for OLD behavior
36fffb673a CMP0062: Remove support for OLD behavior
789a7d73d4 CMP0061: Remove support for OLD behavior
3dc19e24cb CMP0060: Remove support for OLD behavior
...
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10210
In commit 5e700411d2 (FindMPI: add IntelLLVM MPI wrappers, 2024-01-19,
v3.29.0-rc1~92^2) we added `mpiicpx.bat` for C++ on Windows, but that is
a GNU-like front-end that we do not yet support. Use `mpiicx.bat` for
both C and C++ on Windows, just as we use `icx` to compile both.
Fixes: #25807
`try_compile` and `try_run` now automatically log checks using them to
`CMakeConfigureLog.yaml`.
Add `LOG_DESCRIPTION` arguments to some `try_compile` calls to
replace the description previously written to the old logs.
Issue: #23200
Modify some additional modules that ship with CMake to use the new
SOURCES_FROM_* arguments to try_compile / try_run as added by commits
cb14ae2b87 (try_compile: Add SOURCE_FROM_{ARG,VAR}, 2022-09-21) and
611d801790 (try_compile: Add SOURCE_FROM_FILE, 2022-09-22). This covers
modules that need to read and alter a template source file, which were
not addressed in the previous commit.
Note that FindOpenACC.cmake does not actually need configure_file
functionality; it appears to have inherited the (gratuitous) use thereof
from FindOpenMP.cmake, with which its code bears significant similarity.
Modify most of the modules that ship with CMake to use the new
try_compile / try_run signatures added by commit aa9220d3a0
(try_compile: Add keyword-dispatched signature, 2022-09-02). This
improves debugging by each invocation using its own directory so that
the results of multiple invocations can be retained.
This does not cover any invocations which provide an entire project, as
that flavor of try_compile has not yet been updated.
In commit 0723b2c935 (MPI: Add fallback detection code for MPI when cross
compiling, 2021-09-17, v3.22.0-rc1~89^2) the FindPkgConfig module was
included directly. This produces warnings like:
The package name passed to `find_package_handle_standard_args` (PkgConfig)
does not match the name of the calling package (MPI).
Use `find_package(PkgConfig)` instead, as other find modules do.
Fixes: #22823
The MPI libraries use a compiler wrapper to automatically inject
required flags and libraries into the compiler argument list. However,
the wrapper does not support cross-compiling: the wrapper will try to
invoke the native compiler which cannot handle the cross architecture
MPI libraries and fail.
This MR adds some fallback code for this case, which tries to bypass the
faulty wrapper and determine the necessary flags and libraries directly
from the MPI pkg-config files. The patch tries to be as unintrusive as
possible and should not break any existing use-cases.
Fixes: #22650
2b2a6a7170 FindMPI: do not detect `-framework` as a compile flag
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Utkarsh Ayachit <utkarsh.ayachit@kitware.com>
Merge-request: !6467
MPICH 3.4.2 now reports `-framework OpenCL` as one of its compilation
flag. The compile flag extraction is seeing it as a generic `-f` flag
and misses its argument. This ends up with a compile option of
`-framework` which eats the next flag (and may be very important).
It does not seem that passing `-framework` as a link flag is necessary
at this time, so that is being actively ignored for now.
Fixes: #22555
Cray traditionally does not ship mpicc/mpic++ compiler wrappers.
Due to that, the traditional CMake logic to find MPI is to *only*
support MPI on Cray systems if either
1. Cray Wrappers are used for compiling, or
2. an auxiliary MPI executable is found.
On many new Exascale prototypes, using the Cray wrappers for develop
work is extremely painful. Vendors such as AMD and integrators such
as HPE seem not to go well in lock-step in Cray programming envs,
making offloading with Cray wrappers too challenging. On the other
hand, using the working experimental Vendor compilers works well,
as long as one does not need MPI.
Extend the fallback MPI search logic by also interrogating the
CC/cc/ftn binaries if found for their MPI flags. This does not
change existing logic, i.e. using the Cray wrappers directly, but
provides an additional way to get MPI programs compiled on Cray.
Fixes: #22368
Express the cache entry with `option()`. In combination with policies
CMP0077 and CMP0102, this allows project code to control the switch with
a variable:
```
set(MPI_CXX_SKIP_MPICXX TRUE)
find_package(MPI COMPONENTS CXX)
```
666f689e48 FindMPI: avoid host link options to be propagated to device link step
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !5966
In pure C/CXX projects, when doing an optional search for C/CXX
MPI APIs, I keep getting a reason appended of the form:
```
-- Could NOT find MPI_C (missing: MPI_C_LIB_NAMES MPI_C_HEADER_DIR MPI_C_WORKS)
-- Could NOT find MPI_CXX (missing: MPI_CXX_LIB_NAMES MPI_CXX_HEADER_DIR MPI_CXX_WORKS)
-- Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND)
Reason given by package: MPI component 'Fortran' was requested, but language Fortran is not enabled.
```
The reason makes no sense since I did not request Fortran and thus
confuses the reader. It is now only added if the component was truly
requested.
Fix a regression with MPI and CUDA<10.2 that did let `-pthread` flags
slip to nvcc again. In commit b725a19072 (FindMPI: Deny -fexceptions
from NVCC, 2020-07-02, v3.18.0-rc4~12^2) we accidentally forgot to use
the variable containing the replacement result.
Fixes: #21108
Currently CMake passes `-Xcompiler -pthread` flags to CUDA compilers
irrespective of the actual CUDA compiler ID. This makes sure the
additional `-Xcompiler` flag is only used with nvcc.