diff options
author | Axel Huebl <axel.huebl@plasma.ninja> | 2024-04-30 02:03:35 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-05-01 12:25:14 (GMT) |
commit | b07c637e42bb20410eebbfba693145b672451aaa (patch) | |
tree | e83ef42a5c1796e3e848ee978211b0eada2c8e43 /Modules | |
parent | 01e138a7b741414d233d75c2bf768d83e4b69cb2 (diff) | |
download | CMake-b07c637e42bb20410eebbfba693145b672451aaa.zip CMake-b07c637e42bb20410eebbfba693145b672451aaa.tar.gz CMake-b07c637e42bb20410eebbfba693145b672451aaa.tar.bz2 |
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
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindOpenMP.cmake | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 077a239..f88e43c 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -16,8 +16,22 @@ flag to support OpenMP. .. versionadded:: 3.5 Clang support. -Variables -^^^^^^^^^ +Input Variables +^^^^^^^^^^^^^^^ + +The following variables may be set to influence this module's behavior: + +``OpenMP_RUNTIME_MSVC`` + .. versionadded:: 3.30 + + Specify the `OpenMP Runtime <msvc-openmp_>`_ when compiling with MSVC. + If set to a non-empty value, such as ``experimental`` or ``llvm``, it + will be passed as the value of the ``-openmp:`` flag. + +.. _`msvc-openmp`: https://learn.microsoft.com/en-us/cpp/build/reference/openmp-enable-openmp-2-0-support + +Result Variables +^^^^^^^^^^^^^^^^ .. versionadded:: 3.10 The module exposes the components ``C``, ``CXX``, and ``Fortran``. @@ -121,7 +135,11 @@ function(_OPENMP_FLAG_CANDIDATES LANG) else() set(OMP_FLAG_IntelLLVM "-fiopenmp") endif() - set(OMP_FLAG_MSVC "-openmp") + if(OpenMP_RUNTIME_MSVC) + set(OMP_FLAG_MSVC "-openmp:${OpenMP_RUNTIME_MSVC}") + else() + set(OMP_FLAG_MSVC "-openmp") + endif() set(OMP_FLAG_PathScale "-openmp") set(OMP_FLAG_NAG "-openmp") set(OMP_FLAG_Absoft "-openmp") |