This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Findunofficial-secp256k1.cmake
108 lines (87 loc) · 2.45 KB
/
Findunofficial-secp256k1.cmake
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
Findsecp256k1
-------
Finds the secp256k1 library.
Imported Targets
^^^^^^^^^^^^^^^^
This module provides the following imported targets, if found:
``unofficial::secp256k1``
The secp256k1 library
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables:
``UNOFFICIAL-SECP256K1_FOUND``
True if the system has the secp256k1 library.
``SECP256K1_VERSION``
The version of the secp256k1 library which was found.
``SECP256K1_INCLUDE_DIRS``
Include directories needed to use secp256k1.
``SECP256K1_LIBRARIES``
Libraries needed to link to secp256k1.
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``SECP256K1_INCLUDE_DIR``
The directory containing ``secp256k1.h``.
``SECP256K1_LIBRARY``
The path to the secp256k1 library.
#]=======================================================================]
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_check_modules(
PC_secp256k1
QUIET
"libsecp256k1"
)
if(NOT PC_SECP256K1_FOUND)
pkg_check_modules(
PC_secp256k1
QUIET
"secp256k1"
)
endif(NOT PC_SECP256K1_FOUND)
endif()
find_path(
SECP256K1_INCLUDE_DIR
NAMES secp256k1.h
PATHS ${PC_secp256k1_INCLUDE_DIRS}
)
find_library(
SECP256K1_LIBRARY
NAMES libsecp256k1 secp256k1
PATHS ${PC_secp256k1_LIBRARY_DIRS}
)
set(SECP256K1_VERSION ${PC_secp256k1_VERSION})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
${CMAKE_FIND_PACKAGE_NAME}
FOUND_VAR UNOFFICIAL-SECP256K1_FOUND
REQUIRED_VARS SECP256K1_LIBRARY SECP256K1_INCLUDE_DIR
VERSION_VAR SECP256K1_VERSION
)
if(UNOFFICIAL-SECP256K1_FOUND)
set(SECP256K1_LIBRARIES ${SECP256K1_LIBRARY})
set(SECP256K1_INCLUDE_DIRS ${SECP256K1_INCLUDE_DIR})
set(SECP256K1_DEFINITIONS ${PC_secp256k1_CFLAGS_OTHER})
endif()
if(UNOFFICIAL-SECP256K1_FOUND
AND NOT
TARGET
unofficial::secp256k1
)
add_library(
unofficial::secp256k1
UNKNOWN
IMPORTED
)
set_target_properties(
unofficial::secp256k1
PROPERTIES
IMPORTED_LOCATION "${SECP256K1_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_secp256k1_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${SECP256K1_INCLUDE_DIR}"
)
endif()
mark_as_advanced(SECP256K1_INCLUDE_DIR SECP256K1_LIBRARY)