Commit Graph

109 Commits

Author SHA1 Message Date
Kitware Robot
1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05:00
John Rodgers
3b18fa9e8b Cray: Fix OpenMP linking issue
Add the `CrayClang` compiler ID to the list of OpenMP flag candidates and
ensure the flags are propagated to the link step to trigger the Cray OpenMP
offload linker (`cce_omp_offload_linker`) wrapper.

Fixes: #24402, #24962
2025-02-14 12:54:49 -06:00
Brad King
7afa58b15d Modules/Find*: Include FindPackageHandleStandardArgs normally
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`.
2025-01-30 08:53:12 -05:00
Brad King
c283aafe62 CMP0057: Remove support for OLD behavior 2025-01-22 10:40:53 -05:00
Brad King
90d814f024 CMP0054: Remove support for OLD behavior 2025-01-20 09:46:55 -05:00
Brad King
98a59ba8ad CMP0012: Remove support for OLD behavior 2025-01-17 09:28:36 -05:00
Peter Kokot
1a8e43d57d
FindPackageHandleStandardArgs: Clarify the FOUND_VAR option
The `find_package_handle_standard_args(FOUND_VAR)` is deprecated as of
CMake 3.3 and both the `<PackageName>_FOUND` and the upper-cased
`<PACKAGE_NAME>_FOUND` are set with or without using this option.
Additionally, find modules and docs are also synced with this to make it
clearer.
2024-12-31 02:07:16 +01:00
مهدي شينون (Mehdi Chinoune)
3c3f887ff6 FindOpenMP: Fix typo on omp Fortran module name. 2024-12-03 13:42:18 -05:00
مهدي شينون (Mehdi Chinoune)
c3bada79cd FindOpenMP: Fix Finding OpenMP for LLVMFlang on Windows. 2024-11-29 12:11:44 +01:00
Brad King
a4b60d948d FindOpenMP: Add support for CUDA when compiling with Clang 2024-10-07 14:19:08 -04:00
Brad King
8f4cea94da FindOpenMP: Add support for CUDA when supported by the toolchain
NVCC supports OpenMP on the host when the host compiler does.
2024-09-27 16:45:24 -04:00
Brad King
f8ed4d7c21 FindOpenMP: Factor out compiler id lookup 2024-09-27 09:55:47 -04:00
Brad King
534923428a FindOpenMP: Simplify compiler driver check
The compiler driver's verbose flag is needed only when linking because
we parse its output to get the implicit link information added by the
OpenMP flag.
2024-09-27 09:55:47 -04:00
Brad King
42bf0f596e FindOpenMP: Simplify explicit "omp" library checks
For toolchains that do not provide a builtin `omp` library the compiler
driver's OpenMP flag should not be needed when linking.  We also do not
need the compiler driver's verbose flag because we are not parsing its
output.
2024-09-27 09:55:47 -04:00
Axel Huebl
b07c637e42 FindOpenMP: Add option to control OpenMP runtime with MSVC
The MSVC compiler's `-openmp` flag accepts `:{experimental,llvm}`
values.  Add an option to specify one.

Closes: #25570
2024-05-01 08:25:14 -04:00
Juan Ramos
3cd64287fe Modules: Fix CMP0159 warnings in modules when tracing
Closes: #25829
2024-03-29 13:51:59 -07:00
Brad King
d427bfae61 FindOpenMP: Restore support for Intel compilers on Windows
Fix the condition added by commit 3019af64c2 (FindOpenMP: Add support
for GNU-like Clang targeting MSVC ABI, 2024-02-08, v3.29.0-rc1~8^2~1)
to be more specific.

Fixes: #25711
2024-02-23 09:37:03 -05:00
Markus Mützel
3019af64c2 FindOpenMP: Add support for GNU-like Clang targeting MSVC ABI
Use the code path from commit ceb5ee4a7b (FindOpenMP: Add support for
Clang on Windows, 2020-02-05, v3.17.0-rc1~10^2) with the GNU-like
frontend too.
2024-02-08 17:35:55 -05:00
Brad King
a440c65129 Merge topic 'FindOpenMP-5.1-and-5.2'
2859be7575 FindOpenMP: Add support for openmp 5.1 (llvm 17) and 5.2

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Markus Mützel <markus.muetzel@gmx.de>
Merge-request: !8965
2023-11-14 09:04:55 -05:00
Christoph Reiter
2859be7575 FindOpenMP: Add support for openmp 5.1 (llvm 17) and 5.2
llvm 17 now defaults to openmp 5.1; see LLVM commit `0c6f2f629cc0`.
It makes FindOpenMP set OPENMP_FOUND and OpenMP_C_SPEC_DATE, but not
OpenMP_C_VERSION, because it doesn't know the version mapping.
Add the spec date to the version mapping for 5.1 and 5.2 to make
things work again.
2023-11-13 10:51:40 -05:00
Keno Fischer
3cff031c9a FindOpenMP: Handle non-Apple clang on macOS
I was noticing that FindOpenMP was failing to find my openmp installation
on macos when building with a custom-compiled clang. Upon inspection it
appears that FindOpenMP is looking for `AppleClang` as a compiler
identification and the `Clang` case is only applicable for Win32.
Try to fix that by treating custom `Clang` on macos the same as
`AppleClang`.
2023-09-24 19:28:58 +02:00
Brad King
56ff12501f FindOpenMP: Keep flags together in imported target usage requirements
If `OpenMP_C_FLAGS` contains `-Xclang -fopenmp`, the flag pair needs to
be preserved as a shell command fragment, and must not be split by
de-duplication with other `target_compile_options`.

Fixes: #24966
2023-06-01 15:18:33 -04:00
Andrey Alekseenko
6e53d74147 FindOpenMP: Use OpenMP_<lang>_INCLUDE_DIR
If `OpenMP_<lang>_INCLUDE_DIR` is defined, add it to the list of include
directories before checking flags. Previously, this variable was
ignored for all compilers but AppleClang, despite the documentation
mentioning it as one of the possible inputs.

Fixes: #24260
2023-01-23 19:37:26 +01:00
Brad King
f6ed2585e5 Modules: Record system inspection steps in the configure log
Replace old-style `file(APPEND .../CMake{Output,Error}.log)` logging
with calls to `message(CONFIGURE_LOG)` to record the steps in the
`CMakeConfigureLog.yaml` configure log instead.

Issue: #23200
2023-01-18 17:59:10 -05:00
Brad King
0f688386ea Modules: Drop redundant check logging to CMakeOutput.log and CMakeError.log
`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
2023-01-18 16:41:01 -05:00
Matthew Woehlke
41f7b1169a Modules: Use new SOURCES_FROM_* try_compile (2/2)
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.
2022-09-27 13:29:52 -04:00
Matthew Woehlke
2edf0fc6d7 Modules: Use new keyword-dispatched try_compile signature
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.
2022-09-14 07:52:16 -04:00
Brad King
138337f53c Merge topic 'implicit-link-info-msvc'
93f2cd5b7c CMakeParseImplicitLinkInfo: Better detection of msvc

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7619
2022-09-06 09:02:05 -04:00
Robert Maynard
93f2cd5b7c CMakeParseImplicitLinkInfo: Better detection of msvc
Use the compiler id information in addition to checking for `cl.exe`.
2022-09-02 08:04:39 -04:00
Brad King
52dec3f11f Merge topic 'enable-intel-llvm-ipo-3'
c633bd76d8 Add linker prefix for "-stack" flag on MSVC builds
6823db0c5a Enable IPO for IntelLLVM compilers on Linux and Windows
adbffd204d Propagate OpenMP compiler flags to linker for IntelLLVM
3640842df2 Tests: Update ModuleDefinition for IntelLLVM MSVC Frontend Variant
5d5a712303 IntelLLVM: Pass linker flags to the compiler when used as linker

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7533
2022-08-04 09:37:47 -04:00
William R. Dieter
adbffd204d Propagate OpenMP compiler flags to linker for IntelLLVM
When compiling for offload and in general when OpenMP is enabled while
compiling, it should also be enabled when linking.

