From 944177c76d4c7ff5ef3460eab28286a45344a0e7 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Sat, 14 Jul 2018 21:56:59 +1000 Subject: [PATCH 2/2] Make sure CMake respects the current arch on macOS Only set the macOS architecture if not defined by the user. Use the OpenSSL libraries and headers from Nix on macOS to prevent architecture mismatches. --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 14 +------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f37424d..c7217e28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,7 +172,7 @@ if (UNIX) # <= 10.5: 32-bit Intel and PowerPC set(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "" FORCE) - else() + elseif (NOT CMAKE_OSX_ARCHITECTURES) # >= 10.6: Intel only set(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "" FORCE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 237ba484..04428636 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,11 +23,6 @@ if (WIN32) set(OPENSSL_INCLUDE ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/inc32) endif() -if (APPLE) - set(OPENSSL_PLAT_DIR openssl-osx) - set(OPENSSL_INCLUDE ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/include) -endif() - if (WIN32) set(OPENSSL_LIBS ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/out32dll/libeay32.lib @@ -36,14 +31,7 @@ if (WIN32) endif() if (UNIX) - if (APPLE) - set(OPENSSL_LIBS - ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/libssl.a - ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/libcrypto.a - ) - else() - set(OPENSSL_LIBS ssl crypto) - endif() + set(OPENSSL_LIBS ssl crypto) endif() add_subdirectory(lib) -- 2.17.1