Improve cmake files for building on Android

Signed-off-by: William Brawner <me@wbrawner.com>
This commit is contained in:
William Brawner 2020-01-11 15:32:49 -07:00
parent 05e8690fb0
commit 3e67cd240b

View file

@ -25,41 +25,45 @@ set(PIHELPER_SOURCES
) )
include_directories(/usr/local/include) include_directories(/usr/local/include)
find_library ( if (NOT TARGET CURL)
CURL find_library(
NAMES curl libcurl CURL
HINTS /usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64 NAMES curl libcurl
) HINTS /usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64
find_library ( )
JSONC if (NOT CURL)
NAMES json-c libjson-c message(SEND_ERROR "Did not find curl")
HINTS /usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64 endif()
)
find_library (
CRYPTO
NAMES crypto libcrypto
HINTS /usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64
)
find_library (
OPENSSL
NAMES ssl libssl
HINTS /usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64
)
if (NOT CURL)
message(SEND_ERROR "Did not find curl")
endif() endif()
if (NOT TARGET JSONC)
if (NOT JSONC) find_library(
message(SEND_ERROR "Did not find json-c") JSONC
NAMES json-c libjson-c
HINTS /usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64
)
if (NOT JSONC)
message(SEND_ERROR "Did not find json-c")
endif()
endif() endif()
if (NOT TARGET CRYPTO)
if (NOT CRYPTO) find_library(
message(SEND_ERROR "Did not find OpenSSL") CRYPTO
NAMES crypto libcrypto
HINTS /usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64
)
if (NOT CRYPTO)
message(SEND_ERROR "Did not find OpenSSL")
endif()
endif() endif()
if (NOT TARGET OPENSSL)
if (NOT OPENSSL) find_library(
message(SEND_ERROR "Did not find OpenSSL") OPENSSL
NAMES ssl libssl
HINTS /usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64
)
if (NOT OPENSSL)
message(SEND_ERROR "Did not find OpenSSL")
endif()
endif() endif()
option(PIHELPER_STATIC "Build Pi-Helper as a static library" ON) option(PIHELPER_STATIC "Build Pi-Helper as a static library" ON)
@ -85,7 +89,7 @@ if (PIHELPER_STATIC)
) )
install(TARGETS libpihelperstatic install(TARGETS libpihelperstatic
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
) )
endif() endif()
@ -131,7 +135,7 @@ if (PIHELPER_EXECUTABLE)
) )
install(TARGETS pihelper install(TARGETS pihelper
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
endif() endif()