Commit 7f11b878 authored by Jon Siwek's avatar Jon Siwek

Improve cross compilation support

It's not possible to do CMake checks that require executing something
on the host that was built for the target platform.
parent 6a846488
...@@ -183,7 +183,7 @@ endif() ...@@ -183,7 +183,7 @@ endif()
################################################################################ ################################################################################
# check for g++ >= 4.8 or clang++ > = 3.2 # check for g++ >= 4.8 or clang++ > = 3.2
if(NOT WIN32 AND NOT CAF_NO_COMPILER_CHECK) if(NOT WIN32 AND NOT CAF_NO_COMPILER_CHECK AND NOT CMAKE_CROSSCOMPILING)
try_run(ProgramResult try_run(ProgramResult
CompilationSucceeded CompilationSucceeded
"${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}"
...@@ -547,22 +547,24 @@ if(NOT CAF_NO_OPENSSL) ...@@ -547,22 +547,24 @@ if(NOT CAF_NO_OPENSSL)
"Disable OpenSSL. Required >= 1.0.1 due to TLSv1.2 support.") "Disable OpenSSL. Required >= 1.0.1 due to TLSv1.2 support.")
set(CAF_NO_OPENSSL yes) set(CAF_NO_OPENSSL yes)
else() else()
# Check if openssl headers and library versions match if(NOT CMAKE_CROSSCOMPILING)
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES}) # Check if openssl headers and library versions match
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
check_c_source_runs(" set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
#include <openssl/opensslv.h> check_c_source_runs("
#include <openssl/crypto.h> #include <openssl/opensslv.h>
int main() { #include <openssl/crypto.h>
if (SSLeay() == OPENSSL_VERSION_NUMBER) { int main() {
return 0; if (SSLeay() == OPENSSL_VERSION_NUMBER) {
return 0;
}
return -1;
} }
return -1; " OPENSSL_CORRECT_VERSION_NUMBER)
} if (NOT OPENSSL_CORRECT_VERSION_NUMBER)
" OPENSSL_CORRECT_VERSION_NUMBER) message(FATAL_ERROR
if (NOT OPENSSL_CORRECT_VERSION_NUMBER) "OpenSSL library version does not match headers")
message(FATAL_ERROR endif()
"OpenSSL library version does not match headers")
endif() endif()
include_directories(BEFORE ${OPENSSL_INCLUDE_DIR}) include_directories(BEFORE ${OPENSSL_INCLUDE_DIR})
add_optional_caf_lib(openssl) add_optional_caf_lib(openssl)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment