summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmake/cpu.cmake16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/cmake/cpu.cmake b/src/cmake/cpu.cmake
index b54155d4bb3..69f83c98b8d 100644
--- a/src/cmake/cpu.cmake
+++ b/src/cmake/cpu.cmake
@@ -59,13 +59,6 @@ endif()
option(VPP_BUILD_NATIVE_ONLY "Build only for native CPU." OFF)
-if(VPP_BUILD_NATIVE_ONLY)
- check_c_compiler_flag("-march=native" compiler_flag_march_native)
- if(NOT compiler_flag_march_native)
- message(FATAL_ERROR "Native-only build not supported by compiler")
- endif()
-endif()
-
macro(add_vpp_march_variant v)
cmake_parse_arguments(ARG
"OFF"
@@ -112,7 +105,14 @@ macro(add_vpp_march_variant v)
endmacro()
if(VPP_BUILD_NATIVE_ONLY)
- set(VPP_DEFAULT_MARCH_FLAGS -march=native)
+ set(VPP_BUILD_NATIVE_ARCH "native" CACHE STRING "native CPU -march= value.")
+ set(VPP_DEFAULT_MARCH_FLAGS -march=${VPP_BUILD_NATIVE_ARCH})
+ if(VPP_BUILD_NATIVE_ONLY)
+ check_c_compiler_flag(${VPP_DEFAULT_MARCH_FLAGS} compiler_flag_march)
+ if(NOT compiler_flag_march)
+ message(FATAL_ERROR "Native-only build with ${VPP_DEFAULT_MARCH_FLAGS} is not supported by compiler")
+ endif()
+ endif()
set(MARCH_VARIANTS_NAMES "native-only")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
set(VPP_DEFAULT_MARCH_FLAGS -march=corei7 -mtune=corei7-avx)