summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-01-02 01:09:11 +0100
committerMichael Lutz <michi@icosahedron.de>2021-01-02 01:26:26 +0100
commit5b1fb942407436bd87042d5de1c0d289fbc397c0 (patch)
treefa724e840892b29e7a3f3c49ac17779878f5c06f /cmake
parent8596b43b2bdcebe51a06dbb770701983277a80ea (diff)
downloadopenttd-5b1fb942407436bd87042d5de1c0d289fbc397c0.tar.xz
Codechange: [OSX] Prevent the compiler from using SSE4 instructions unless we want to.
This improves compatibility on older systems. We don't need to disable anything older, as there are no SSE2-only Macs.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/CompileFlags.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmake/CompileFlags.cmake b/cmake/CompileFlags.cmake
index f371353ae..f0b8af061 100644
--- a/cmake/CompileFlags.cmake
+++ b/cmake/CompileFlags.cmake
@@ -127,6 +127,18 @@ macro(compile_flags)
"$<$<BOOL:${LIFETIME_DSE_FOUND}>:-flifetime-dse=1>"
)
endif()
+
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
+ include(CheckCXXCompilerFlag)
+ check_cxx_compiler_flag("-mno-sse4" NO_SSE4_FOUND)
+
+ if(NO_SSE4_FOUND)
+ add_compile_options(
+ # Don't use SSE4 for general sources to increase compatibility.
+ -mno-sse4
+ )
+ endif()
+ endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
add_compile_options(
-Wall