150
|
1 include(CheckCXXCompilerFlag)
|
236
|
2 include(CheckCXXSourceCompiles)
|
|
3
|
|
4 # Check for oneAPI compiler (some older CMake versions detect as Clang)
|
|
5 if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
6 check_cxx_source_compiles("#if (defined(__INTEL_CLANG_COMPILER) || defined(__INTEL_LLVM_COMPILER))
|
|
7 int main() { return 0; }
|
|
8 #else
|
|
9 not oneAPI
|
|
10 #endif" OPENMP_HAVE_ONEAPI_COMPILER)
|
|
11 if (OPENMP_HAVE_ONEAPI_COMPILER)
|
|
12 # According to CMake documentation, the compiler id should
|
|
13 # be IntelLLVM when detected oneAPI
|
|
14 set(CMAKE_C_COMPILER_ID "IntelLLVM")
|
|
15 set(CMAKE_CXX_COMPILER_ID "IntelLLVM")
|
|
16 endif()
|
|
17 endif()
|
150
|
18
|
|
19 check_cxx_compiler_flag(-Wall OPENMP_HAVE_WALL_FLAG)
|
|
20 check_cxx_compiler_flag(-Werror OPENMP_HAVE_WERROR_FLAG)
|
|
21
|
|
22 # Additional warnings that are not enabled by -Wall.
|
|
23 check_cxx_compiler_flag(-Wcast-qual OPENMP_HAVE_WCAST_QUAL_FLAG)
|
|
24 check_cxx_compiler_flag(-Wformat-pedantic OPENMP_HAVE_WFORMAT_PEDANTIC_FLAG)
|
|
25 check_cxx_compiler_flag(-Wimplicit-fallthrough OPENMP_HAVE_WIMPLICIT_FALLTHROUGH_FLAG)
|
|
26 check_cxx_compiler_flag(-Wsign-compare OPENMP_HAVE_WSIGN_COMPARE_FLAG)
|
|
27
|
|
28 # Warnings that we want to disable because they are too verbose or fragile.
|
236
|
29 check_cxx_compiler_flag(-Wno-enum-constexpr-conversion OPENMP_HAVE_WNO_ENUM_CONSTEXPR_CONVERSION_FLAG)
|
150
|
30 check_cxx_compiler_flag(-Wno-extra OPENMP_HAVE_WNO_EXTRA_FLAG)
|
|
31 check_cxx_compiler_flag(-Wno-pedantic OPENMP_HAVE_WNO_PEDANTIC_FLAG)
|
|
32 check_cxx_compiler_flag(-Wno-maybe-uninitialized OPENMP_HAVE_WNO_MAYBE_UNINITIALIZED_FLAG)
|
|
33
|
236
|
34 check_cxx_compiler_flag(-std=c++17 OPENMP_HAVE_STD_CPP17_FLAG)
|