brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · cfc6833 Raw
45 lines · plain
1include(CheckCXXCompilerFlag)2include(CheckCXXSourceCompiles)3 4# Check for oneAPI compiler (some older CMake versions detect as Clang)5if (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                             #else9                             not oneAPI10                             #endif" OPENMP_HAVE_ONEAPI_COMPILER)11  if (OPENMP_HAVE_ONEAPI_COMPILER)12    # According to CMake documentation, the compiler id should13    # be IntelLLVM when detected oneAPI14    set(CMAKE_C_COMPILER_ID "IntelLLVM")15    set(CMAKE_CXX_COMPILER_ID "IntelLLVM")16  endif()17endif()18 19check_cxx_compiler_flag(-Wall OPENMP_HAVE_WALL_FLAG)20check_cxx_compiler_flag(-Werror OPENMP_HAVE_WERROR_FLAG)21check_cxx_compiler_flag(-fcolor-diagnostics OPENMP_HAVE_COLOR_DIAGNOSTICS)22 23# Additional warnings that are not enabled by -Wall.24check_cxx_compiler_flag(-Wcast-qual OPENMP_HAVE_WCAST_QUAL_FLAG)25check_cxx_compiler_flag(-Wformat-pedantic OPENMP_HAVE_WFORMAT_PEDANTIC_FLAG)26check_cxx_compiler_flag(-Wimplicit-fallthrough OPENMP_HAVE_WIMPLICIT_FALLTHROUGH_FLAG)27check_cxx_compiler_flag(-Wsign-compare OPENMP_HAVE_WSIGN_COMPARE_FLAG)28 29# Warnings that we want to disable because they are too verbose or fragile.30 31# GCC silently accepts any -Wno-<foo> option, but warns about those options32# being unrecognized only if the compilation triggers other warnings to be33# printed. Therefore, check for whether the compiler supports options in the34# form -W<foo>, and if supported, add the corresponding -Wno-<foo> option.35 36check_cxx_compiler_flag(-Wextra OPENMP_HAVE_WEXTRA_FLAG)37check_cxx_compiler_flag(-Wpedantic OPENMP_HAVE_WPEDANTIC_FLAG)38check_cxx_compiler_flag(-Wmaybe-uninitialized OPENMP_HAVE_WMAYBE_UNINITIALIZED_FLAG)39 40# Additional flags for optimizing created libraries.41 42check_cxx_compiler_flag(-fno-semantic-interposition OPENMP_HAVE_NO_SEMANTIC_INTERPOSITION)43check_cxx_compiler_flag(-ffunction-section OPENMP_HAVE_FUNCTION_SECTIONS)44check_cxx_compiler_flag(-fdata-sections OPENMP_HAVE_DATA_SECTIONS)45