commit d6a351fdd2d3e7706978b4baf9397b97088e5adb parent b6223cbe58b3fe72be7933224caaa769d8ce31f3 Author: d.levin256@gmail.com <d.levin256@gmail.com> Date: Wed, 27 Jul 2016 18:41:23 +0300 Add ability to define architecture from cmake command line Diffstat:
M | examples/CMakeLists.txt | | | 6 | +++++- |
M | tests/CMakeLists.txt | | | 6 | +++++- |
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt @@ -19,7 +19,11 @@ cmake_minimum_required(VERSION 3.0) if (NOT MSVC) add_compile_options(-fno-exceptions -fno-rtti) - add_compile_options(-march=native) + if (NOT ARCH_FLAGS) + add_compile_options(-march=native) + else () + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_FLAGS}") + endif () link_libraries(stdc++ pthread) else () add_compile_options(/arch:AVX) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt @@ -19,7 +19,11 @@ cmake_minimum_required(VERSION 3.0) if (NOT MSVC) add_compile_options(-fno-exceptions -fno-rtti -ftemplate-backtrace-limit=0) - add_compile_options(-march=native) + if (NOT ARCH_FLAGS) + add_compile_options(-march=native) + else () + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_FLAGS}") + endif () link_libraries(stdc++ pthread m) else () add_compile_options(/arch:AVX)