Ver Fonte

Add -faligned-allocation to macOS build (#927)

To silence warning when compiling for macOS < 10.14

Fixes #922
Jorrit Rouwe há 1 ano atrás
pai
commit
7cb5d1d627
1 ficheiros alterados com 5 adições e 0 exclusões
  1. 5 0
      Build/CMakeLists.txt

+ 5 - 0
Build/CMakeLists.txt

@@ -157,6 +157,11 @@ else()
 		endif()
 	endif()
 
+	# See https://github.com/jrouwe/JoltPhysics/issues/922. When compiling with DOUBLE_PRECISION=YES and CMAKE_OSX_DEPLOYMENT_TARGET=10.12 clang triggers a warning that we silence here.
+	if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin" AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
+		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -faligned-allocation")
+	endif()
+
 	# Cross compiler flags
 	if (CROSS_COMPILE_ARM)
 		set(CMAKE_CXX_FLAGS "--target=aarch64-linux-gnu ${CMAKE_CXX_FLAGS}")