Skip to content

Commit 2c6a2fd

Browse files
authored
going native (#7)
- Adds the -march=native flag when supported.
1 parent e2979b8 commit 2c6a2fd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ set(CMAKE_CXX_STANDARD 17)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
66
set(CMAKE_C_STANDARD 99)
77
set(CMAKE_C_STANDARD_REQUIRED ON)
8-
8+
include(CheckCXXCompilerFlag)
9+
unset(FASTPFOR_COMPILER_SUPPORTS_MARCH_NATIVE CACHE)
10+
CHECK_CXX_COMPILER_FLAG(-march=native FASTPFOR_COMPILER_SUPPORTS_MARCH_NATIVE)
11+
if(FASTPFOR_COMPILER_SUPPORTS_MARCH_NATIVE)
12+
add_compile_options(-march=native)
13+
else()
14+
message(STATUS "native target not supported")
15+
endif()
916
if (NOT CMAKE_BUILD_TYPE)
1017
message(STATUS "No build type selected, default to Release")
1118
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)

0 commit comments

Comments
 (0)