diff options
author | Martin Storsjö <martin@martin.st> | 2023-05-03 09:57:22 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2023-05-16 10:43:38 +0300 |
commit | d187ceee3b400b8b235630c6cddf64bf517620c7 (patch) | |
tree | 0db6a64c7b25322fdb61f4e11ce6710fdce6d51f /openmp/cmake | |
parent | c2b256a990590dc8b69930259650cfeb085add03 (diff) | |
download | llvm-d187ceee3b400b8b235630c6cddf64bf517620c7.zip llvm-d187ceee3b400b8b235630c6cddf64bf517620c7.tar.gz llvm-d187ceee3b400b8b235630c6cddf64bf517620c7.tar.bz2 |
[OpenMP] Use CMAKE_CXX_STANDARD for setting the C++ version
Previously, we tried to check whether the -std=c++17 option was
supported and manually add the flag. That doesn't work for compilers
that do support C++17 but use a different option syntax, like
clang-cl.
OpenMP itself probably doesn't specifically require C++17, therefore
CXX_STANDARD_REQUIRED is left off, but in some cases, we may
have code that only works in C++17 mode.
In particular, 46262cab24312c71717ca70a9d0700481aa59152 made a
refactoring that works when built with Clang in C++17 mode, but not
in C++14 mode. MSVC accepts the construct in both language modes.
For libomptarget, we've had specific checks that require C++17
(or the -std=c++17 option) to be supported. It's doubtful that
libomptarget has got any code which more specifically requires C++17;
this seems to be a remnant from when libomptarget was added
originally in 2467df6e4f04e3d0e8e78d662473ba1b87c0a885 / D14031.
At that point, the rest of OpenMP didn't require C++11, while
libomptarget did require it. Now, it's unlikely that anyone attempts
building it with a toolchain that doesn't support C++11.
At this point, we could also probably just set CXX_STANDARD_REQUIRED
to true, requiring C++17 as baseline for all the OpenMP libraries.
This fixes building OpenMP with clang-cl after
46262cab24312c71717ca70a9d0700481aa59152.
Differential Revision: https://reviews.llvm.org/D149726
Diffstat (limited to 'openmp/cmake')
-rw-r--r-- | openmp/cmake/HandleOpenMPOptions.cmake | 2 | ||||
-rw-r--r-- | openmp/cmake/config-ix.cmake | 2 |
2 files changed, 0 insertions, 4 deletions
diff --git a/openmp/cmake/HandleOpenMPOptions.cmake b/openmp/cmake/HandleOpenMPOptions.cmake index 53a2d05..4d6782a 100644 --- a/openmp/cmake/HandleOpenMPOptions.cmake +++ b/openmp/cmake/HandleOpenMPOptions.cmake @@ -35,5 +35,3 @@ append_if(OPENMP_HAVE_WENUM_CONSTEXPR_CONVERSION_FLAG "-Wno-enum-constexpr-conve append_if(OPENMP_HAVE_WEXTRA_FLAG "-Wno-extra" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) append_if(OPENMP_HAVE_WPEDANTIC_FLAG "-Wno-pedantic" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) append_if(OPENMP_HAVE_WMAYBE_UNINITIALIZED_FLAG "-Wno-maybe-uninitialized" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) - -append_if(OPENMP_HAVE_STD_CPP17_FLAG "-std=c++17" CMAKE_CXX_FLAGS) diff --git a/openmp/cmake/config-ix.cmake b/openmp/cmake/config-ix.cmake index 857cfe5..49e3742 100644 --- a/openmp/cmake/config-ix.cmake +++ b/openmp/cmake/config-ix.cmake @@ -36,5 +36,3 @@ check_cxx_compiler_flag(-Wenum-constexpr-conversion OPENMP_HAVE_WENUM_CONSTEXPR_ check_cxx_compiler_flag(-Wextra OPENMP_HAVE_WEXTRA_FLAG) check_cxx_compiler_flag(-Wpedantic OPENMP_HAVE_WPEDANTIC_FLAG) check_cxx_compiler_flag(-Wmaybe-uninitialized OPENMP_HAVE_WMAYBE_UNINITIALIZED_FLAG) - -check_cxx_compiler_flag(-std=c++17 OPENMP_HAVE_STD_CPP17_FLAG) |