Skip to content

Commit 83b3b14

Browse files
committed
Work-around for linux/armhf target compiling as 64bit w/ OpenSSL
1 parent c7f83a7 commit 83b3b14

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

external/openssl-cmake/CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,25 @@ if(CMAKE_CROSSCOMPILING)
162162
endif()
163163
endif()
164164
endif()
165+
166+
# NOTE: Running the configure step with OpenSSL on linux/armhf defaults to aarch64 instead of armv4
167+
# so we must set the cross-host value to force it to do the right thing. We detect that platform
168+
# here and do so accordingly.
169+
include(CheckCSourceCompiles)
170+
check_c_source_compiles("
171+
#if !(defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM))
172+
#error Not 32-bit ARM
173+
#endif
174+
#if defined(__aarch64__) || defined(__ARM64__) || defined(_M_ARM64)
175+
#error 64-bit ARM
176+
#endif
177+
int main() { return 0; }
178+
" IS_ARM32)
179+
180+
if(IS_ARM32 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
181+
set(cross_host "linux-armv4")
182+
endif()
183+
165184
build_external(openssl
166185
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env
167186
CC=${deps_cc}

0 commit comments

Comments
 (0)