diff --git a/CMakeLists.txt b/CMakeLists.txt index bab87b9..6dd492d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -391,7 +391,11 @@ else() endif() if (OPENSSL_THREADS) - find_package(Threads REQUIRED) + if (NOT IOS) + find_package(Threads REQUIRED) + else() + add_library(Threads::Threads INTERFACE IMPORTED) + endif() set(OPENSSL_NO_THREADS OFF CACHE BOOL "Build without threads supported (automatically set, use OPENSSL_THREADS if this is to be modified)" FORCE) else() set(OPENSSL_NO_THREADS ON CACHE BOOL "Build without threads supported (automatically set, use OPENSSL_THREADS if this is to be modified)" FORCE) @@ -440,14 +444,16 @@ elseif (APPLE AND NOT IOS) endif() endif() elseif (IOS) - if (OPENSSL_TARGET_ARCH STREQUAL "x64") - set(OPENSSL_BUILD_PLATFORM "iossimulator-xcrun") - elseif (OPENSSL_TARGET_ARCH STREQUAL "arm32") - set(OPENSSL_BUILD_PLATFORM "ios-xcrun") - elseif (OPENSSL_TARGET_ARCH STREQUAL "arm64") - set(OPENSSL_BUILD_PLATFORM "ios64-xcrun") + if (OPENSSL_OSX_ARCHITECTURES_LENGTH GREATER 1) + # set in buildinf.h.appleUnified.cmake.in else() - set(OPENSSL_BUILD_PLATFORM "iphoneos-cross") + if (OPENSSL_TARGET_ARCH STREQUAL "arm64") + set(OPENSSL_BUILD_PLATFORM "ios64-xcrun") + elseif (OPENSSL_TARGET_ARCH STREQUAL "arm32") + set(OPENSSL_BUILD_PLATFORM "ios-xcrun") + else() + set(OPENSSL_BUILD_PLATFORM "iossimulator-xcrun") + endif() endif() elseif (ANDROID) if (OPENSSL_TARGET_ARCH STREQUAL "x64") diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index 09de8a7..8d48e6c 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -192,6 +192,7 @@ target_link_libraries(openssl install(TARGETS openssl RUNTIME + BUNDLE DESTINATION "${CMAKE_BINARY_DIR}" ) install(PROGRAMS CA.pl diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index bd11220..e659208 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -89,7 +89,7 @@ if (NOT HAVE_SIZEOF_LONG) else() if (NOT SIZEOF_LONG) if (HAVE_SIZEOF_LONG AND SIZEOF_LONG_KEYS) - foreach (SIZE_OF_LONG_KEY IN LIST SIZEOF_LONG_KEYS) + foreach (SIZE_OF_LONG_KEY IN LISTS SIZEOF_LONG_KEYS) if (SIZEOF_LONG EQUAL 0) set(SIZEOF_LONG ${SIZEOF_LONG-${SIZE_OF_LONG_KEY}}) elseif (NOT SIZEOF_LONG EQUAL ${SIZEOF_LONG-${SIZE_OF_LONG_KEY}}) @@ -329,7 +329,7 @@ if (NOT OPENSSL_BUILD_TIMESTAMP) set(OPENSSL_BUILD_TIMESTAMP "date not available") endif() set(OPENSSL_BUILDINF_H_CMAKE_IN "buildinf.h.cmake.in") -if ( APPLE AND ( NOT IOS ) AND CMAKE_OSX_ARCHITECTURES ) +if ( APPLE AND CMAKE_OSX_ARCHITECTURES ) list(LENGTH CMAKE_OSX_ARCHITECTURES OPENSSL_OSX_ARCHITECTURES_LENGTH) if (OPENSSL_OSX_ARCHITECTURES_LENGTH GREATER 1) set(OPENSSL_BUILDINF_H_CMAKE_IN "buildinf.h.appleUnified.cmake.in") diff --git a/crypto/buildinf.h.appleUnified.cmake.in b/crypto/buildinf.h.appleUnified.cmake.in index 94bf0e7..088cba9 100644 --- a/crypto/buildinf.h.appleUnified.cmake.in +++ b/crypto/buildinf.h.appleUnified.cmake.in @@ -5,10 +5,25 @@ static char compiler_flags[] = { @LIBCRYPTO_CFLAGS_SOOOOOOOOLONG@ '\0' }; + +#include + +#if TARGET_OS_OSX #ifdef __aarch64__ /* match future OpenSSL versions */ #define PLATFORM "platform: darwin64-arm64-cc" #else #define PLATFORM "platform: darwin64-x86_64-cc" -#endif +#endif /* __aarch64__ */ +#elif TARGET_OS_IOS /* TARGET_OS_OSX */ +#if TARGET_OS_SIMULATOR +#define PLATFORM "platform: iossimulator-xcrun" +#else +#ifdef __aarch64__ +#define PLATFORM "platform: ios64-xcrun" +#else +#define PLATFORM "platform: ios-xcrun" +#endif /* __aarch64__ */ +#endif /* TARGET_OS_SIMULATOR */ +#endif /* TARGET_OS_IOS */ #define DATE "built on: @OPENSSL_BUILD_TIMESTAMP@"