[SampleProfileLoader] Fix integer overflow in generateMDProfMetadata (#90217)
[llvm-project.git] / openmp / cmake / config-ix.cmake
blobcfc683385d56e5d9804f1c5756d347e7a3013d94
1 include(CheckCXXCompilerFlag)
2 include(CheckCXXSourceCompiles)
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()
19 check_cxx_compiler_flag(-Wall OPENMP_HAVE_WALL_FLAG)
20 check_cxx_compiler_flag(-Werror OPENMP_HAVE_WERROR_FLAG)
21 check_cxx_compiler_flag(-fcolor-diagnostics OPENMP_HAVE_COLOR_DIAGNOSTICS)
23 # Additional warnings that are not enabled by -Wall.
24 check_cxx_compiler_flag(-Wcast-qual OPENMP_HAVE_WCAST_QUAL_FLAG)
25 check_cxx_compiler_flag(-Wformat-pedantic OPENMP_HAVE_WFORMAT_PEDANTIC_FLAG)
26 check_cxx_compiler_flag(-Wimplicit-fallthrough OPENMP_HAVE_WIMPLICIT_FALLTHROUGH_FLAG)
27 check_cxx_compiler_flag(-Wsign-compare OPENMP_HAVE_WSIGN_COMPARE_FLAG)
29 # Warnings that we want to disable because they are too verbose or fragile.
31 # GCC silently accepts any -Wno-<foo> option, but warns about those options
32 # being unrecognized only if the compilation triggers other warnings to be
33 # printed. Therefore, check for whether the compiler supports options in the
34 # form -W<foo>, and if supported, add the corresponding -Wno-<foo> option.
36 check_cxx_compiler_flag(-Wextra OPENMP_HAVE_WEXTRA_FLAG)
37 check_cxx_compiler_flag(-Wpedantic OPENMP_HAVE_WPEDANTIC_FLAG)
38 check_cxx_compiler_flag(-Wmaybe-uninitialized OPENMP_HAVE_WMAYBE_UNINITIALIZED_FLAG)
40 # Additional flags for optimizing created libraries.
42 check_cxx_compiler_flag(-fno-semantic-interposition OPENMP_HAVE_NO_SEMANTIC_INTERPOSITION)
43 check_cxx_compiler_flag(-ffunction-section OPENMP_HAVE_FUNCTION_SECTIONS)
44 check_cxx_compiler_flag(-fdata-sections OPENMP_HAVE_DATA_SECTIONS)