diff options
author | luigi1111 <luigi1111w@gmail.com> | 2021-03-29 21:59:12 -0400 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2021-03-29 21:59:12 -0400 |
commit | a5e122bebddcb3db20f7e32209801d4e9d03d3b0 (patch) | |
tree | 8b7bb834b8e1dc8bb632cc147ebbb1a804beba5e | |
parent | Merge pull request #7622 (diff) | |
parent | cmake: Don't default to -march=native on OpenBSD (diff) | |
download | monero-a5e122bebddcb3db20f7e32209801d4e9d03d3b0.tar.xz |
Merge pull request #7632
2d1fa5e cmake: Don't default to -march=native on OpenBSD (Nathan Dorfman)
-rw-r--r-- | CMakeLists.txt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 49ac18c66..17776c05f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -554,6 +554,17 @@ endif() # Trezor support check include(CheckTrezor) +# As of OpenBSD 6.8, -march=<anything> breaks the build +function(set_default_arch) + if (OPENBSD) + set(ARCH default) + else() + set(ARCH native) + endif() + + set(ARCH ${ARCH} CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all") +endfunction() + if(MSVC) add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__") # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline") @@ -567,7 +578,7 @@ if(MSVC) else() include(TestCXXAcceptsFlag) if (NOT ARCH) - set(ARCH native CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all") + set_default_arch() endif() message(STATUS "Building on ${CMAKE_SYSTEM_PROCESSOR} for ${ARCH}") if(ARCH STREQUAL "default") |