Merge pull request #11 from musalbas/master

Add -march=native for compilers that support it
This commit is contained in:
Chris Taylor 2018-08-22 11:55:14 -07:00 committed by GitHub
commit b58d1eaf59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -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)