summaryrefslogtreecommitdiff
path: root/cmake/FindSODIUM.cmake
blob: fd6206ff2f14615d62af0e879f85ef77c4374552 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# - Try to find SODIUM
# Once done this will define
#
#  SODIUM_ROOT_DIR - Set this variable to the root installation of CMocka
#
# Read-Only variables:
#  SODIUM_FOUND - system has SODIUM
#  SODIUM_INCLUDE_DIR - the SODIUM include directory
#  SODIUM_LIBRARIES - Link these to use SODIUM
#  SODIUM_DEFINITIONS - Compiler switches required for using SODIUM
#
#=============================================================================
#  Copyright (c) 2013 Andreas Schneider <asn@cryptomilk.org>
#
#  Distributed under the OSI-approved BSD License (the "License");
#  see accompanying file Copyright.txt for details.
#
#  This software is distributed WITHOUT ANY WARRANTY; without even the
#  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#  See the License for more information.
#=============================================================================
#

set(_SODIUM_ROOT_HINTS
)

set(_SODIUM_ROOT_PATHS
    "$ENV{PROGRAMFILES}/sodium"
)

find_path(SODIUM_ROOT_DIR
    NAMES
        include/cmocka.h
    HINTS
        ${_SODIUM_ROOT_HINTS}
    PATHS
        ${_SODIUM_ROOT_PATHS}
)
mark_as_advanced(SODIUM_ROOT_DIR)

find_path(SODIUM_INCLUDE_DIR
    NAMES
        sodium.h
    PATHS
        ${SODIUM_ROOT_DIR}/include
)

find_library(SODIUM_LIBRARY
    NAMES
        sodium
    PATHS
        ${SODIUM_ROOT_DIR}/lib
)

if (SODIUM_LIBRARY)
    set(SODIUM_LIBRARIES
        ${SODIUM_LIBRARIES}
        ${SODIUM_LIBRARY}
    )
endif (SODIUM_LIBRARY)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SODIUM DEFAULT_MSG SODIUM_LIBRARIES SODIUM_INCLUDE_DIR)

# show the SODIUM_INCLUDE_DIR and SODIUM_LIBRARIES variables only in the advanced view
mark_as_advanced(SODIUM_INCLUDE_DIR SODIUM_LIBRARIES)