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 /Tests | |
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 'Tests')
-rw-r--r-- | Tests/FindOpenMP/Test/CMakeLists.txt | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Tests/FindOpenMP/Test/CMakeLists.txt b/Tests/FindOpenMP/Test/CMakeLists.txt index ebdb6b8..7ead835 100644 --- a/Tests/FindOpenMP/Test/CMakeLists.txt +++ b/Tests/FindOpenMP/Test/CMakeLists.txt @@ -26,8 +26,21 @@ foreach(c C CXX Fortran) endif() endforeach() +if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" + AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.30 + AND NOT CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64") + set(test_msvc_runtime 1) + set(OpenMP_RUNTIME_MSVC "llvm") +endif() + find_package(OpenMP REQUIRED) +if(test_msvc_runtime) + if(NOT OpenMP_C_FLAGS STREQUAL "-openmp:llvm") + message(FATAL_ERROR "OpenMP_RUNTIME_MSVC='${OpenMP_RUNTIME_MSVC}' not honored: '${OpenMP_C_FLAGS}'") + endif() +endif() + foreach(c C CXX Fortran) if(NOT "${OpenMP_TEST_${c}}") continue() |