Handle cross compiling properly (Fix for #654) (#694)

This commit is contained in:
双草酸酯 2021-01-24 22:44:20 +08:00 committed by GitHub
parent 0168cd0574
commit 2919fdb7d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 9 deletions

View File

@ -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})

View File

@ -1,4 +0,0 @@
#include <algorithm>
int main(){
return std::abs(-42);
}