From 2919fdb7d42a38dc9f9cde181daa9a17f78b49de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=8C=E8=8D=89=E9=85=B8=E9=85=AF?= <17663689+kotori2@users.noreply.github.com> Date: Sun, 24 Jan 2021 22:44:20 +0800 Subject: [PATCH] Handle cross compiling properly (Fix for #654) (#694) --- CMakeLists.txt | 10 +++++----- cmake/tests/binary_compability_test.cc | 4 ---- 2 files changed, 5 insertions(+), 9 deletions(-) delete mode 100644 cmake/tests/binary_compability_test.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 6df5dac9..754738b7 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,13 +5,13 @@ project(drogon) message(STATUS "compiler: " ${CMAKE_CXX_COMPILER_ID}) include(CheckCXXSourceRuns) check_cxx_source_runs( - ${PROJECT_SOURCE_DIR}/cmake/tests/binary_compatibility_test.cc - cross_compiling) + "int main(){return 0;}" + not_cross_compiling) -if(cross_compiling) - set(BUILD_PROGRAMS OFF) -else(cross_compiling) +if(not_cross_compiling) set(BUILD_PROGRAMS ON) +else() + set(BUILD_PROGRAMS OFF) endif() option(BUILD_CTL "Build drogon_ctl" ${BUILD_PROGRAMS}) diff --git a/cmake/tests/binary_compability_test.cc b/cmake/tests/binary_compability_test.cc deleted file mode 100644 index a8fcadda..00000000 --- a/cmake/tests/binary_compability_test.cc +++ /dev/null @@ -1,4 +0,0 @@ -#include -int main(){ - return std::abs(-42); -} \ No newline at end of file