diff --git a/CMakeLists.txt b/CMakeLists.txt index 87b26053f7..0c8c98a228 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,6 +128,14 @@ if (NOT NOFORTRAN AND CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang") endif() set(NO_AVX512 1) endif() + + if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 19) + # LLVM Flang before version 19 doesn't support necessary OpenMP constructs. + if (USE_OPENMP) + message(STATUS "Disabling OpenMP for LLVM Flang before version 19.") + set(USE_OPENMP 0) + endif() + endif() endif() include("${PROJECT_SOURCE_DIR}/cmake/utils.cmake")