This is an automated email from the ASF dual-hosted git repository. BewareMyPower pushed a commit to branch branch-4.2 in repository https://gitbox.apache.org/repos/asf/pulsar-client-cpp.git
commit ee192c9c5e04a23f647d166b6ba9d288f27b1ac2 Author: Yunze Xu <[email protected]> AuthorDate: Fri May 29 09:50:44 2026 +0800 Fix macOS cross-architecture build on arm64 when target arch is x86_64 (#582) (cherry picked from commit a169e10ca643ce5669d070f8df6fbed0c09d4f72) --- CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b8a78a..cf7cc6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,14 @@ if(CCACHE_PROGRAM) endif(CCACHE_PROGRAM) MESSAGE(STATUS "ARCHITECTURE: ${CMAKE_SYSTEM_PROCESSOR}") +set(PULSAR_TARGET_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}") +if (APPLE AND CMAKE_OSX_ARCHITECTURES) + list(LENGTH CMAKE_OSX_ARCHITECTURES PULSAR_OSX_ARCH_COUNT) + if (PULSAR_OSX_ARCH_COUNT EQUAL 1) + set(PULSAR_TARGET_PROCESSOR "${CMAKE_OSX_ARCHITECTURES}") + endif () +endif () +MESSAGE(STATUS "TARGET_ARCHITECTURE: ${PULSAR_TARGET_PROCESSOR}") option(BUILD_DYNAMIC_LIB "Build dynamic lib" ON) MESSAGE(STATUS "BUILD_DYNAMIC_LIB: " ${BUILD_DYNAMIC_LIB}) @@ -99,7 +107,7 @@ else() # GCC or Clang are mostly compatible: add_compile_options(-Wall -Wformat-security -Wvla -Werror) # Turn off certain warnings that are too much pain for too little gain: add_compile_options(-Wno-sign-compare -Wno-deprecated-declarations -Wno-error=cpp) - if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + if (PULSAR_TARGET_PROCESSOR STREQUAL "x86_64") add_compile_options(-msse4.2 -mpclmul) endif() # Options unique to Clang or GCC:
