20 lines · plain
1 2option(LLVM_ALLOW_PROBLEMATIC_CONFIGURATIONS OFF "Set this option to ON to allow problematic toolchain configurations. Use on your own risk.")3 4macro(log_problematic MESSAGE)5 if(LLVM_ALLOW_PROBLEMATIC_CONFIGURATIONS)6 message(WARNING "${MESSAGE}")7 else()8 message(FATAL_ERROR "${MESSAGE}\nYou can force usage of this configuration by passing -DLLVM_ALLOW_PROBLEMATIC_CONFIGURATIONS=ON")9 endif()10endmacro()11 12# MSVC and /arch:AVX is untested and have created problems before. See:13# https://github.com/llvm/llvm-project/issues/5464514if(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.")18 endif()19endif()20