summaryrefslogtreecommitdiffstats
path: root/cmake/Findlibsodium.cmake
blob: a82063a9d0db8671095ee3db662b5890c60fb2eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Defines the following variables:
#  LIBSODIUM_FOUND
#  LIBSODIUM_INCLUDE_DIR
#  LIBSODIUM_LIBRARIES
#  LIBSODIUM_CFLAGS_OTHER
#  LIBSODIUM_LDFLAGS_OTHER


if(ANDROID)
  find_host_package(PkgConfig REQUIRED QUIET)
else(ANDROID)
  find_package(PkgConfig REQUIRED QUIET)
endif(ANDROID)

pkg_check_modules(_LIBSODIUM libsodium)

find_path(LIBSODIUM_INCLUDE_DIR NAMES sodium/crypto_stream.h HINTS ${_LIBSODIUM_INCLUDE_DIRS})
find_library(LIBSODIUM_LIBRARIES NAMES sodium HINTS ${_LIBSODIUM_LIBRARY_DIRS})

set(LIBSODIUM_CFLAGS_OTHER "${_LIBSODIUM_CFLAGS_OTHER}" CACHE STRING "Additional compiler flags for libsodium")
set(LIBSODIUM_LDFLAGS_OTHER "${_LIBSODIUM_LDFLAGS_OTHER}" CACHE STRING "Additional linker flags for libsodium")

find_package_handle_standard_args(libsodium REQUIRED_VARS LIBSODIUM_LIBRARIES LIBSODIUM_INCLUDE_DIR)
mark_as_advanced(LIBSODIUM_INCLUDE_DIR LIBSODIUM_LIBRARIES LIBSODIUM_CFLAGS_OTHER LIBSODIUM_LDFLAGS_OTHER)