# Work around https://github.com/grpc/grpc/issues/37976 diff --git a/CMakeLists.txt b/CMakeLists.txt index 391d113eab..aa6e3d41ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -268,7 +268,7 @@ set(gRPC_USE_PROTO_LITE OFF CACHE BOOL "Use the protobuf-lite library") if(UNIX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(_gRPC_PLATFORM_LINUX ON) - if(NOT CMAKE_CROSSCOMPILING AND CMAKE_SIZEOF_VOID_P EQUAL 4) + if(CMAKE_SYSTEM_PROCESSOR MATCHES "i[3-6]86" AND CMAKE_SIZEOF_VOID_P EQUAL 4) message("+++ Enabling SSE2 for ${CMAKE_SYSTEM_PROCESSOR}") set(_gRPC_C_CXX_FLAGS "${_gRPC_C_CXX_FLAGS} -msse2") endif() diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index d80675afc4..fb6a46daa1 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -374,7 +374,7 @@ if(UNIX) if(<%text>${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(_gRPC_PLATFORM_LINUX ON) - if(NOT CMAKE_CROSSCOMPILING AND CMAKE_SIZEOF_VOID_P EQUAL 4) + if(CMAKE_SYSTEM_PROCESSOR MATCHES "i[3-6]86" AND CMAKE_SIZEOF_VOID_P EQUAL 4) message("+++ Enabling SSE2 for <%text>${CMAKE_SYSTEM_PROCESSOR}") set(_gRPC_C_CXX_FLAGS "<%text>${_gRPC_C_CXX_FLAGS} -msse2") endif()