Signed-off-by: William R. Dieter <william.r.dieter@intel.com>
2022-08-01 19:34:49 -04:00
Sprite
09b4e870a5 FindOpenMP: Restore searching system paths
In commit 98314d536e (FindOpenMP: Use NO_DEFAULT_PATH where appropriate,
2017-11-15, v3.11.0-rc1~334^2) we added `NO_DEFAULT_PATH` so that it no
longer searches in `CMAKE_PREFIX_PATH`, but this also excludes searching
in system paths, which are needed on RISC-V platforms.  Use more granular
exclusions instead.

Fixes: #23469
2022-08-01 10:25:10 -04:00
Balthasar Reuter
878655384e FindOpenMP: Do not overwrite user-set FLAGS, LIB_NAMES
Since commit 2dbff623f9 (FindOpenMP: Save flags/libs in cache entries
each time they are detected, 2020-02-07, v3.17.0-rc1~10^2~1) we replace
both `OpenMP_${LANG}_FLAGS` and `OpenMP_${LANG}_LIB_NAMES` with detected
flags if either one is not set.  That can overwrite user-provided flags.

Update the logic for C, CXX, and Fortran to initialize each
`OpenMP_${LANG}_{FLAGS,LIB_NAMES}` variable only if it has not already
been set by the user.

