diff --git a/cmake/CompileFlags.cmake b/cmake/CompileFlags.cmake --- a/cmake/CompileFlags.cmake +++ b/cmake/CompileFlags.cmake @@ -127,6 +127,18 @@ macro(compile_flags) "$<$:-flifetime-dse=1>" ) endif() + + if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag("-mno-sse4" NO_SSE4_FOUND) + + if(NO_SSE4_FOUND) + add_compile_options( + # Don't use SSE4 for general sources to increase compatibility. + -mno-sse4 + ) + endif() + endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") add_compile_options( -Wall