Skip to content

Commit e7bda61

Browse files
Restrict -march=native to x86 (fixes macOS ARM build)
1 parent 6afe9cb commit e7bda61

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2114,7 +2114,11 @@ target_compile_definitions(freight_static PUBLIC
21142114
-DNDEBUG
21152115
)
21162116
target_compile_options(freight_static PRIVATE $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-w>)
2117-
target_compile_options(freight_static PUBLIC $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-march=native>)
2117+
# -march=native on x86 so crc32() uses hardware SSE4.2 (matching the CLI).
2118+
# Skip on ARM — the crc32 fallback (fnv2a) is used there regardless.
2119+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|i[3-6]86")
2120+
target_compile_options(freight_static PUBLIC -march=native)
2121+
endif()
21182122

21192123
if(OpenMP_CXX_FOUND)
21202124
target_link_libraries(freight_static PUBLIC OpenMP::OpenMP_CXX)

0 commit comments

Comments
 (0)