Make build work on OS X with older cmake versions.
`uname -p` is still i386 on OS X for some reason, which causes cmake 2.8 to set CMAKE_SYSTEM_PROCESSOR to i386, making the build think it's doing a 32-bit build. However, since the system is almost completely 64-bit these days, clang defaults to producing 64-bit object files unless told otherwise. As a result, the produced .o files are all 64-bit except for the .o files from assembly, and then linking fails. Fix this by forcing ARCH to 64-bit on OS X. This matches the default behavior of cmake 3.0, where CMAKE_SYSTEM_PROCESSOR is x86_64. Change-Id: I7a2abc4cef84dfbaf205852a9d7b647e83dd249f Reviewed-on: https://boringssl-review.googlesource.com/2330 Reviewed-by: Adam Langley <agl@google.com> Reviewed-by: Piotr Sikora <piotr@cloudflare.com>
This commit is contained in:
parent
000800a306
commit
deb5284138
@ -36,6 +36,13 @@ else()
|
||||
message(FATAL_ERROR "Unknown processor:" ${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
|
||||
if (${ARCH} STREQUAL "x86" AND APPLE)
|
||||
# With CMake 2.8.x, ${CMAKE_SYSTEM_PROCESSOR} evalutes to i386 on OS X,
|
||||
# but clang defaults to 64-bit builds on OS X unless otherwise told.
|
||||
# Set ARCH to x86_64 so clang and CMake agree. This is fixed in CMake 3.
|
||||
set(ARCH "x86_64")
|
||||
endif()
|
||||
|
||||
add_subdirectory(crypto)
|
||||
add_subdirectory(ssl)
|
||||
add_subdirectory(ssl/test)
|
||||
|
Loading…
Reference in New Issue
Block a user