aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorla-ninpre <leobrekalini@gmail.com>2021-09-10 14:54:42 +0000
committerla-ninpre <leobrekalini@gmail.com>2021-09-10 14:54:42 +0000
commit00981834d98546471e30441979a36dac52a76ecd (patch)
treec41d89787733a86456783ec7bcd138f54daccc1b
parent1b1a637e4514029702216a2768adad2e43eebb8c (diff)
downloadnimisewi_c-00981834d98546471e30441979a36dac52a76ecd.tar.gz
nimisewi_c-00981834d98546471e30441979a36dac52a76ecd.zip
fixed build on android
there's no need in libmd and libpthread on android when statically linking libbsd (for arc4random family of functions). FossilOrigin-Name: d8166f4ed14ce7e28ee6093c135cc3e3851273ebc494973b992f980091bb1881
-rw-r--r--CMakeLists.txt47
1 files changed, 28 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c32ab9d..6ae0628 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,28 +52,37 @@ if(OS_NAME MATCHES "Linux")
check_c_source_compiles(
"#include<bsd/string.h>\nint main(void){return 0;}"
HAVE_LIBBSD_STATIC)
- # libpthread and libmd are needed when linking statically on linux.
- # these test aren't really checking particular functions, but
- # they are here to make sure that program could be linked statically
- unset(CMAKE_REQUIRED_LIBRARIES)
- set(CMAKE_REQUIRED_LIBRARIES "pthread")
- check_c_source_compiles(
- "#include<pthread.h>\nint main(void){return 0;}"
- HAVE_LIBPTHREAD_STATIC)
-
- unset(CMAKE_REQUIRED_LIBRARIES)
- set(CMAKE_REQUIRED_LIBRARIES "md")
- check_c_source_compiles(
- "#include<sha2.h>\nint main(void){return 0;}"
- HAVE_LIBMD_STATIC)
- if(NOT (HAVE_LIBBSD_STATIC
- AND HAVE_LIBPTHREAD_STATIC
- AND HAVE_LIBMD_STATIC))
- message(WARNING ${WARNING_STATIC_BUILD})
+ if(NOT ANDROID)
+ # libpthread and libmd are needed when linking statically on linux.
+ # these test aren't really checking particular functions, but
+ # they are here to make sure that program could be linked statically
+ unset(CMAKE_REQUIRED_LIBRARIES)
+ set(CMAKE_REQUIRED_LIBRARIES "pthread")
+ check_c_source_compiles(
+ "#include<pthread.h>\nint main(void){return 0;}"
+ HAVE_LIBPTHREAD_STATIC)
+
+ unset(CMAKE_REQUIRED_LIBRARIES)
+ set(CMAKE_REQUIRED_LIBRARIES "md")
+ check_c_source_compiles(
+ "#include<sha2.h>\nint main(void){return 0;}"
+ HAVE_LIBMD_STATIC)
+
+ if(NOT (HAVE_LIBBSD_STATIC
+ AND HAVE_LIBPTHREAD_STATIC
+ AND HAVE_LIBMD_STATIC))
+ message(WARNING ${WARNING_STATIC_BUILD})
+ list(APPEND EXTRA_LIBS bsd pthread md)
+ endif()
+
+ else()
+ if(NOT (HAVE_LIBBSD_STATIC))
+ message(WARNING ${WARNING_STATIC_BUILD})
+ endif()
+ list(APPEND EXTRA_LIBS bsd)
endif()
- list(APPEND EXTRA_LIBS bsd pthread md)
unset(CMAKE_REQUIRED_LIBRARIES)
unset(CMAKE_REQUIRED_LINK_OPTIONS)
endif()