Skip to content

Commit 817d2c9

Browse files
committed
Add -march=native for compilers that support it
1 parent 01cd769 commit 817d2c9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ if(NOT CMAKE_BUILD_TYPE)
2828
set(CMAKE_BUILD_TYPE Release)
2929
endif()
3030

31+
check_cxx_compiler_flag("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
32+
if(COMPILER_SUPPORTS_MARCH_NATIVE)
33+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
34+
endif()
35+
3136
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
3237
check_cxx_compiler_flag("/O2" CXX_FLAG_O2)
3338
check_cxx_compiler_flag("/Oy" CXX_FLAG_Oy)

0 commit comments

Comments
 (0)