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`.
Before calling pkg_check_modules, modules must check PKG_CONFIG_FOUND.
When FindPkgConfig.cmake is loaded, pkg_check_modules is always defined
regardless of pkg-config being present. However, the whole module might
be disabled on user request with CMAKE_DISABLE_FIND_PACKAGE_PkgConfig.
This must not break Find modules which just look for a hint or similar.
The BLA_PREFER_PKGCONFIG switch is not that useful if you are not able
to specify the pkg-config package to use. This adds BLA_PKGCONFIG_BLAS
and BLA_PKGCONFIG_LAPACK to that effect, allowing user choice in
environments that install differing variants of the BLAS libraries
with distinct .pc file names.
This is part of work to get more standardized installations of the
BLAS libs with specific names, likely blas.pc and lapack.pc only
for Netlib reference code, or maybe blas-netlib.pc and lapack-netlib.pc,
in any case distinct from choices like openblas-openmp.pc.
The `find_package(OpenMP)` calls added/updated by:
* commit f7f3d8987a (FindBLAS: Add dependency of OpenBLAS on OpenMP for
BLA_STATIC, 2020-11-10, v3.20.0-rc1~492^2)
* commit 9ef82d95d8 (FindBLAS: Fix detection of OpenMP as dependency of
BLA_STATIC, 2021-04-07, v3.20.1~3^2)
were missing the `QUIET` option.
Fixes: #23000
Divert LCC compiler as a new one, instead of treating it as GNU.
Since old times, Elbrus C/C++/Fortran Compiler (LCC) by MCST has been
passing checks for GNU compilers, so it has been identified as GNU.
Now, with intent of seriously upstreaming its support, it has been
added as a separate LCC compiler, and its version displays not a
supported GCC version, but LCC version itself (e.g. LCC 1.25.19 instead
of GNU 7.3.0).
This commit adds its support for detection, and also converts basically
every check like 'is this compiler GNU?' to 'is this compiler GNU or
LCC?'. The only places where this check is untouched, is where it
regards other platforms where LCC is unavailable (primarily non-Linux),
and where it REALLY differs from GNU compiler.
Note: this transition may break software that are already ported to
Elbrus, but hardly relies that LCC will be detected as GNU; still such
software is not known.
With Cray compiler wrappers (implicitly tested on OLCF Spock) the
BLAS and LAPACK libraries are automatically linked as necessary through
the wrapper script and programming environment. With this change, the
configure output is:
```
-- Found BLAS: implicitly linked
<snip>
-- Found LAPACK: implicitly linked
```
rather than
```
-- Found BLAS: 1
<snip>
-- Found LAPACK: LAPACK_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES
```
Logic added by commit 4c74c86f40 (FindBLAS/LAPACK: Add support for the
Fujitsu SSL2 library, 2021-01-27, v3.21.0-rc1~402^2~1) accidentally
expressed a boolean condition without proper grouping. The pattern was
then copied by commit 2c9e623e31 (Find{BLAS,LAPACK}: Add support for the
NVHPC LAPACK library, 2021-05-05, v3.21.0-rc1~192^2). The resulting
logic incorrectly tries Fujitsu and NVHPC vendors even after results are
found from another vendor, and then erases those. Fix the grouping.
Fixes: #22403
Since commit 20ab504591 (FindBLAS: Do not statically link against iomp5
in the case of Intel MKL, 2021-04-11), we no longer find MKL's BLAS when
using the GNU compiler because FindOpenMP chooses libgomp instead of
libiomp5, and mkl_intel_thread depends on the latter. Revert the change
for now. A new approach will be needed to solve the original problem.
Issue: #21811
Now that `CHECK_{BLAS,LAPACK}_LIBRARIES` are functions, we can set
`CMAKE_FIND_LIBRARY_SUFFIXES` locally without affecting the global
state. This avoids the need for local state switching that was added in
commit 9ef82d95d8 (FindBLAS: Fix detection of OpenMP as dependency of
BLA_STATIC, 2021-04-07, v3.20.1~3^2), so remove that.