diff --git a/src/libunicode/CMakeLists.txt b/src/libunicode/CMakeLists.txt index 25abbd1..d981da2 100644 --- a/src/libunicode/CMakeLists.txt +++ b/src/libunicode/CMakeLists.txt @@ -113,7 +113,13 @@ endif() if(LIBUNICODE_SIMD_IMPLEMENTATION STREQUAL "std" OR LIBUNICODE_SIMD_IMPLEMENTATION STREQUAL "intrinsics") - if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64") + # Normalize the processor name: it is "x86_64" on Linux, "AMD64" on Windows, + # and "amd64" on FreeBSD/other BSDs. A case-sensitive match missed the BSD + # spelling, so the SSE4.1/AVX flags below were never applied while the x86 + # intrinsics in intrinsics.h (gated on __x86_64__) were still compiled, + # breaking the FreeBSD build with always_inline SSE4.1 errors. + string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" _LIBUNICODE_PROCESSOR_LOWER) + if(_LIBUNICODE_PROCESSOR_LOWER STREQUAL "x86_64" OR _LIBUNICODE_PROCESSOR_LOWER STREQUAL "amd64") set(LIBUNICODE_SIMD_SOURCES simd_detector.cpp scan256.cpp