diff options
| -rw-r--r-- | CMakeLists.txt | 47 |
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() |
