diff --git a/CMakeLists.txt b/CMakeLists.txt index 041deb6..5ef59d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,11 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() +check_cxx_compiler_flag("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE) +if(COMPILER_SUPPORTS_MARCH_NATIVE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") +endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") check_cxx_compiler_flag("/O2" CXX_FLAG_O2) check_cxx_compiler_flag("/Oy" CXX_FLAG_Oy)