2 option(LLVM_ALLOW_PROBLEMATIC_CONFIGURATIONS OFF "Set this option to ON to allow problematic toolchain configurations. Use on your own risk.")
4 macro(log_problematic MESSAGE)
5 if(LLVM_ALLOW_PROBLEMATIC_CONFIGURATIONS)
6 message(WARNING "${MESSAGE}")
8 message(FATAL_ERROR "${MESSAGE}\nYou can force usage of this configuration by passing -DLLVM_ALLOW_PROBLEMATIC_CONFIGURATIONS=ON")
12 # MSVC and /arch:AVX is untested and have created problems before. See:
13 # https://github.com/llvm/llvm-project/issues/54645
14 if(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
15 string(TOLOWER "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}" _FLAGS)
16 if(_FLAGS MATCHES "/arch:avx[0-9]*")
17 log_problematic("Compiling LLVM with MSVC and the /arch:AVX flag is known to cause issues with parts of LLVM.\nSee https://github.com/llvm/llvm-project/issues/54645 for details.\nUse clang-cl if you want to enable AVX instructions.")