Fixes: #23743
2022-07-20 12:21:38 -04:00
makise-homura
0eea1e8563 LCC: for OpenMP, collectly determine implicit link dirs
It is found out for LCC to not specify all library search paths
when called by cmake_parse_implicit_link_info().
Because of that, FindOpenMP module can't find some libraries,
like libpthread. For this, we should analyze -print-search-dirs
output and append library paths to implicit link ones.
2022-06-30 22:48:45 +03:00
makise-homura
e5d9fce03f LCC: Add dedicated support for MCST LCC compiler
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.
2021-10-15 05:05:19 +03:00
Eisuke Kawashima
b3bf33539b FindOpenMP: Link with OpenMP flags on Fujitsu
Fixes: #22332
2021-06-24 09:09:49 -04:00
Chuck Atkins
376c300b25 FindOpenMP: Add support for Fujitsu compilers
Co-Author: Yuichiro Utsumi <utsumi.yuichiro@jp.fujitsu.com>
2021-03-31 09:14:45 -04:00
William R. Dieter
6fd014a4b6 FindOpenMP: Use -Qiopenmp instead of -fiopenmp for IntelLLVM on Windows
The Windows driver does not like the `-f` form of this option.

Note that we prefer `-Qiopenmp/-fiopenmp` over `-Qopenmp/-fopenmp` in
order to generate LLVM IR with parallelization information, which the
backend uses to generate parallelized code.

Signed-off-by: William R. Dieter <william.r.dieter@intel.com>
2021-03-15 14:43:23 -04:00
William R. Dieter
042aba3db4 FindOpenMP: Add support for IntelLLVM
Signed-off-by: William R. Dieter <william.r.dieter@intel.com>
2021-01-28 09:07:00 -05:00
Tin Huynh
90502d76b7 FindOpenMP: Add support for NVHPC compiler 2021-01-27 09:53:02 -05:00
Nikita Nemkin
8fea95319b Help: Add .. versionadded directives to module docs
Issue: #19715
2020-12-02 21:00:30 +05:00
Brad King
656d6ea821 FindOpenMP: Set version variables every time CMake runs
The version is determined in two steps.  First, the "spec date" is
detected and cached.  Second, the date is converted to a version.
Move the second step out of the spec date cache guard condition
so that it runs every time even if the spec date is already cached.

Fixes: #19150
2020-07-09 06:17:44 -04:00
Tim Hutton
ceb5ee4a7b FindOpenMP: Add support for Clang on Windows
Fixes: #19404
2020-02-10 17:20:19 -05:00
Tim Hutton
2dbff623f9 FindOpenMP: Save flags/libs in cache entries each time they are detected 2020-02-10 17:20:19 -05:00
Ben Boeckel
be4d1bdf9a FPHSA: acknowledge the name mismatches in CMake-owned modules 2020-01-14 17:25:49 -05:00
Brad King
ede1bebd50 Merge topic 'FindOpenMP-include-dir'
409891baf7 FindOpenMP: Allow try_compile() to find omp.h for AppleClang

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3916
2019-10-21 11:20:33 -04:00
Craig Scott
409891baf7 FindOpenMP: Allow try_compile() to find omp.h for AppleClang
Fixes: #18098 #18470 #18520
2019-10-17 18:50:05 +11:00
Konstantin Pyzhov
db5a8d7876 FindOpenMP: Add support for HIP clang device pass
The HIP clang makes 2 passes when compiling HIP programs: the DEVICE
pass and the HOST pass.  For openmp, the `-fopenmp` option is only
passed to the HOST compilation pass.  Therefore, the small test that
CMake uses for OpenMP detection fails to compile, and CMake reports
failure to detect OpenMP support in the compiler.  The suggested
solution is to add check for `__HIP_DEVICE_COMPILE__` macro defined by
HIP clang for the DEVICE pass to the OpenMP detection test.
2019-10-12 11:04:45 -04:00
Christian Pfeiffer
26f2b65fec FindOpenMP: Add 5.0 and VS19 spec dates
Fixes: #19289
2019-05-24 19:01:28 +02:00
Bartosz Kosiorek
cb811d11ce Help: Improve description of modules 2019-04-23 10:39:34 +02:00