diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2013-08-02 16:39:54 +0200 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-08-02 11:12:27 -0400 |
commit | 247c42095744ec065d2bee989144f4548b5d3bc7 (patch) | |
tree | abbb7c9db66498e2bab05732388c3a0cee6273a2 | |
parent | 20951dda7dfc0625fcbaccde4ec049ef6f2caeb6 (diff) |
cmake: Rewrite FindSODIUM.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Signed-off-by: irungentoo <irungentoo@gmail.com>
-rw-r--r-- | cmake/FindSODIUM.cmake | 70 |
1 files changed, 61 insertions, 9 deletions
diff --git a/cmake/FindSODIUM.cmake b/cmake/FindSODIUM.cmake index ffb6a1f7..fd6206ff 100644 --- a/cmake/FindSODIUM.cmake +++ b/cmake/FindSODIUM.cmake | |||
@@ -1,15 +1,67 @@ | |||
1 | # Find SODIUM | 1 | # - Try to find SODIUM |
2 | # Once done this will define | ||
2 | # | 3 | # |
3 | # SODIUM_INCLUDE_DIR | 4 | # SODIUM_ROOT_DIR - Set this variable to the root installation of CMocka |
4 | # SODIUM_LIBRARY | ||
5 | # SODIUM_FOUND | ||
6 | # | 5 | # |
6 | # Read-Only variables: | ||
7 | # SODIUM_FOUND - system has SODIUM | ||
8 | # SODIUM_INCLUDE_DIR - the SODIUM include directory | ||
9 | # SODIUM_LIBRARIES - Link these to use SODIUM | ||
10 | # SODIUM_DEFINITIONS - Compiler switches required for using SODIUM | ||
11 | # | ||
12 | #============================================================================= | ||
13 | # Copyright (c) 2013 Andreas Schneider <asn@cryptomilk.org> | ||
14 | # | ||
15 | # Distributed under the OSI-approved BSD License (the "License"); | ||
16 | # see accompanying file Copyright.txt for details. | ||
17 | # | ||
18 | # This software is distributed WITHOUT ANY WARRANTY; without even the | ||
19 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
20 | # See the License for more information. | ||
21 | #============================================================================= | ||
22 | # | ||
23 | |||
24 | set(_SODIUM_ROOT_HINTS | ||
25 | ) | ||
26 | |||
27 | set(_SODIUM_ROOT_PATHS | ||
28 | "$ENV{PROGRAMFILES}/sodium" | ||
29 | ) | ||
30 | |||
31 | find_path(SODIUM_ROOT_DIR | ||
32 | NAMES | ||
33 | include/cmocka.h | ||
34 | HINTS | ||
35 | ${_SODIUM_ROOT_HINTS} | ||
36 | PATHS | ||
37 | ${_SODIUM_ROOT_PATHS} | ||
38 | ) | ||
39 | mark_as_advanced(SODIUM_ROOT_DIR) | ||
40 | |||
41 | find_path(SODIUM_INCLUDE_DIR | ||
42 | NAMES | ||
43 | sodium.h | ||
44 | PATHS | ||
45 | ${SODIUM_ROOT_DIR}/include | ||
46 | ) | ||
47 | |||
48 | find_library(SODIUM_LIBRARY | ||
49 | NAMES | ||
50 | sodium | ||
51 | PATHS | ||
52 | ${SODIUM_ROOT_DIR}/lib | ||
53 | ) | ||
7 | 54 | ||
8 | FIND_PATH(SODIUM_INCLUDE_DIR NAMES sodium.h) | 55 | if (SODIUM_LIBRARY) |
56 | set(SODIUM_LIBRARIES | ||
57 | ${SODIUM_LIBRARIES} | ||
58 | ${SODIUM_LIBRARY} | ||
59 | ) | ||
60 | endif (SODIUM_LIBRARY) | ||
9 | 61 | ||
10 | FIND_LIBRARY(SODIUM_LIBRARY NAMES sodium) | 62 | include(FindPackageHandleStandardArgs) |
63 | find_package_handle_standard_args(SODIUM DEFAULT_MSG SODIUM_LIBRARIES SODIUM_INCLUDE_DIR) | ||
11 | 64 | ||
12 | INCLUDE(FindPackageHandleStandardArgs) | 65 | # show the SODIUM_INCLUDE_DIR and SODIUM_LIBRARIES variables only in the advanced view |
13 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(SODIUM DEFAULT_MSG SODIUM_LIBRARY SODIUM_INCLUDE_DIR) | 66 | mark_as_advanced(SODIUM_INCLUDE_DIR SODIUM_LIBRARIES) |
14 | 67 | ||
15 | MARK_AS_ADVANCED(SODIUM_INCLUDE_DIR SODIUM_LIBRARY) | ||